|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
X
- indexing type for horizontal axisY
- indexing type for vertical axispublic interface Zone<X extends java.lang.Number,Y extends java.lang.Number>
Constitutes a region of a matrix where a section from the vertical axis and a section from the horizontal axis intersect with each other.
Zone has painters to paint itself on the screen and listeners to respond to user gestures towards it.
Section
Method Summary | |
---|---|
void |
addListener(int eventType,
Listener listener)
Adds the listener to the collection of listeners who will be notified when an event of the given type occurs. |
void |
addPainter(int index,
Painter<X,Y> painter)
Inserts the painter at the given index of the receiver's painters list. |
void |
addPainter(Painter<X,Y> painter)
Adds the painter at the end of the receiver's painters list. |
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when a zone cell is selected by the user, by sending it one of the messages defined in the SelectionListener
interface. |
void |
bind(int commandId,
int eventType,
int code)
Binds the command to the user gesture specified by the event type and code. |
void |
bind(int commandId,
int eventType,
int code,
int condition)
Binds the command to the user gesture specified by the event type, code and an additional condition. |
Point |
computeSize(X indexX,
Y indexY,
int wHint,
int hHint)
Returns the preferred size of the cell. |
boolean |
contains(CellExtent<X,Y> cellExtent,
X indexX,
Y indexY)
|
boolean |
containsLocation(int x,
int y)
Return true if the given matrix related coordinates are locatad within bounds of this zone,
otherwise return false . |
Rectangle |
getBounds(Frozen frozenX,
Frozen frozenY)
Returns the rectangular boundaries of this zone in the specified freezing area. |
Rectangle |
getCellBounds(X indexX,
Y indexY)
Return rectangular bounds of the cell with the given coordinates. |
Matrix<X,Y> |
getMatrix()
Returns the matrix to which the zone belongs. |
CellExtent<X,Y> |
getMerged(X indexX,
Y indexY)
Returns the merge scope of the given cell, where the CellExtent.getEndX()
is the count of items in the horizontal direction and CellExtent.getEndY()
is the count of items in the vertical direction. |
Cell<X,Y> |
getMergeLimit()
Returns the maximum number of cells that can merged on both horizontal and vertical axis. |
Painter<X,Y> |
getPainter(int index)
Returns the painter at the specified position in the receiver's list of painters. |
Painter<X,Y> |
getPainter(java.lang.String name)
Returns a painter with the specified name, or null
if the painters list does not contain such painter. |
int |
getPainterCount()
Returns the number of the receiver's painters. |
Section<X> |
getSectionX()
Returns the zone section horizontal axis. |
Section<Y> |
getSectionY()
Returns the zone section at vertical axis. |
java.math.BigInteger |
getSelectedCount()
Returns the number of selected cells in this zone. |
CellExtent<X,Y> |
getSelectedExtent()
Returns selection index bounds. |
java.util.Iterator<CellExtent<X,Y>> |
getSelectedExtentIterator()
Returns iterator for selected cell extents. |
java.util.Iterator<Cell<X,Y>> |
getSelectedIterator()
Returns iterator for selected cells. |
java.math.BigInteger |
getSelectionCount()
Deprecated. use getSelectedCount() instead |
Zone<X,Y> |
getUnchecked()
Returns a no argument checking implementation for this zone. |
int |
indexOfPainter(java.lang.String name)
Returns the index of a painter with the specified name in the list of the receiver's painters, or -1 if this list does not contain the element. |
boolean |
isMerged(X indexX,
X countX,
Y indexY,
Y countY)
Returns true if any cell in the given range is merged. |
boolean |
isMerged(X indexX,
Y indexY)
Returns true if the cell at given indexes is merged. |
boolean |
isSelected(X indexX,
Y indexY)
Returns true if the cell at given indexes is selected. |
boolean |
isSelectionEnabled()
Returns true if selection is enabled, false otherwise. |
void |
removeListener(int eventType,
Listener listener)
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. |
Painter<X,Y> |
removePainter(int index)
Removes the element at the specified position in the list of painters. |
boolean |
removePainter(Painter<X,Y> painter)
Removes the specified element from this list, if it is present (optional operation). |
boolean |
removePainter(java.lang.String name)
Removes a painter with the specified name from this list, if it is present (optional operation). |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when a zone cell is selected by the user. |
void |
replacePainter(Painter<X,Y> painter)
Replaces the painter at the index of painter with the same name. |
void |
replacePainterPreserveStyle(Painter<X,Y> painter)
Replaces the painter at the index of painter with the same name. |
void |
setMerged(java.lang.Iterable<CellExtent<X,Y>> iterable)
Bulk merging. |
boolean |
setMerged(X indexX,
X countX,
Y indexY,
Y countY,
boolean state)
Sets the merging state for the range of cells. |
void |
setMergeLimit(X limitX,
Y limitY)
Sets the maximum number of cells that can merged on both horizontal and vertical axis. |
void |
setPainter(int index,
Painter<X,Y> painter)
Replaces the painter at the given index of the receiver's painters list. |
void |
setSelected(X startX,
X endX,
Y startY,
Y endY,
boolean state)
Sets the selection state for the range of cells. |
void |
setSelected(X indexX,
Y indexY,
boolean state)
Sets the selection state for the specified cell. |
void |
setSelectedAll(boolean state)
Sets the selection state for all the cells in this zone. |
void |
setSelectionEnabled(boolean enabled)
Enables cell selection if the argument is true ,
or disables it otherwise. |
void |
unbind(int commandId,
int eventType,
int code)
Removes the binding the command to the user gesture specified by the event type and code. |
void |
unbind(int commandId,
int eventType,
int code,
int condition)
Removes the binding the command to the user gesture specified by the event type and code. |
Method Detail |
---|
Zone<X,Y> getUnchecked()
Painter.paint(int, int, int, int)
method.
Section<X> getSectionX()
Section<Y> getSectionY()
Rectangle getCellBounds(X indexX, Y indexY)
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axis
java.lang.IllegalArgumentException
- if indexX
or
indexY
is null.
java.lang.IndexOutOfBoundsException
- if indexY
is out of
0 ... this.getSectionX().getCount() bounds
java.lang.IndexOutOfBoundsException
- if indexX
is out of
0 ... this.getSectionY().getCount() boundsRectangle getBounds(Frozen frozenX, Frozen frozenY)
frozenX
- frozen area on horizontal axisfrozenY
- frozen area on vertical axis
Point computeSize(X indexX, Y indexY, int wHint, int hHint)
Painter.computeSize(Number, Number, int, int)
of all painters of
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axiswHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)
boolean isSelectionEnabled()
true
if selection is enabled, false otherwise.
void setSelectionEnabled(boolean enabled)
true
,
or disables it otherwise.
enabled
- the new selection ability state.boolean isSelected(X indexX, Y indexY)
true
if the cell at given indexes is selected.
Otherwise, false
is returned.
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
If one the parameters is null
then the method returns
true
if any cell with the other index is selected
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axis
java.lang.IllegalArgumentException
- only if both indexX
and
indexY
are null.
java.lang.IndexOutOfBoundsException
- if indexX
is out of
0 ... this.getSectionY().getCount() bounds
java.lang.IndexOutOfBoundsException
- if indexY
is out of
0 ... this.getSectionX().getCount() boundsvoid setSelected(X startX, X endX, Y startY, Y endY, boolean state)
startX
,endX
, startY
and
endY
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.
startX
- first index of the range of column itemsendX
- last index of the range of column itemsstartY
- first index of the range of row itemsendY
- last index of the range of row itemsstate
- the new selection state
java.lang.IllegalArgumentException
- if startX
or endX
or startY
or endY
is null.
java.lang.IllegalArgumentException
- if startX
is greater then endX
or startY
is greater then endY
.
java.lang.IndexOutOfBoundsException
- if startX
or
endX
is out of 0 ... this.getSectionX().getCount()
bounds
java.lang.IndexOutOfBoundsException
- if startY
or
endY
is out of 0 ... this.getSectionY().getCount()
boundsboolean setMerged(X indexX, X countX, Y indexY, Y countY, boolean state)
indexX
and indexY
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.
indexX
- index of the column item from which the merging startscountX
- quantity of column items being mergedindexY
- index of the row item from which the merging startscountY
- quantity of row items being mergedstate
- the new merging state
java.lang.IllegalArgumentException
- if indexX
or countX
or indexY
or countY
is null.
java.lang.IndexOutOfBoundsException
- if indexX
or
countX
is out of 0 ... this.getSectionX().getCount()
bounds
java.lang.IndexOutOfBoundsException
- if indexY
or
countY
is out of 0 ... this.getSectionY().getCount()
boundsvoid setMerged(java.lang.Iterable<CellExtent<X,Y>> iterable)
iterable
- returns iterator over CellExtent type of items where
getStartX
contains the start index of the merged fragment on the X axis
getEndX
contains the count of merged cells on the X axis
getStartY
contains the start index of the merged fragment on the Y axis
getEndY
contains the count of merged cells on the Y axisCellExtent<X,Y> getMerged(X indexX, Y indexY)
CellExtent.getEndX()
is the count of items in the horizontal direction and CellExtent.getEndY()
is the count of items in the vertical direction.
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axis
boolean isMerged(X indexX, Y indexY)
true
if the cell at given indexes is merged.
Otherwise, false
is returned.
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axis
java.lang.IllegalArgumentException
- if indexX
or countX
or indexY
or countY
is null.
java.lang.IndexOutOfBoundsException
- if indexX
or
countX
is out of 0 ... this.getSectionX().getCount()
bounds
java.lang.IndexOutOfBoundsException
- if indexY
or
countY
is out of 0 ... this.getSectionY().getCount()
boundsboolean isMerged(X indexX, X countX, Y indexY, Y countY)
true
if any cell in the given range is merged.
Otherwise, false
is returned.
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
indexX
- index of the column item from which the merging startscountX
- quantity of column items being mergedindexY
- index of the row item from which the merging startscountY
- quantity of row items being merged
true
if any cell in the given range is merged.
java.lang.IndexOutOfBoundsException
- if startX
or
endX
is out of 0 ... this.getSectionX().getCount()
bounds
java.lang.IndexOutOfBoundsException
- if startY
or
endY
is out of 0 ... this.getSectionY().getCount()
boundsCell<X,Y> getMergeLimit()
void setMergeLimit(X limitX, Y limitY)
limitX
- maximum number of cells that can be merged on horizontal axislimitY
- maximum number of cells that can be merged on vertical axisvoid setSelected(X indexX, Y indexY, boolean state)
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
Ranges of cells should be set selected by
setSelected(Number, Number, Number, Number, boolean)
to achieve the best efficiency.
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axis
java.lang.IllegalArgumentException
- if indexX
or
indexY
is null.
java.lang.IndexOutOfBoundsException
- if indexX
is out of
0 ... this.getSectionY().getCount() bounds
java.lang.IndexOutOfBoundsException
- if indexY
is out of
0 ... this.getSectionX().getCount() boundsvoid setSelectedAll(boolean state)
state
- the new selection statejava.math.BigInteger getSelectedCount()
@Deprecated java.math.BigInteger getSelectionCount()
getSelectedCount()
instead
BigInteger
with zero value.
BigInteger
with the count of selected cellsjava.util.Iterator<Cell<X,Y>> getSelectedIterator()
Iterator.next()
method is a
vertical axis index, the second one is a horizontal axis index.
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
Warning iterating index by index over large extents
may cause a performance problem.
java.util.Iterator<CellExtent<X,Y>> getSelectedExtentIterator()
Iterator.next()
method define start and end of a
vertical axis extent, the second two the start and end of a horizontal axis extent.
indexX
and indexY
refer to the model,
not the visual position of the item on the screen
which can be altered by move and hide operations.
CellExtent<X,Y> getSelectedExtent()
null if nothing is selected.
For example: if only two cells (0,0) and (2,1) are selected with Ctrl+Click than this method
will return range of six cells (0-2, 0-1).
- Returns:
- selection index bounds
void bind(int commandId, int eventType, int code)
commandId
- identifier of a command from MatrixeventType
- event type from SWT classcode
- || combination of keyCode, button and stateMask, alternatively it can equal to Matrix.PRINTABLE_CHARS
in order to be triggered by typingunbind(int, int, int)
void bind(int commandId, int eventType, int code, int condition)
Matrix.GESTURE_ON_SELECTED
and Matrix.GESTURE_ON_RESIZE_AREA
commandId
- identifier of a command from MatrixeventType
- event type from SWT classcode
- || combination of keyCode, button and stateMask, alternatively it can equal to Matrix.PRINTABLE_CHARS
in order to be triggered by typingcondition
- || combination of gesture conditions Matrix.GESTURE_ON_SELECTED
and Matrix.GESTURE_ON_RESIZE_AREA
unbind(int, int, int)
void unbind(int commandId, int eventType, int code)
commandId
- identifier of a command from MatrixeventType
- event type from SWT classcode
- || combination of keyCode, button and stateMaskbind(int, int, int)
void unbind(int commandId, int eventType, int code, int condition)
commandId
- identifier of a command from MatrixeventType
- event type from SWT classcode
- || combination of keyCode, button and stateMaskcondition
- || combination of gesture conditions Matrix.GESTURE_ON_SELECTED
and Matrix.GESTURE_ON_RESIZE_AREA
bind(int, int, int)
void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
The selection event is not emitted by the zone 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.
listener
- the listener which should be notified when the cells are
selected by the user
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
SelectionEvent
,
removeSelectionListener(SelectionListener)
void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notified
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(SelectionListener)
void addListener(int eventType, Listener listener)
handleEvent()
message. The event
type is one of the event constants defined in class SWT
.
The zone for the mouse event is identified by mouse location
and the zone for key events is identified by the focus items on the axises.
The coordinates of the mouse event are Matrix widget related and
are not translated to be related to the zone location.
The supported event types are: SWT#MouseDoubleClick
, SWT#MouseDown
,
SWT#MouseUp
, SWT#MouseMove
, SWT#MouseEnter
, SWT#MouseExit
,
SWT#KeyDown
, SWT#KeyUp
eventType
- the type of event to listen for.listener
- the listener which should be notified when the event occurs
java.lang.IllegalArgumentException
- SWTException
- Listener
,
SWT
,
removeListener(int, Listener)
void removeListener(int eventType, Listener listener)
SWT
.
eventType
- the type of event to listen forlistener
- the listener which should no longer be notified
java.lang.IllegalArgumentException
- SWTException
- Listener
,
SWT
,
addListener(int, Listener)
void addPainter(Painter<X,Y> painter)
painter
- the painter to be addedvoid addPainter(int index, Painter<X,Y> painter)
index
- at which the specified painter is to be insertedpainter
- painter to be inserted
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= getPainterCount())
java.lang.IllegalArgumentException
- if the painter is null
java.lang.IllegalArgumentException
- if the painter's name already exists
in the collection of painters.void setPainter(int index, Painter<X,Y> painter)
index
- index of the element to replacepainter
- painter to be stored at the specified position
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= getPainterCount()) *
java.lang.IllegalArgumentException
- if the painter is null
java.lang.IllegalArgumentException
- if the painter's name already exists
in the collection of painters.void replacePainter(Painter<X,Y> painter)
painter
- painter to replace a painter with the same name
java.lang.IllegalArgumentException
- if the painter is nullvoid replacePainterPreserveStyle(Painter<X,Y> painter)
painter
- painter to replace a painter with the same name
java.lang.IllegalArgumentException
- if the painter is nullPainter<X,Y> removePainter(int index)
index
- the index of the painter to be removed
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= getPainterCount())Painter.NAME_CELLS
boolean removePainter(Painter<X,Y> painter)
painter
- element to be removed from this list, if present
java.lang.ClassCastException
- if the type of the specified element
is incompatible with this list (optional)
java.lang.IllegalArgumentException
- if the painter is nullPainter.NAME_CELLS
boolean removePainter(java.lang.String name)
name
- the name of the painter to be removed from this list, if present
java.lang.ClassCastException
- if the type of the specified element
is incompatible with this list (optional)
java.lang.IllegalArgumentException
- if the painter is nullPainter.NAME_CELLS
int indexOfPainter(java.lang.String name)
name
- painter name to search for
java.lang.IllegalArgumentException
- if the name is nullPainter<X,Y> getPainter(java.lang.String name)
null
if the painters list does not contain such painter.
name
- painter name to search for
java.lang.IllegalArgumentException
- if the name is nullint getPainterCount()
Painter<X,Y> getPainter(int index)
index
- index of the painter to return
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= getPainterCount())Matrix<X,Y> getMatrix()
boolean contains(CellExtent<X,Y> cellExtent, X indexX, Y indexY)
boolean containsLocation(int x, int y)
true
if the given matrix related coordinates are locatad within bounds of this zone,
otherwise return false
.
true
if the given coordinates are locatad within bounds of this zone
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |