X
- indexing type for the horizontal axisY
- indexing type for vertical axispublic class Matrix<X extends java.lang.Number,Y extends java.lang.Number> extends org.eclipse.swt.widgets.Canvas implements java.lang.Iterable<Zone<X,Y>>
Modifier and Type | Field and Description |
---|---|
static int |
BACKWARD
Denotes a backward direction
|
static int |
CMD_COPY |
static int |
CMD_CUT |
static int |
CMD_DELETE
Command to delete (set to null) the values of the selected cells.
|
static int |
CMD_EDIT_ACTIVATE
Command to activate the editor control by setting focus on it.
|
static int |
CMD_EDIT_APPLY
Command to apply the value from the editor control to the model without
deactivating the control.
|
static int |
CMD_EDIT_DEACTIVATE_APPLY
Command to deactivate the editor control with applying it's value to the
model.
|
static int |
CMD_EDIT_DEACTIVATE_CANCEL
Command to deactivate the editor control without applying it's value to the
model.
|
static int |
CMD_FOCUS_DOWN |
static int |
CMD_FOCUS_LEFT |
static int |
CMD_FOCUS_LOCATION |
static int |
CMD_FOCUS_LOCATION_ALTER |
static int |
CMD_FOCUS_MOST_DOWN |
static int |
CMD_FOCUS_MOST_DOWN_RIGHT |
static int |
CMD_FOCUS_MOST_LEFT |
static int |
CMD_FOCUS_MOST_RIGHT |
static int |
CMD_FOCUS_MOST_UP |
static int |
CMD_FOCUS_MOST_UP_LEFT |
static int |
CMD_FOCUS_PAGE_DOWN |
static int |
CMD_FOCUS_PAGE_LEFT |
static int |
CMD_FOCUS_PAGE_RIGHT |
static int |
CMD_FOCUS_PAGE_UP |
static int |
CMD_FOCUS_RIGHT |
static int |
CMD_FOCUS_UP |
static int |
CMD_ITEM_HIDE |
static int |
CMD_ITEM_SHOW |
static int |
CMD_PACK_COLUMN |
static int |
CMD_PACK_ROW |
static int |
CMD_PASTE |
static int |
CMD_REDO |
static int |
CMD_SELECT_ALL |
static int |
CMD_SELECT_COLUMN |
static int |
CMD_SELECT_COLUMN_ALTER |
static int |
CMD_SELECT_DOWN |
static int |
CMD_SELECT_FULL_DOWN |
static int |
CMD_SELECT_FULL_DOWN_RIGHT |
static int |
CMD_SELECT_FULL_LEFT |
static int |
CMD_SELECT_FULL_RIGHT |
static int |
CMD_SELECT_FULL_UP |
static int |
CMD_SELECT_FULL_UP_LEFT |
static int |
CMD_SELECT_LEFT |
static int |
CMD_SELECT_PAGE_DOWN |
static int |
CMD_SELECT_PAGE_LEFT |
static int |
CMD_SELECT_PAGE_RIGHT |
static int |
CMD_SELECT_PAGE_UP |
static int |
CMD_SELECT_RIGHT |
static int |
CMD_SELECT_ROW |
static int |
CMD_SELECT_ROW_ALTER |
static int |
CMD_SELECT_TO_COLUMN |
static int |
CMD_SELECT_TO_COLUMN_ALTER |
static int |
CMD_SELECT_TO_LOCATION |
static int |
CMD_SELECT_TO_LOCATION_ALTER |
static int |
CMD_SELECT_TO_ROW |
static int |
CMD_SELECT_TO_ROW_ALTER |
static int |
CMD_SELECT_UP |
static int |
CMD_TRAVERSE_TAB_NEXT |
static int |
CMD_TRAVERSE_TAB_PREVIOUS |
static int |
CMD_UNDO |
static int |
EVENT_LAYOUT |
static int |
FORWARD
Denotes a forward direction
|
static int |
PRINTABLE_CHARS |
Constructor and Description |
---|
Matrix(org.eclipse.swt.widgets.Composite parent,
int style)
Calls the
Matrix(Composite, int, Axis, Axis) constructor with
null values for axisY and axisX
which makes it to creates the default Integer axises with two sections. |
Matrix(org.eclipse.swt.widgets.Composite parent,
int style,
Axis<X> axisX,
Axis<Y> axisY)
Constructs a new instance of this class given its parent and a style value
describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(int eventType,
org.eclipse.swt.widgets.Listener listener) |
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 |
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(int wHint,
int hHint) |
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed) |
void |
dispose() |
void |
execute(int commandId) |
Axis<X> |
getAxisX()
Returns the column (horizontal) axis.
|
Axis<Y> |
getAxisY()
Returns the row (vertical) axis.
|
Zone<X,Y> |
getBody()
Returns the body zone of this matrix.
|
boolean |
getCopyBeyondBody()
Returns
true if all the selected cells not only from the
current zone should be copied with the copy command and false
otherwise. |
boolean |
getCopyPasteHiddenCells()
Returns
true if the hidden cells should be copied with the
copy command. |
Zone<X,Y> |
getHeaderX()
Returns the column header zone of this matrix.
|
Zone<X,Y> |
getHeaderXY()
Returns the top left zone of this matrix.
|
Zone<X,Y> |
getHeaderY()
Returns the row header zone of this matrix.
|
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.
|
boolean |
getSelectSkipHidden()
Returns
true if the hidden cells should be selected with range
select. |
Zone<X,Y> |
getZone(Section<X> sectionX,
Section<Y> sectionY)
Returns a zone located at the intersection of the given axis sections.
|
int[] |
getZonePaintOrder()
Returns order in which the zones will be painted.
|
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.
|
java.util.Iterator<Zone<X,Y>> |
iterator() |
void |
refresh()
Recalculates the matrix layout and repaints it.
|
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 first occurrence of the specified element from this list, if it
is present (optional operation).
|
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 |
setCopyBeyondBody(boolean state)
Will cause the matrix to copy selected cells from other zone than the
current one as well when set to
true . |
void |
setCopyPasteHiddenCells(boolean state)
Will cause the matrix to copy the hidden cells when set to
true . |
void |
setPainter(int index,
Painter<X,Y> painter)
Replaces the painter at the given index of the receiver's painters list.
|
void |
setSelectSkipHidden(boolean state)
Will cause the matrix to exclude the hidden cells from range select when
set to
true . |
void |
setZonePaintOrder(int[] order)
Sets the order in which the zones will be painted.
|
void |
transpose()
Switch X and Y axises.
|
void |
unbind(int commandId,
int eventType,
int code)
Removes the binding the command to the user gesture specified by the event
type and code.
|
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
public static final int FORWARD
public static final int BACKWARD
public static final int PRINTABLE_CHARS
public static final int CMD_FOCUS_UP
public static final int CMD_FOCUS_DOWN
public static final int CMD_FOCUS_LEFT
public static final int CMD_FOCUS_RIGHT
public static final int CMD_FOCUS_PAGE_UP
public static final int CMD_FOCUS_PAGE_DOWN
public static final int CMD_FOCUS_PAGE_LEFT
public static final int CMD_FOCUS_PAGE_RIGHT
public static final int CMD_FOCUS_MOST_LEFT
public static final int CMD_FOCUS_MOST_RIGHT
public static final int CMD_FOCUS_MOST_UP
public static final int CMD_FOCUS_MOST_DOWN
public static final int CMD_FOCUS_MOST_UP_LEFT
public static final int CMD_FOCUS_MOST_DOWN_RIGHT
public static final int CMD_FOCUS_LOCATION
public static final int CMD_FOCUS_LOCATION_ALTER
public static final int CMD_SELECT_ALL
public static final int CMD_SELECT_UP
public static final int CMD_SELECT_DOWN
public static final int CMD_SELECT_LEFT
public static final int CMD_SELECT_RIGHT
public static final int CMD_SELECT_PAGE_UP
public static final int CMD_SELECT_PAGE_DOWN
public static final int CMD_SELECT_PAGE_LEFT
public static final int CMD_SELECT_PAGE_RIGHT
public static final int CMD_SELECT_FULL_UP
public static final int CMD_SELECT_FULL_DOWN
public static final int CMD_SELECT_FULL_LEFT
public static final int CMD_SELECT_FULL_RIGHT
public static final int CMD_SELECT_FULL_UP_LEFT
public static final int CMD_SELECT_FULL_DOWN_RIGHT
public static final int CMD_SELECT_TO_LOCATION
public static final int CMD_SELECT_TO_LOCATION_ALTER
public static final int CMD_SELECT_ROW
public static final int CMD_SELECT_ROW_ALTER
public static final int CMD_SELECT_COLUMN
public static final int CMD_SELECT_COLUMN_ALTER
public static final int CMD_SELECT_TO_ROW
public static final int CMD_SELECT_TO_ROW_ALTER
public static final int CMD_SELECT_TO_COLUMN
public static final int CMD_SELECT_TO_COLUMN_ALTER
public static final int CMD_CUT
public static final int CMD_COPY
public static final int CMD_PASTE
public static final int CMD_UNDO
public static final int CMD_REDO
public static final int CMD_EDIT_ACTIVATE
public static final int CMD_EDIT_DEACTIVATE_APPLY
public static final int CMD_EDIT_DEACTIVATE_CANCEL
public static final int CMD_EDIT_APPLY
public static final int CMD_DELETE
public static final int CMD_ITEM_HIDE
public static final int CMD_ITEM_SHOW
public static final int CMD_PACK_COLUMN
public static final int CMD_PACK_ROW
public static final int CMD_TRAVERSE_TAB_NEXT
public static final int CMD_TRAVERSE_TAB_PREVIOUS
public static final int EVENT_LAYOUT
public Matrix(org.eclipse.swt.widgets.Composite parent, int style)
Matrix(Composite, int, Axis, Axis)
constructor with
null
values for axisY
and axisX
which makes it to creates the default Integer axises with two sections.#Matrix(Composite, int, Axis, Axis, ZoneCore...)
public Matrix(org.eclipse.swt.widgets.Composite parent, int style, Axis<X> axisX, Axis<Y> axisY)
The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be
built by bitwise OR'ing together (that is, using the
int
"|" operator) two or more of those SWT
style
constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherzted from super classes.
It the axisY
or axisX
is null then the axis is
created with the Axis.Axis()
constructor.
The axises will be configured with default cell width for X axis and scroll/resize offsets, so any changes to those values should be done after matrix is constructed.
If any of zones
has zero painters then default painters are
attached.
parent
- a composite control which will be the parent of the new instance
(cannot be null)style
- the style of control to constructaxisY
- vertical axis for the matrixaxisX
- horizontal axis for the matrixjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- Widget.getStyle()
public void dispose()
dispose
in class org.eclipse.swt.widgets.Widget
public void addListener(int eventType, org.eclipse.swt.widgets.Listener listener)
addListener
in class org.eclipse.swt.widgets.Widget
public Axis<X> getAxisX()
public Zone<X,Y> getBody()
public Zone<X,Y> getHeaderX()
public Zone<X,Y> getHeaderY()
public Zone<X,Y> getHeaderXY()
public Zone<X,Y> getZone(Section<X> sectionX, Section<Y> sectionY)
sectionX
- section of the horizontal axissectionY
- section of the vertical axisjava.lang.IllegalArgumentException
- if item is null
or section does not belong to an
axis of this matrix.public void refresh()
public void bind(int commandId, int eventType, int code)
public void unbind(int commandId, int eventType, int code)
public int[] getZonePaintOrder()
public void setZonePaintOrder(int[] order)
order
- an array of zone indexes indicating the paint order of zonespublic void addPainter(Painter<X,Y> painter)
painter
- the painter to be addedpublic void 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.public 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.public void replacePainter(Painter<X,Y> painter)
painter
- painter to replace a painter with the same namejava.lang.IllegalArgumentException
- if the painter is nullpublic void replacePainterPreserveStyle(Painter<X,Y> painter)
The new painter inherits the style from the painter that's being replaced. This helps for example to change text in the headers without the need to re-apply all the styling data, like background color, selections colors, etc.
painter
- painter to replace a painter with the same namejava.lang.IllegalArgumentException
- if the painter is nullpublic Painter<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())public 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 nullpublic int indexOfPainter(java.lang.String name)
name
- painter name to search forjava.lang.IllegalArgumentException
- if the name is nullpublic Painter<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 nullpublic int getPainterCount()
public 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())public void execute(int commandId)
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class org.eclipse.swt.widgets.Composite
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint)
computeSize
in class org.eclipse.swt.widgets.Control
public void transpose()
public void setSelectSkipHidden(boolean state)
true
. Otherwise the hidden cells will be selected.
Default value is false
.
state
- the new state for the "select hidden cells" propertypublic boolean getSelectSkipHidden()
true
if the hidden cells should be selected with range
select.public void setCopyPasteHiddenCells(boolean state)
true
. Otherwise the hidden cells will not be copied.
Default value is false
.
state
- the new state for the "select hidden cells" propertypublic boolean getCopyPasteHiddenCells()
true
if the hidden cells should be copied with the
copy command.public void setCopyBeyondBody(boolean state)
true
. Otherwise the only cells
from the current zone will be copied. "Current" means the zone with the
focus cell.
Default value is false
.
state
- the new state for the "copy paste beyond body" propertypublic boolean getCopyBeyondBody()
true
if all the selected cells not only from the
current zone should be copied with the copy command and false
otherwise.Copyright © 2011 netanel.pl. All Rights Reserved.