|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.netanel.swt.matrix.Axis<N>
N
- specifies the indexing class for the receiverpublic class Axis<N extends java.lang.Number>
Axis represents a horizontal or vertical axis of a matrix. It is divided into sections.
Section
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
int |
computeSize(Section<N> section,
N index)
Computes the optimal cell width that fits its content. |
pl.netanel.swt.matrix.NumberSetCore<N> |
createNumberSet()
Deprecated. |
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. |
int |
getContentWidth()
Returns the content bound including all the visible cells and lines. |
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 a visible item that is away from the given item by the number of items specified by the offset argument or null if such an item is outside of the viewport bounds
or does not exist. |
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. |
AxisItem<N> |
getScrollItem()
|
N |
getScrollPosition()
|
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. |
boolean |
isItemInViewport(Section<N> section,
N index)
Returns true if the given item is visible in the viewport,
or false otherwise. |
void |
pack()
Sets the optimal size of cells for all items in all sections. |
void |
scrollTo(AxisItem<N> item)
Scrolls the axis to the position where the given item is the first visible one in the unfrozen area. |
void |
scrollTo(N index)
Scrolls the unfrozen area of the axis to the given index in the sequence of visible axis items. |
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 width)
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 create
java.lang.IllegalArgumentException
- if numberClass
is other then
int.class, Integer.class, long.class, Long.class,
BigInteger.class
java.lang.IllegalArgumentException
- if the sectionCount is lower then 2
java.lang.IndexOutOfBoundsException
- if the headerIndex or bodyIndex is out of
range ( index < 0 || index >= sectionCount)
java.lang.IllegalArgumentException
- if the headerIndex equals bodyIndexMethod Detail |
---|
public 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 return
java.lang.IndexOutOfBoundsException
- if sectionIndex is out of 0 ...
getSectionCount()
-1 boundspublic int indexOf(Section<N> section)
section
- section to find the index of
public int getSectionCount()
public int getViewportItemCount()
public int getViewportPosition(AxisItem<N> item)
item
- the item to get position for
java.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 for
public AxisItem<N> getItemByViewportDistance(int distance)
null
if the distance is outside of the
viewport bounds.
distance
- the position the get the item for
public AxisItem<N> getItemByViewportOffset(AxisItem<N> item, int offset)
offset
argument or null
if such an item is outside of the viewport bounds
or does not exist.
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 item
java.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 boolean isItemInViewport(Section<N> section, N index)
true
if the given item is visible in the viewport,
or false
otherwise.
section
- of the item to checkindex
- of the item to check
true
if the given item is visible in the viewport
java.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.
item
- the item to get the cell bound for
public 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.
item
- the line to get the line bound for
public int getContentWidth()
public int compare(Section<N> section1, Section<N> section2)
section1
- a section to comparesection2
- another section to compare
java.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 compare
java.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)
SectionCore.setFocusItemEnabled(boolean)
) then this method does
nothing.
deprecated Use setFocusItem(Section, Number)
instead
item
- the item to set the focus for
java.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)
SectionCore.setFocusItemEnabled(boolean)
) then this method does
nothing.
section
- of the item to set the focus forindex
- of the item to set the focus for
java.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)
item
- the item to show
java.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 scrollTo(AxisItem<N> item)
item
- item to scroll topublic void scrollTo(N index)
index
- index in the sequence of visible axis itemspublic void showItem(Section<N> section, N index)
section
- section of the item to showindex
- index of the item to show
java.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 freeze
java.lang.IllegalArgumentException
- if the argument is lower then zeropublic int getFrozenHead()
public void setFrozenTail(int amount)
amount
- of items to freeze
java.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 automatically
java.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 change
java.lang.IllegalArgumentException
- if the argument is lower then zeropublic int getMinimalCellWidth()
public void setMinimalCellWidth(int width)
width
- new minimal width to setpublic void pack()
public int computeSize(Section<N> section, N index)
index
is the item index in the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
The width is calculated by Painter.computeSize(Number, Number, int, int)
of the zones to which the section belongs.
index
- index of the item to set the cell width for
java.lang.IllegalArgumentException
- if index is null
java.lang.IndexOutOfBoundsException
- if index is out of 0 ...
Section.getCount()
-1 bounds@Deprecated public pl.netanel.swt.matrix.NumberSetCore<N> createNumberSet()
public AxisItem<N> getScrollItem()
public N getScrollPosition()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |