N
- specifies the indexing class for the receiverpublic class Axis<N extends java.lang.Number>
extends java.lang.Object
Section
Constructor and Description |
---|
Axis()
Constructs axis indexed by Integer class with two sections.
|
Axis(java.lang.Class<N> numberClass,
int sectionCount,
int headerIndex,
int bodyIndex)
Constructs axis indexed by the specified Number subclass containing the
specified number of sections.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(AxisItem<N> item1,
AxisItem<N> item2)
Compares positions of items on this axis and returns value greater then 0
if item1 is behind item2, value lower then zero if item1 is before item2
and 0 if items are the same.
|
int |
compare(Section<N> section1,
Section<N> section2)
Compares positions of sections on this axis and returns value greater then
0 if section1 is behind section2, value lower then zero if section1 is
before section2 and 0 if sections are the same.
|
pl.netanel.swt.matrix.NumberSetCore<N> |
createNumberSet()
Creates a number set.
|
int |
getAutoScrollOffset()
Returns the offset from the edge of scrolling area within which dragging
causes the content to scroll automatically and extend the dragged distance.
|
Section<N> |
getBody()
Returns the body section, which is by default a second section of the axis.
|
int[] |
getCellBound(AxisItem<N> item)
Returns the cell bound of the specified item in the viewport or
null if the position is outside of the viewport scope. |
AxisItem<N> |
getFocusItem()
Returns the focus item.
|
int |
getFrozenHead()
Returns the amount of items frozen at the beginning this axis.
|
int |
getFrozenTail()
Returns the amount of items frozen at the end this axis.
|
Section<N> |
getHeader()
Returns the header section, which is by default the first section of the
axis.
|
AxisItem<N> |
getItemByViewportDistance(int distance)
Returns the item visible at the specified distance from the beginning of
viewport area or
null if the distance is outside of the
viewport bounds. |
AxisItem<N> |
getItemByViewportOffset(AxisItem<N> item,
int offset)
Returns the item visible at the specified offset from the item specified by
the given section and index or
null if the such an item is
outside of the viewport bounds. |
AxisItem<N> |
getItemByViewportPosition(int position)
Returns the item visible at the specified position in the viewport or
null if the position is outside of the viewport bounds. |
int[] |
getLineBound(AxisItem<N> item)
Returns the line bound of the specified item in the viewport or
null if the position is outside of the viewport scope. |
int |
getMinimalCellWidth()
Returns the minimal cell width to be achieved by a user driven cell
resizing.
|
AxisItem<N> |
getMouseItem()
Returns the last item the mouse was over.
|
int |
getResizeOffset()
Returns the offset from the dividing line within which dragging changes the
width of the axis item.
|
Section<N> |
getSection(int sectionIndex)
Returns the section at the specified position in this axis.
|
int |
getSectionCount()
Returns the number of sections in the receiver.
|
int |
getViewportItemCount()
Returns number of items visible in the viewport.
|
int |
getViewportPosition(AxisItem<N> item)
Returns the position of the given item in the sequence of items visible in
the viewport or -1 if the viewport does not display the item.
|
int |
indexOf(Section<N> section)
Returns index of the given section in the list of this axis sections or -1
if the section does not belong to this axis.
|
boolean |
isFocusItemEnabled()
Returns
true if the focus item navigation is enabled in the
receiver. |
void |
pack()
Sets the optimal size of cells for all items in all sections.
|
void |
setAutoScrollOffset(int offset)
Sets the offset from the edge of scrolling area within which dragging
causes the content to scroll automatically and extend the dragged distance.
|
void |
setFocusItem(AxisItem<N> item)
Sets the focus marker to the given item.
|
void |
setFocusItem(Section<N> section,
N index)
Sets the focus marker to the given item.
|
void |
setFocusItemEnabled(boolean state)
Enables current item navigation in the receiver if the argument is
true , and disables it otherwise. |
void |
setFrozenHead(int amount)
Freezes the specified amount of items at the beginning this axis.
|
void |
setFrozenTail(int amount)
Freezes the specified amount of last items at the end of this axis.
|
void |
setMinimalCellWidth(int minimalCellWidth)
Sets the minimal cell width to be achieved by a user driven cell resizing.
|
void |
setResizeOffset(int offset)
Sets the offset from the dividing line within which dragging changes the
axis item width.
|
void |
showItem(AxisItem<N> item)
Scrolls to the given making it visible in the viewport.
|
void |
showItem(Section<N> section,
N index)
Scrolls to the given making it visible in the viewport.
|
java.lang.String |
toString() |
public Axis()
public Axis(java.lang.Class<N> numberClass, int sectionCount, int headerIndex, int bodyIndex)
numberClass
- sub-type of Number
class to index the sectionssectionCount
- number of sections to createjava.lang.IllegalArgumentException
- if numberClass
is other then int.class,
Integer.class, long.class, Long.class, BigInteger.classjava.lang.IllegalArgumentException
- if the sectionCount is lower then 2java.lang.IndexOutOfBoundsException
- if the headerIndex or bodyIndex is out of range (
index < 0 || index >= sectionCount)java.lang.IllegalArgumentException
- if the headerIndex equals bodyIndexpublic java.lang.String toString()
toString
in class java.lang.Object
public Section<N> getBody()
bodyIndex
argument in the Axis constructor.getHeader()
public Section<N> getHeader()
headerIndex
argument in the Axis constructor.getBody()
public Section<N> getSection(int sectionIndex)
sectionIndex
- index of the section to returnjava.lang.IndexOutOfBoundsException
- if sectionIndex is out of 0 ... getSectionCount()
-1
boundspublic int indexOf(Section<N> section)
section
- section to find the index ofpublic int getSectionCount()
public int getViewportItemCount()
public int getViewportPosition(AxisItem<N> item)
item
- the item to get position forjava.lang.IllegalArgumentException
- if item is null
or item's section does not belong to
this axis.java.lang.IndexOutOfBoundsException
- if item's index is out of 0 ... SectionCore.getCount()
-1
boundspublic AxisItem<N> getItemByViewportPosition(int position)
null
if the position is outside of the viewport bounds.position
- the position the get the item forpublic AxisItem<N> getItemByViewportDistance(int distance)
null
if the distance is outside of the
viewport bounds.position
- the position the get the item forpublic AxisItem<N> getItemByViewportOffset(AxisItem<N> item, int offset)
null
if the such an item is
outside of the viewport bounds.
If the offset
is positive the item to returned will be
computed in the forward direction. Otherwise item in the backward direction
will be returned.
item
- the item to set the focus foroffset
- number of items to move away from the referenced itemjava.lang.IllegalArgumentException
- if item is null
or item's section does not belong to
this axis.java.lang.IndexOutOfBoundsException
- if item's index is out of 0 ... SectionCore.getCount()
-1
boundspublic int[] getCellBound(AxisItem<N> item)
null
if the position is outside of the viewport scope. Cell
bound is an array of integers, where the first one is the distance from the
beginning of viewport and the second one is the cell width.position
- the position the line bound the item forpublic int[] getLineBound(AxisItem<N> item)
null
if the position is outside of the viewport scope. Line
bound is an array of integers, where the first one is the distance from the
beginning of viewport and the second one is the line width.position
- the position the line bound the item forpublic int compare(Section<N> section1, Section<N> section2)
section1
- a section to comparesection2
- another section to comparejava.lang.IllegalArgumentException
- if section1 or section2 is null
or does not belong
to this axis.public int compare(AxisItem<N> item1, AxisItem<N> item2)
item1
- one of the items to compareitem2
- another item to comparejava.lang.IllegalArgumentException
- if item1 or item2 is null
or item's section does not
belong to this axis.java.lang.IndexOutOfBoundsException
- if index of item1 or item2 is out of 0 ...
SectionCore.getCount()
-1 boundspublic boolean isFocusItemEnabled()
true
if the focus item navigation is enabled in the
receiver. Otherwise false
is returned.public void setFocusItemEnabled(boolean state)
true
, and disables it otherwise.
If the focus cell is disabled the navigation events are ignored and the
Painter.NAME_FOCUS_CELL
painter of the matrix is disabled.
state
- the new focus item enablement statepublic AxisItem<N> getFocusItem()
null
if no item has focus.public AxisItem<N> getMouseItem()
null
if there is
no such item.public void setFocusItem(AxisItem<N> item)
If section has the focus item disabled (see
SectionCore.setFocusItemEnabled(boolean)
) then this method does
nothing.
deprecated Use setFocusItem(Section, Number)
instead
item
- the item to set the focus forjava.lang.IllegalArgumentException
- if item is null
or item's section does not belong to
this axis.java.lang.IndexOutOfBoundsException
- if item's index is out of 0 ... SectionCore.getCount()
-1
boundspublic void setFocusItem(Section<N> section, N index)
If section has the focus item disabled (see
SectionCore.setFocusItemEnabled(boolean)
) then this method does
nothing.
section
- of the item to set the focus forindex
- of the item to set the focus forjava.lang.IllegalArgumentException
- if item is null
or item's section does not belong to
this axis.java.lang.IndexOutOfBoundsException
- if item's index is out of 0 ... SectionCore.getCount()
-1
boundspublic void showItem(AxisItem<N> item)
It works only when the matrix size has been set, which usually happens when the shell to which the matrix belongs gets open.
item
- the item to showjava.lang.IllegalArgumentException
- if item is null
or item's section does not belong to
this axis.java.lang.IndexOutOfBoundsException
- if item's index is out of 0 ... SectionCore.getCount()
-1
boundspublic void showItem(Section<N> section, N index)
It works only when the matrix size has been set, which usually happens when the shell to which the matrix belongs gets open.
section
- section of the item to showindex
- index of the item to showjava.lang.IllegalArgumentException
- if item is null
or item's section does not belong to
this axis.java.lang.IndexOutOfBoundsException
- if item's index is out of 0 ... SectionCore.getCount()
-1
boundspublic void setFrozenHead(int amount)
amount
- of items to freezejava.lang.IllegalArgumentException
- if the argument is lower then zeropublic int getFrozenHead()
public void setFrozenTail(int amount)
amount
- of items to freezejava.lang.IllegalArgumentException
- if the argument is lower then zeropublic int getFrozenTail()
public int getAutoScrollOffset()
public void setAutoScrollOffset(int offset)
offset
- maximum distance from the edge of the scrolling area in which
dragging will cause the content to scroll automaticallyjava.lang.IllegalArgumentException
- if the argument is lower then zeropublic int getResizeOffset()
public void setResizeOffset(int offset)
offset
- maximum distance from the edge of the line in which dragging will
cause cell width changejava.lang.IllegalArgumentException
- if the argument is lower then zeropublic int getMinimalCellWidth()
public void setMinimalCellWidth(int minimalCellWidth)
The default cell size of any section in this axis lower then minimal cell width is increased to then minimal cell width.
width
- new minimal width to setpublic void pack()
public pl.netanel.swt.matrix.NumberSetCore<N> createNumberSet()
Copyright © 2011 netanel.pl. All Rights Reserved.