X
- indexing type for horizontal axisY
- indexing type for vertical axispublic interface Zone<X extends java.lang.Number,Y extends java.lang.Number>
Zone has painters to paint itself on the screen and listeners to respond to user gestures towards it.
Section
Modifier and Type | Method and Description |
---|---|
void |
addListener(int eventType,
org.eclipse.swt.widgets.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(org.eclipse.swt.events.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.
|
org.eclipse.swt.graphics.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) |
org.eclipse.swt.graphics.Rectangle |
getBounds(Frozen frozenX,
Frozen frozenY)
Returns the rectangular boundaries of this zone in the specified freezing area.
|
org.eclipse.swt.graphics.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) |
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,
org.eclipse.swt.widgets.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(org.eclipse.swt.events.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.
|
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.
|
Zone<X,Y> getUnchecked()
Painter#paint(Number, Number, int, int, int, int)
method.Section<X> getSectionX()
Section<Y> getSectionY()
org.eclipse.swt.graphics.Rectangle getCellBounds(X indexX, Y indexY)
indexX
- cell index on the horizontal axisindexY
- cell index on the vertical axisjava.lang.IllegalArgumentException
- if indexX
or
indexY
is null.java.lang.IndexOutOfBoundsException
- if indexY
is out of
0 ... this.getSectionX().getCount() boundsjava.lang.IndexOutOfBoundsException
- if indexX
is out of
0 ... this.getSectionY().getCount() boundsorg.eclipse.swt.graphics.Rectangle getBounds(Frozen frozenX, Frozen frozenY)
frozenX
- frozen area on horizontal axisfrozenY
- frozen area on vertical axisorg.eclipse.swt.graphics.Point computeSize(X indexX, Y indexY, int wHint, int hHint)
The preferred size of a cell is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask a cell questions such as "Given a particular width, how high does the control need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant SWT.DEFAULT is passed for the hint.
The hints are not implemented yet for text wrap.
The size is maximum size returned by 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 axisjava.lang.IllegalArgumentException
- only if both indexX
and
indexY
are null.java.lang.IndexOutOfBoundsException
- if indexX
is out of
0 ... this.getSectionY().getCount() boundsjava.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 statejava.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()
boundsjava.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 statejava.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()
boundsjava.lang.IndexOutOfBoundsException
- if indexY
or
countY
is out of 0 ... this.getSectionY().getCount()
boundsCellExtent<X,Y> getMerged(X indexX, Y indexY)
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 axisjava.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()
boundsjava.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 mergedtrue
if any cell in the given range is merged.java.lang.IndexOutOfBoundsException
- if startX
or
endX
is out of 0 ... this.getSectionX().getCount()
boundsjava.lang.IndexOutOfBoundsException
- if startY
or
endY
is out of 0 ... this.getSectionY().getCount()
boundsCell<X,Y> getMergeLimit()
void setMergeLimit(X limitX, Y limitY)
It is introduced to prevent performance problems with layout calculation which in case of merged cells must go beyond viewport area.
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 axisjava.lang.IllegalArgumentException
- if indexX
or
indexY
is null.java.lang.IndexOutOfBoundsException
- if indexX
is out of
0 ... this.getSectionY().getCount() boundsjava.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
If the cell selection is disabled the it always returns a
BigIntegerNumber
with zero value.
BigIntegerNumber
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.
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 stateMaskunbind(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 addSelectionListener(org.eclipse.swt.events.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 axis item
is selected by the userjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
SelectionEvent
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
void addListener(int eventType, org.eclipse.swt.widgets.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 occursjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- Listener
,
SWT
,
removeListener(int, Listener)
void removeListener(int eventType, org.eclipse.swt.widgets.Listener listener)
SWT
.eventType
- the type of event to listen forlistener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- Listener
,
SWT
,
addListener(int, org.eclipse.swt.widgets.Listener)
,
#getListeners(int)
,
#notifyListeners
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 insertedjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= getPainterCount())java.lang.IllegalArgumentException
- if the painter is nulljava.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 positionjava.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= getPainterCount()) *java.lang.IllegalArgumentException
- if the painter is nulljava.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 namejava.lang.IllegalArgumentException
- if the painter is nullvoid replacePainterPreserveStyle(Painter<X,Y> painter)
The new painter inherits the style from the painter that's being replaced. This helps for example to customize text in the cells without the need to re-apply all the styling data, like background color, selection colors, etc.
painter
- painter to replace a painter with the same namejava.lang.IllegalArgumentException
- if the painter is nullPainter<X,Y> removePainter(int index)
index
- the index of the painter to be removedjava.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 presentjava.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)
painter
- element to be removed from this list, if presentjava.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 forjava.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 forjava.lang.IllegalArgumentException
- if the name is nullint getPainterCount()
Painter<X,Y> getPainter(int index)
index
- index of the painter to returnjava.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)
Copyright © 2011 netanel.pl. All Rights Reserved.