pl.netanel.swt.matrix
Interface Section<N extends java.lang.Number>

Type Parameters:
N - specifies the indexing class for the receiver

public interface Section<N extends java.lang.Number>

Section represents a continuous segment of a matrix Axis, for example a header, body or footer. It contains a number of items indexed by the instances of a class specified by the <N extends Number> type parameter.

Item width consists of the line width and the cell width - the line precedes the cell. The last line index equals to getCount(). If the item is moved then both the cell and the preceding line are moved.

Item attributes include cell width, line width, moveable, resizable, hideable, hidden, selected. To optimize data storage of those attributes one value can be set for a range of items enclosed between the start and end items, for example setCellWidth(start, end, width). Also default values can be defined to save memory. If 1000000 items have the same width, then its a waste to store 1000000 ints with the same values. An example of such function: setDefaultCellWidth(width).

Section visibility and focus item can be enabled or disabled.


Method Summary
 void addControlListener(ControlListener listener)
          Adds the listener to the collection of listeners who will be notified when a section item is moved or resized, by sending it one of the messages defined in the ControlListener interface.
 void addFocusItemCallback(java.lang.Runnable callback)
          Adds the listener to the collection of callbacks who will be notified when a focus item is modified by the user.
 void addSelectionListener(SelectionListener listener)
          Adds the listener to the collection of listeners who will be notified when a section item is selected by the user, by sending it one of the messages defined in the SelectionListener interface.
 void adjust(N start, N count)
          Inserts or deletes items adjusting indexes of all the following items accordingly.
 int computeSize(N index)
          Computes the optimal cell width that fits its content.
 void delete(N start, N end)
          Deprecated. use adjust(Number, Number)
 Axis<N> getAxis()
          Returns the axis that this section belongs to.
 int getCellWidth(N index)
          Returns the cell width of the item with the given index in the model.
 java.util.Iterator<N> getChildren(N parent)
          Provisional tree API.
 N getChildrenCount(N parent)
          Provisional tree API.
 java.util.Iterator<Extent<N>> getChildrenExtents(N parent)
          Provisional tree API.
 NumberSet<N> getCollapsed()
          Returns the set of numbers representing indexes of items that are collapsed in the result of folding the nodes of hierarchy (tree or groups).
 N getCount()
          Returns the number of items in the receiver.
 int getDefaultCellWidth()
          Returns the default cell width of the receiver's items.
 NumberSet<N> getDefaultHiddenSet()
          Deprecated. 
 int getDefaultLineWidth()
          Returns the default line width of the receiver's items.
 NumberSet<N> getFiltered()
          Returns the set of numbers representing indexes of the items filtered out by the applicaiton logic.
 NumberSet<N> getFolded()
           
 NumberSet<N> getHidden()
          Returns the set of numbers representing indexes of the items hidden by the user invoking the "hide" action.
 N getHiddenCount()
          Deprecated. use getHidden().getCount()
 java.util.Iterator<Extent<N>> getHiddenExtents()
          Deprecated. use getHidden().seq()
 N getIndex(N position)
          Returns the item index at the given position in the layout.
 java.lang.Class<N> getIndexClass()
          Returns the Class<Number> instance that is used to index the section cells and lines.
 NumberCollection<N> getInvisible()
          Returns a union set hidden, collapsed and filtered indexes.
 N getLevelInTree(N index)
          Provisional tree API.
 int getLineWidth(N index)
          Returns the line width of the item with the given index in the model.
 NumberContinuum<N> getOrder()
          Returns set of number extents representing the order of the items.
 N getOrder(N index)
          Returns the order rank of the item with the given index in the model.
 java.util.Iterator<Extent<N>> getOrderExtents()
          Deprecated. use getOrder().seq()
 N getParent(N index)
          Provisional tree API.
 N getPosition(N index)
          Returns the position in the layout of the item with the given index in the model.
 NumberList<N> getSelected()
          Returns the set of numbers representing indexes of the selected items.
 N getSelectedCount()
          Returns the number of selected items in this section.
 java.util.Iterator<Extent<N>> getSelectedExtents()
          Deprecated. 
 Section<N> getUnchecked()
          Returns a better performing but less user friendly implementation for this section that is more loop efficient: does not check validity of the method arguments does not mark the layout as required computing on every method call, instead relying on the client to call Matrix.refresh() It may be useful for loop optimization, for example inside of Painter.paint(int, int, int, int) method.
 boolean hasChildren(N parent)
          Provisional tree API.
 void insert(N target, N count)
          Deprecated. use adjust(Number, Number)
 boolean isDefaultHideable()
          Returns true if the section items can be hidden by default.
 boolean isDefaultMoveable()
          Returns true if the section items can be moved by default.
 boolean isDefaultResizable()
          Returns true if the section items can be resized by default.
 boolean isEmpty()
          Returns true if the receiver contains no items.
 boolean isExpanded(N index)
          Provisional tree API.
 boolean isFocusItemEnabled()
          Returns true if the focus item navigation is enabled in the receiver.
 boolean isHidden(N index)
          Deprecated. use getHidden().contains...
 boolean isHideable(N index)
          Returns true if the item with the given index in the model can be hidden by end user.
 boolean isInvisible(N index)
          Deprecated. use seqInvisible().contains...
 boolean isMoveable(N index)
          Returns true if the item with the given index in the model can be moved by end user.
 boolean isMoveableTo(N index)
          Returns true if items can be moved to the given index in the model by end user.
 boolean isResizable(N index)
          Returns true if the item with the given index in the model can be resized by end user.
 boolean isSelected(N index)
          Returns true if the item with the given index in the model is selected.
 boolean isTreeEnabled()
          Returns true if tree is enabled or flase otherwise.
 boolean isVisible()
          Returns true if the receiver is visible.
 void removeControlListener(ControlListener listener)
          Removes the listener from the collection of listeners who will be notified a section item is moved or resized.
 void removeFocusCellCallback(java.lang.Runnable callback)
          Removes the callback from the collection of callbacks who will be called when the focus item is modified by the user.
 void removeSelectionListener(SelectionListener listener)
          Removes the listener from the collection of listeners who will be notified when a section item is selected by the user.
 ExtentSeq<N> seq()
          Experimental.
 ExtentSeq<N> seq(int direction, N from, N to)
          Experimental.
 ExtentSeq<N> seqInvisible()
          Deprecated. use getInvisible().seq()
 void setCellWidth()
          Sets the cell width that best fits its content for all items in this section.
 void setCellWidth(N index)
          Sets the optimal cell width that fits its content.
 void setCellWidth(N index, int width)
          Sets the cell width for item with the given index in the model.
 void setCellWidth(N start, N end, int width)
          Sets the cell width for a range of items.
 void setCount(N count)
          Specifies the number of section items.
 void setDefaultCellWidth(int width)
          Sets the default width of cells in this section to the given value.
 void setDefaultHideable(boolean hideable)
          Sets the default hide ability of the receiver's items to the given argument.
 void setDefaultLineWidth(int width)
          Sets default width of lines in this section to the given value.
 void setDefaultMoveable(boolean moveable)
          Sets the default move ability of the receiver's items to the given argument.
 void setDefaultResizable(boolean resizable)
          Sets the default resize ability of the receiver's items to the given argument.
 void setExpanded(N parent, boolean state)
          Provisional tree API.
 void setExpanded(N start, N end, boolean state)
          Provisional tree API.
 void setFocusItemEnabled(boolean enabled)
          Enables focus item navigation in the receiver if the argument is true, and disables it invisible otherwise.
 void setHidden(N index, boolean state)
          Deprecated. use getHidden().add(index), getHidden().remove(index) or getHidden().change(index, index, state)
 void setHidden(N start, N end, boolean state)
          Deprecated. use getHidden().add(start, end), getHidden().remove(start, end) or getHidden().change(start, end, state)
 void setHideable(N index, boolean enabled)
          Sets the hide ability for the item with the given index in the model.
 void setHideable(N start, N end, boolean enabled)
          Sets the hide ability for a range of items.
 void setLineWidth(N index, int width)
          Sets the line width for item with the given index in the model.
 void setLineWidth(N start, N end, int width)
          Sets the line width for a range of items.
 void setMoveable(N index, boolean enabled)
          Sets the move ability for the item with the given index in the model.
 void setMoveable(N start, N end, boolean enabled)
          Sets the move ability for a range of items.
 void setMoveableTo(N index, boolean enabled)
          Sets the move ability for the item with the given index in the model.
 void setMoveableTo(N start, N end, boolean enabled)
          Sets the ability for a range of indexes to serve as a target for drag moving of items.
 void setOrder(java.util.Iterator<N> iterator)
           
 void setOrder(N index, N target)
          Sets the order rank of the item with the given index in the model to the target index.
 void setOrder(N start, N end, N target)
          Sets the order rank of a range of items to start from the target index.
 void setOrderExtents(java.util.Iterator<Extent<N>> iterator)
           
 void setParent(N child, N parent)
          Provisional tree API.
 void setParent(N start, N end, N parent)
          Provisional tree API.
 void setResizable(N index, boolean enabled)
          Sets the resize ability for the item with the given index in the model.
 void setResizable(N start, N end, boolean enabled)
          Sets the resize ability for a range of items.
 void setSelected(boolean state)
          Sets the selection state for all the items.
 void setSelected(N index, boolean state)
          Sets the hiding state for the item with the given index in the model.
 void setSelected(N start, N end, boolean state)
          Sets the selection state for a range of items.
 void setTreeEnabled(boolean enable)
          Makes the painter to draw the hierarchy and causes moving to transfer the whole branch also allowing to move into the item making it a parent of the items being moved.
 void setVisible(boolean visible)
          Marks the receiver as visible if the argument is true, and marks it invisible otherwise.
 

Method Detail

getIndexClass

java.lang.Class<N> getIndexClass()
Returns the Class<Number> instance that is used to index the section cells and lines.

Returns:
the Class<Number> instance that is used to index the section cells and lines

getUnchecked

Section<N> getUnchecked()
Returns a better performing but less user friendly implementation for this section that is more loop efficient: It may be useful for loop optimization, for example inside of Painter.paint(int, int, int, int) method.

Returns:
a better performing but less user friendly implementation for this section

setCount

void setCount(N count)
Specifies the number of section items.

Parameters:
count - the new count of the receiver's items
Throws:
java.lang.NullPointerException - if the count is null or less then 0.
See Also:
getCount()

getCount

N getCount()
Returns the number of items in the receiver.

Returns:
the number of items in the receiver
See Also:
setCount(Number)

isEmpty

boolean isEmpty()
Returns true if the receiver contains no items. Otherwise false is returned.

Returns:
true if this contains contains no items

setVisible

void setVisible(boolean visible)
Marks the receiver as visible if the argument is true, and marks it invisible otherwise.

Parameters:
visible - the new visibility state

isVisible

boolean isVisible()
Returns true if the receiver is visible. Otherwise, false is returned.

Returns:
the receiver's visibility state

setFocusItemEnabled

void setFocusItemEnabled(boolean enabled)
Enables focus item navigation in the receiver if the argument is true, and disables it invisible otherwise.

Parameters:
enabled - the new focus item enablement state

isFocusItemEnabled

boolean isFocusItemEnabled()
Returns true if the focus item navigation is enabled in the receiver. Otherwise, false is returned.

Returns:
the receiver's focus item enablement state

setDefaultCellWidth

void setDefaultCellWidth(int width)
Sets the default width of cells in this section to the given value. Cell width excludes the width of lines. Negative argument values are ignored.

Default value allows to save storage memory of the width attribute if many cells share the same value and the newly created items to have the default value automatically.

If the width is lower then 0 then the method does nothing.

Parameters:
width - new value for default width.
Throws:
java.lang.IllegalArgumentException - if the width is lower then the minimal cell width of the axis

getDefaultCellWidth

int getDefaultCellWidth()
Returns the default cell width of the receiver's items. Cell width excludes the width of lines.

Returns:
default width of cells in this

setDefaultLineWidth

void setDefaultLineWidth(int width)
Sets default width of lines in this section to the given value. Negative argument values are ignored.

Default value allows to save storage memory of the width attribute if many lines share the same value and the newly created items to have the default value automatically.

If the width is lower then 0 then the method does nothing.

Parameters:
width - new value for default width.

getDefaultLineWidth

int getDefaultLineWidth()
Returns the default line width of the receiver's items.

Returns:
default width of lines in this

isDefaultResizable

boolean isDefaultResizable()
Returns true if the section items can be resized by default. Otherwise, false is returned.

Returns:
the default resizable ability state of the section items

setDefaultResizable

void setDefaultResizable(boolean resizable)
Sets the default resize ability of the receiver's items to the given argument.

Default value allows to save storage memory of the "resizable" attribute if many items share the same value and the newly created items to have this default value automatically.

Parameters:
resizable - the new resize ability state

isDefaultMoveable

boolean isDefaultMoveable()
Returns true if the section items can be moved by default. Otherwise, false is returned.

Returns:
the default move ability state of the section items

setDefaultMoveable

void setDefaultMoveable(boolean moveable)
Sets the default move ability of the receiver's items to the given argument.

Default value allows to save storage memory of the "moveable" attribute if many items share the same value and the newly created items to have this default value automatically.

Parameters:
moveable - the new move ability state

isDefaultHideable

boolean isDefaultHideable()
Returns true if the section items can be hidden by default. Otherwise, false is returned.

The default return value is false.

Returns:
the default hide ability state of the section items

setDefaultHideable

void setDefaultHideable(boolean hideable)
Sets the default hide ability of the receiver's items to the given argument.

Default value allows to save storage memory of the "hideable" attribute if many items share the same value and the newly created items to have this default value automatically.

Parameters:
hideable - the new hide ability state

setCellWidth

void setCellWidth(N start,
                  N end,
                  int width)
Sets the cell width for a range of items.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
width - the new cell width
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IllegalArgumentException - if start is greater then end
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
See Also:
setHideable(Number, Number, boolean)

setCellWidth

void setCellWidth(N index,
                  int width)
Sets the cell width for item with the given index in the model.

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.

If the width is lower then 0 then the method does nothing.

Cell width for a range of items should be set by setCellWidth(Number, Number, int) to achieve the best efficiency.

Parameters:
index - index of the item to set the cell width for
width - the new cell width
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
See Also:
setCellWidth(Number, Number, int)

setCellWidth

void setCellWidth(N index)
Sets the optimal cell width that fits its content.
Warning: for a large number of items it may take a long time to compute, because of the necessity to iterate over all items.

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.

Parameters:
index - index of the item to set the cell width for
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

computeSize

int computeSize(N index)
Computes the optimal cell width that fits its content.
Warning: for a large number of items it may take a long time to compute, because of the necessity to iterate over all items.

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.

Parameters:
index - index of the item to set the cell width for
Returns:
the optimal width
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

setCellWidth

void setCellWidth()
Sets the cell width that best fits its content for all items in this section.
Warning: for a large number of items it may take a long time to compute, because of the necessity to iterate over all items.

The width is calculated by Painter.computeSize(Number, Number, int, int) of the zones to which the section belongs.


getCellWidth

int getCellWidth(N index)
Returns the cell width of the item with the given index in the model. If the width has not been set at this index by setCellWidth(Number) method then the default cell width is returned.

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.

Parameters:
index - the item index
Returns:
the cell width at the given item index in the receiver
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

setLineWidth

void setLineWidth(N start,
                  N end,
                  int width)
Sets the line width for a range of items.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
width - the new line width
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount() bounds
java.lang.IllegalArgumentException - if start is greater then end

setLineWidth

void setLineWidth(N index,
                  int width)
Sets the line width for item with the given index in the model.

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.

If the width is lower then 0 then the method does nothing.

Cell width for a range of items should be set by setLineWidth(Number, Number, int) to achieve the best efficiency.

Parameters:
index - index of the item to set the line width for
width - the new line width
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount() bounds
See Also:
setLineWidth(Number, Number, int)

getLineWidth

int getLineWidth(N index)
Returns the line width of the item with the given index in the model. If the width has not been set at this index by one of the setLineWidth methods then the default line width is returned.

Line at index i is on the left side of the cell at index i. Last line to the right is at index equal to section item count. 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.

Parameters:
index - the item index
Returns:
the line width at the given item index in the receiver
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount() bounds

setMoveable

void setMoveable(N start,
                 N end,
                 boolean enabled)
Sets the move ability for a range of items. An item that is moveable can be reordered by the user by dragging the header. An item that is not moveable cannot be dragged by the user but may be reordered by the programmer.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
enabled - the new move ability state
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

setMoveable

void setMoveable(N index,
                 boolean enabled)
Sets the move ability for the item with the given index in the model.

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.

Ranges of items should be set moveable by setMoveable(Number, Number, boolean) to achieve the best efficiency.

Parameters:
index - index of the item to move
enabled - the new move ability state
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
See Also:
setMoveable(Number, Number, boolean)

isMoveable

boolean isMoveable(N index)
Returns true if the item with the given index in the model can be moved by end user. Otherwise, false is returned. An item that is moveable can be reordered by the user by dragging the header. An item that is not moveable cannot be dragged by the user but may be reordered by the programmer.

If the move ability has not been set at this index by setMoveable method then the default cell width is returned.

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.

Parameters:
index - the item index
Returns:
the move ability state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

setMoveableTo

void setMoveableTo(N start,
                   N end,
                   boolean enabled)
Sets the ability for a range of indexes to serve as a target for drag moving of items.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
enabled - the new move ability state
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

setMoveableTo

void setMoveableTo(N index,
                   boolean enabled)
Sets the move ability for the item with the given index in the model.

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.

Ranges of items should be set moveable by setMoveable(Number, Number, boolean) to achieve the best efficiency.

Parameters:
index - index of the item to move
enabled - the new move ability state
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
See Also:
setMoveable(Number, Number, boolean)

isMoveableTo

boolean isMoveableTo(N index)
Returns true if items can be moved to the given index in the model by end user. Otherwise, false is returned. An item that is moveable can be reordered by the user by dragging the header. An item that is not moveable cannot be dragged by the user but may be reordered by the programmer.

If the move ability has not been set at this index by setMoveable method then the default cell width is returned.

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.

Parameters:
index - the item index
Returns:
the move to ability state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

setResizable

void setResizable(N start,
                  N end,
                  boolean enabled)
Sets the resize ability for a range of items. An item that is resizable can be resized by the user dragging the edge of the header. An item that is not resizable cannot be dragged by the user but may be resized by the programmer.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
enabled - the new resize ability state
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

setResizable

void setResizable(N index,
                  boolean enabled)
Sets the resize ability for the item with the given index in the model.

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.

Ranges of items should be set resizable by setResizable(Number, Number, boolean) to achieve the best efficiency.

Parameters:
index - index of the item to resize
enabled - the new resize ability state
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
See Also:
setResizable(Number, Number, boolean)

isResizable

boolean isResizable(N index)
Returns true if the item with the given index in the model can be resized by end user. Otherwise, false is returned. An item that is resizable can be resized by the user dragging the edge of the header. An item that is not resizable cannot be dragged by the user but may be resized by the programmer.

Returns the stored item resize ability at the given index or the default item resize ability if it has not been set at this 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.

Parameters:
index - the item index
Returns:
the move ability state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

setHideable

void setHideable(N start,
                 N end,
                 boolean enabled)
Sets the hide ability for a range of items. An item that is hideable can be hidden by the user gesture bound to the hide command. An item that is not hideable cannot be hidden by the user but may be hidden by the programmer.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
enabled - the new hide ability state
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

setHideable

void setHideable(N index,
                 boolean enabled)
Sets the hide ability for the item with the given index in the model.

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.

Ranges of items should be set hideable by setHideable(Number, Number, boolean) to achieve the best efficiency.

Parameters:
index - index of the item to hide
enabled - the new hide ability state
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
See Also:
setHideable(Number, Number, boolean)

isHideable

boolean isHideable(N index)
Returns true if the item with the given index in the model can be hidden by end user. Otherwise, false is returned. An item that is hideable can be hidden by the user gesture bound to the hide command. An item that is not hideable cannot be hidden by the user but may be hidden by the programmer.

Returns the stored item hide ability at the given index or the default item hide ability if it has not been set at this 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.

Returns:
the hide ability state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

setHidden

@Deprecated
void setHidden(N start,
                          N end,
                          boolean state)
Deprecated. use getHidden().add(start, end), getHidden().remove(start, end) or getHidden().change(start, end, state)

Sets the hiding state for a range of items.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
state - the new hiding state
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

setHidden

@Deprecated
void setHidden(N index,
                          boolean state)
Deprecated. use getHidden().add(index), getHidden().remove(index) or getHidden().change(index, index, state)

Sets the hiding state for the item with the given index in the model.

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.

Ranges of items should be set hidden by setHidden(Number, Number, boolean) to achieve the best efficiency.

Parameters:
index - index of the item to hide
state - the new hiding state
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

getFolded

NumberSet<N> getFolded()

getHidden

NumberSet<N> getHidden()
Returns the set of numbers representing indexes of the items hidden by the user invoking the "hide" action.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the set of indexes of the hidden items

getFiltered

NumberSet<N> getFiltered()
Returns the set of numbers representing indexes of the items filtered out by the applicaiton logic.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the set of indexes of the hidden items
See Also:
#getHidden()}

getCollapsed

NumberSet<N> getCollapsed()
Returns the set of numbers representing indexes of items that are collapsed in the result of folding the nodes of hierarchy (tree or groups). When a node's folding state changes to true then all the items from its hierarchy branch get collapsed, i.e. not visible.

Returns:
the set of indexes of the hidden items

getInvisible

NumberCollection<N> getInvisible()
Returns a union set hidden, collapsed and filtered indexes.

Returns:
the set of indexes that are either hidden, collapsed or filtered

getHiddenCount

@Deprecated
N getHiddenCount()
Deprecated. use getHidden().getCount()

Returns the number of hidden items.

Returns:
the number of hidden items

isHidden

@Deprecated
boolean isHidden(N index)
Deprecated. use getHidden().contains...

Returns true if the item with the given index in the model is hidden. Otherwise, false is returned.

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.

Parameters:
index - the item index
Returns:
the hiding state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

getHiddenExtents

@Deprecated
java.util.Iterator<Extent<N>> getHiddenExtents()
Deprecated. use getHidden().seq()

Returns iterator for extents of the hidden items.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the iterator for extents of the hidden items

isInvisible

@Deprecated
boolean isInvisible(N index)
Deprecated. use seqInvisible().contains...

Returns true if the item with the given index in the model is hidden. Otherwise, false is returned.

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.

Parameters:
index - the item index
Returns:
the hiding state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

seqInvisible

@Deprecated
ExtentSeq<N> seqInvisible()
Deprecated. use getInvisible().seq()

Returns the sequence of indexes of invisible items that is sum of items hidden by the user, filtered by the applicaiton logic and the collapsed ones.

Returns:
the sequence of indexes of invisible items

setSelected

void setSelected(N start,
                 N end,
                 boolean state)
Sets the selection state for a range of items.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
state - the new selection state
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

setSelected

void setSelected(N index,
                 boolean state)
Sets the hiding state for the item with the given index in the model.

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.

Ranges of items should be set selected by setSelected(Number, Number, boolean) to achieve the best efficiency.

Parameters:
index - index of the item to hide
state - the new hiding state
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
See Also:
setSelected(Number, Number, boolean)

setSelected

void setSelected(boolean state)
Sets the selection state for all the items.

Parameters:
state - the new selection state

isSelected

boolean isSelected(N index)
Returns true if the item with the given index in the model is selected. Otherwise, false is returned.

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.

Parameters:
index - the item index
Returns:
the selection state at the given index
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

getSelectedCount

N getSelectedCount()
Returns the number of selected items in this section.

Returns:
the number of selected items in this section

getSelected

NumberList<N> getSelected()
Returns the set of numbers representing indexes of the selected items.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the set of indexes of the selected items

getSelectedExtents

@Deprecated
java.util.Iterator<Extent<N>> getSelectedExtents()
Deprecated. 

Returns iterator for extents of the selected items.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the iterator for extents of the selected items

setOrder

void setOrder(N start,
              N end,
              N target)
Sets the order rank of a range of items to start from the target index. For example having 5 items in the section setOrder(2, 3, 1) will result in the following order: 0, 2, 3, 1, 4.

start, end and target numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
target - the index of the target item
Throws:
java.lang.IllegalArgumentException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IndexOutOfBoundsException - if target is out of 0 ... getCount() bounds
java.lang.IllegalArgumentException - if start is greater then end

setOrder

void setOrder(N index,
              N target)
Sets the order rank of the item with the given index in the model to the target 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.

Ranges of items should be set moved by one of the setOrder methods. to achieve the best efficiency.

Parameters:
index - index of the item to move
target - the index of the target item
Throws:
java.lang.IllegalArgumentException - if index or target is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds
java.lang.IndexOutOfBoundsException - if target is out of 0 ... getCount() bounds
See Also:
setOrder(Number, Number, Number)

setOrder

void setOrder(java.util.Iterator<N> iterator)

setOrderExtents

void setOrderExtents(java.util.Iterator<Extent<N>> iterator)

getOrder

N getOrder(N index)
Returns the order rank of the item with the given index in the model. It is calculated according to the current order including the hidden items. If the index is null or out of scope then the method returns null.

Parameters:
index - to get the position for
Returns:
order index of the item with the given index in the model
Throws:
java.lang.IllegalArgumentException - if index is null
java.lang.IndexOutOfBoundsException - if index is out of 0 ... getCount()-1 bounds

getOrder

NumberContinuum<N> getOrder()
Returns set of number extents representing the order of the items.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the iterator for indexes of the selected items

getOrderExtents

@Deprecated
java.util.Iterator<Extent<N>> getOrderExtents()
Deprecated. use getOrder().seq()

Returns iterator for extents of the order ranks of the items.

Number that is returned by Iterator.next() method is the index of the item in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Returns:
the iterator for extents of the selected items

getIndex

N getIndex(N position)
Returns the item index at the given position in the layout. The position is according to the current order excluding the hidden items.

If the index is out of range null value is returned.

Parameters:
position - visual index of given item
Returns:
item at the given position
Throws:
java.lang.IllegalArgumentException - if position is null
java.lang.IndexOutOfBoundsException - if position is out of 0 ... getCount()-1 bounds
See Also:
getOrder(Number)

getPosition

N getPosition(N index)
Returns the position in the layout of the item with the given index in the model. The position is according to the current order excluding the hidden items.

If the index is out of range null value is returned.

Parameters:
index - index of the given item
Returns:
item at the given position
Throws:
java.lang.IllegalArgumentException - if position is null
java.lang.IndexOutOfBoundsException - if position is out of 0 ... getCount()-1 bounds
See Also:
getOrder(Number)

delete

@Deprecated
void delete(N start,
                       N end)
Deprecated. use adjust(Number, Number)

Removes a range of items decreasing the indexes of the following items by the number of removed items.

It changes the state of cell width, line width, resizable, movable, hideable, hidden, order, selection.

start and end numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - first index of the range of items
end - last index of the range of items
Throws:
java.lang.IndexOutOfBoundsException - if start or end is null
java.lang.IndexOutOfBoundsException - if start or end is out of 0 ... getCount()-1 bounds
java.lang.IllegalArgumentException - if start is greater then end

insert

@Deprecated
void insert(N target,
                       N count)
Deprecated. use adjust(Number, Number)

Inserts items before the given target item increasing the indexes of the following items by the number of inserted items.

Items are inserted before the given target index or at the end if the target equals to the receiver item count.

It changes the state of cell width, line width, resizable, movable, hideable, hidden, order, selection.

target, count numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
target - the index before which items are inserted
count - the number of items to insert
Throws:
java.lang.IndexOutOfBoundsException - if target or count is null
java.lang.IndexOutOfBoundsException - if target is out of 0 ... getCount() bounds
java.lang.IllegalArgumentException - if start is greater then end

adjust

void adjust(N start,
            N count)
Inserts or deletes items adjusting indexes of all the following items accordingly. If the count is greater than zero then this method inserts items before the given target item or at the end if the target equals to the receiver item count increasing the indexes of the following items by the number of inserted items. If the count is lower than zero then this method removes a range of items decreasing the indexes of the following items by the number of removed items.

It affect item indexes in cell width, line width, resizable, movable, hideable, hidden, order, selection, invisible, folded and collapsed collections.

start, count numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
start - the index before which items are inserted
count - the number of items to insert
Throws:
java.lang.IndexOutOfBoundsException - if target or count is null
java.lang.IndexOutOfBoundsException - if target is out of 0 ... getCount() bounds
java.lang.IllegalArgumentException - if start is greater then end

addControlListener

void addControlListener(ControlListener listener)
Adds the listener to the collection of listeners who will be notified when a section item is moved or resized, by sending it one of the messages defined in the ControlListener interface.

The data property of the ControlEvent contains the item being resized or the target item for the moved items. In order to get moved items or a set of resized items (if more then one is resized) getSelected() can be utilized.

Parameters:
listener - the listener which should be notified
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
ControlListener, removeControlListener(ControlListener)

addSelectionListener

void addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when a section item is selected by the user, by sending it one of the messages defined in the SelectionListener interface.

The selection event is not emitted by the axis API methods that are responsible for selection and deselection of items. It can only be triggered by another SWT event bound to the selection command.

widgetSelected is called when the axis item is selected widgetDefaultSelected is not called.

Parameters:
listener - the listener which should be notified when the axis item is selected by the user
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
SelectionListener, SelectionEvent, removeSelectionListener(SelectionListener)

setTreeEnabled

void setTreeEnabled(boolean enable)
Makes the painter to draw the hierarchy and causes moving to transfer the whole branch also allowing to move into the item making it a parent of the items being moved.

Parameters:
enable - the new focus item enablement state

isTreeEnabled

boolean isTreeEnabled()
Returns true if tree is enabled or flase otherwise.

Returns:
true if tree is enabled or flase otherwise.
See Also:
setTreeEnabled(boolean)

addFocusItemCallback

void addFocusItemCallback(java.lang.Runnable callback)
Adds the listener to the collection of callbacks who will be notified when a focus item is modified by the user.

Parameters:
callback - the callback which should be notified when the focus item is changed by the user
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the callback is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
removeFocusCellCallback(java.lang.Runnable)

removeFocusCellCallback

void removeFocusCellCallback(java.lang.Runnable callback)
Removes the callback from the collection of callbacks who will be called when the focus item is modified by the user.

Parameters:
callback - the callback which should no longer be notified
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the callback is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
addFocusItemCallback(java.lang.Runnable)

removeControlListener

void removeControlListener(ControlListener listener)
Removes the listener from the collection of listeners who will be notified a section item is moved or resized.

Parameters:
listener - the listener which should no longer be notified
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
ControlListener, addControlListener(ControlListener)

removeSelectionListener

void removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when a section item is selected by the user.

Parameters:
listener - the listener which should no longer be notified
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
SelectionListener, addSelectionListener(SelectionListener)

isExpanded

boolean isExpanded(N index)
Provisional tree API.


setExpanded

void setExpanded(N start,
                 N end,
                 boolean state)
Provisional tree API.


setExpanded

void setExpanded(N parent,
                 boolean state)
Provisional tree API.


getLevelInTree

N getLevelInTree(N index)
Provisional tree API.


getParent

N getParent(N index)
Provisional tree API.


getChildrenCount

N getChildrenCount(N parent)
Provisional tree API.


getChildren

java.util.Iterator<N> getChildren(N parent)
Provisional tree API.


getChildrenExtents

java.util.Iterator<Extent<N>> getChildrenExtents(N parent)
Provisional tree API.


setParent

void setParent(N start,
               N end,
               N parent)
Provisional tree API.


setParent

void setParent(N child,
               N parent)
Provisional tree API.


hasChildren

boolean hasChildren(N parent)
Provisional tree API.


getAxis

Axis<N> getAxis()
Returns the axis that this section belongs to.

Returns:
the axis that this section belongs to

seq

ExtentSeq<N> seq()
Experimental. Iterates over visible items according to section order of items skipping the invisible items. The output = order - invisible = order - hidden - collapsed - filtered.


seq

ExtentSeq<N> seq(int direction,
                 N from,
                 N to)
Experimental. Iterates over visible items according to section order of items. The output = order - invisible = order - hidden - collapsed - filtered.


getDefaultHiddenSet

@Deprecated
NumberSet<N> getDefaultHiddenSet()
Deprecated. 



Copyright © 2011 netanel.pl. All Rights Reserved.