|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AbstractMouseInputEditor y.view.tabular.TableOrderEditor
public class TableOrderEditor
This MultiplexingNodeEditor.NodeEditor
can be used to move rows and columns
of a TableGroupNodeRealizer
via drag'n'drop. While dragging a row or column, a drawable
previews the new position and bounds of the dragged item.
Whether rows and columns have to be selected before they can be moved can be configured by the movePolicy)
.
setMovePolicy(byte)
Field Summary | |
---|---|
static byte |
MOVE_POLICY_IGNORE_SELECTION
This policy determines that a row or column can be moved independent of it's selection status. |
static byte |
MOVE_POLICY_ONLY_ON_SELECTION
This policy determines that a row or column has to be selected before it can be moved. |
Constructor Summary | |
---|---|
TableOrderEditor()
The default constructor for this class. |
Method Summary | |
---|---|
protected boolean |
columnMovementHit(TableGroupNodeRealizer.Column column,
double x,
double y)
Determines whether a mouse drag starting at the specified hit location should start the editor for the specified column. |
protected Drawable |
createColumnMoveDrawable(TableGroupNodeRealizer.Column column,
java.awt.geom.Rectangle2D bounds)
Creates a drawable with the specified bounds used to indicate the new position of the moved column . |
protected Drawable |
createRowMoveDrawable(TableGroupNodeRealizer.Row row,
java.awt.geom.Rectangle2D bounds)
Creates a drawable with the specified bounds used to indicate the new position of the moved row . |
java.awt.Cursor |
getCursor(Mouse2DEvent event)
Returns Cursor.MOVE_CURSOR if the event 's location is a valid start position or
null otherwise. |
int |
getMaxColumnLevel()
The maximum number of levels the column hierarchy may have. |
int |
getMaxRowLevel()
The maximum number of levels the row hierarchy may have. |
byte |
getMovePolicy()
The policy defining if a row or column has to be selected before it can be moved. |
TableSupport |
getTableSupport()
Returns the TableSupport used to reparent and reposition the rows and columns. |
boolean |
isExtendedMovementHitEnabled()
Returns true if the editor should allow reordering for
columns and rows that have no children upon drags outside of the column's
top inset area or the row's left inset area and false
otherwise. |
boolean |
isValidStartPosition(double x,
double y)
Returns true only if the left insets of a row or the top insets of a column can be found at the
specified coordinates. |
void |
mouse2DEventHappened(Mouse2DEvent event)
Listener-like interface that will be notified of Mouse2DEvents. |
protected void |
mouseDragged(double x,
double y)
Calculates the new parent container and position that would be used if the mouse would be released at the given mouse location and updates the drawable indicating the row or columns new location. |
protected void |
mousePressed(double x,
double y)
Create the drawables for the row or column that shall be moved and stores the initial parent container and position. |
protected void |
mouseReleased(double x,
double y)
Moves the row or column to the new parent container and position determined for the given coordinates and finishes the editing action. |
protected boolean |
rowMovementHit(TableGroupNodeRealizer.Row row,
double x,
double y)
Determines whether a mouse drag starting at the specified hit location should start the editor for the specified row. |
void |
setContext(Graph2DView view,
MultiplexingNodeEditor parent,
NodeRealizer realizer)
Provides context information for the editor. |
void |
setExtendedMovementHitEnabled(boolean enabled)
Specifies whether the editor may reorder columns and rows that have no children upon drags outside of the column's top inset area or the row's left inset area. |
void |
setMaxColumnLevel(int maxColumnLevel)
Specifies the maximum nesting depth of columns in a TableGroupNodeRealizer 's table model that the
editor can create. |
void |
setMaxRowLevel(int maxRowLevel)
Specifies the maximum nesting depth of rows in a TableGroupNodeRealizer 's table model that the
editor can create. |
void |
setMovePolicy(byte movePolicy)
Specifies the movement policy for rows and columns. |
void |
setTableSupport(TableSupport support)
Specifies the support class to handle content (nodes and bends) moving during move operations. |
boolean |
startsEditing(Mouse2DEvent event)
This method is used by clients to query whether the given event is deemed as a starting gesture. |
void |
stopEditing()
Called by clients to stop the editing process cleanly. |
Methods inherited from class y.view.AbstractMouseInputEditor |
---|
addChangeListener, fireStateChanged, isEditing, isEnabled, isInterestedInEvents, removeChangeListener, setEnabled, startEditing |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface y.view.MouseInputEditor |
---|
addChangeListener, isEditing, isInterestedInEvents, removeChangeListener, startEditing |
Field Detail |
---|
public static final byte MOVE_POLICY_ONLY_ON_SELECTION
setMovePolicy(byte)
.
public static final byte MOVE_POLICY_IGNORE_SELECTION
setMovePolicy(byte)
.
Constructor Detail |
---|
public TableOrderEditor()
Method Detail |
---|
public TableSupport getTableSupport()
TableSupport
used to reparent and reposition the rows and columns.
TableSupport
used to reparent and reposition the rows and columns.setTableSupport(TableSupport)
public void setTableSupport(TableSupport support)
support
- the support class to handle content (nodes and bends) moving.getTableSupport()
public boolean isValidStartPosition(double x, double y)
true
only if the left insets of a row or the top insets of a column can be found at the
specified coordinates.
x
- The horizontal position.y
- The vertical position.
true
only if the left insets of a row or the top insets of a column can be found at the
specified coordinates; false
otherwise.protected boolean columnMovementHit(TableGroupNodeRealizer.Column column, double x, double y)
true
only if the editor's
movePolicy
is MOVE_POLICY_IGNORE_SELECTION
or
the specified column is selected.
column
- the Column
to check.x
- the x-coordinate of the hit location.y
- the y-coordinate of the hit location.
true
if the editor should start editing;
false
otherwise.getMovePolicy()
protected boolean rowMovementHit(TableGroupNodeRealizer.Row row, double x, double y)
true
only if the editor's
movePolicy
is MOVE_POLICY_IGNORE_SELECTION
or
the specified row is selected.
row
- the Row
to check.x
- the x-coordinate of the hit location.y
- the y-coordinate of the hit location.
true
if the editor should start editing;
false
otherwise.getMovePolicy()
protected void mousePressed(double x, double y)
x
- The horizontal coordinate to look for a row or column to move.y
- The vertical coordinate to look for a row or column to move.protected void mouseReleased(double x, double y)
x
- The horizontal coordinate to determine the new parent container and position.y
- The vertical coordinate to determine the new parent container and position.protected void mouseDragged(double x, double y)
x
- The horizontal coordinate to check.y
- The vertical coordinate to check.public void stopEditing()
MouseInputEditor
stopEditing
in interface MouseInputEditor
protected Drawable createRowMoveDrawable(TableGroupNodeRealizer.Row row, java.awt.geom.Rectangle2D bounds)
bounds
used to indicate the new position of the moved row
.
row
- The row a drawable shall be created for.bounds
- The bounds of the drawable to indicate.
row
.protected Drawable createColumnMoveDrawable(TableGroupNodeRealizer.Column column, java.awt.geom.Rectangle2D bounds)
bounds
used to indicate the new position of the moved column
.
column
- The column a drawable shall be created for.bounds
- The bounds of the drawable to indicate.
column
.public int getMaxRowLevel()
The maximum number of levels the row hierarchy may have. The moved row can't be placed in a level so that any of its child rows would end up in a deeper nesting level.
A row can always be placed top-level even if the row and its descendants already span more then the maximum number of levels.
The default is Integer.MAX_VALUE
.
setMaxRowLevel(int)
public void setMaxRowLevel(int maxRowLevel)
TableGroupNodeRealizer
's table model that the
editor can create.
The default is Integer.MAX_VALUE
.
maxRowLevel
- the maximum number of nesting levels for rows that
the editor can create.getMaxRowLevel()
public int getMaxColumnLevel()
The maximum number of levels the column hierarchy may have. The moved column can't be placed in a level so that any of its child columns would end up in a deeper nesting level.
A column can always be placed top-level even if the column and its descendants already span more then the maximum number of levels.
The default is Integer.MAX_VALUE
.
setMaxRowLevel(int)
public void setMaxColumnLevel(int maxColumnLevel)
TableGroupNodeRealizer
's table model that the
editor can create.
The default is Integer.MAX_VALUE
.
maxColumnLevel
- the maximum number of nesting levels for columns that
the editor can create.getMaxColumnLevel()
public byte getMovePolicy()
The policy defining if a row or column has to be selected before it can be moved.
One ofMOVE_POLICY_IGNORE_SELECTION
if the row/column has not to be selected beforehand.MOVE_POLICY_ONLY_ON_SELECTION
if the row/column has to be selected before it can be moved.MOVE_POLICY_ONLY_ON_SELECTION
.
setMovePolicy(byte)
public void setMovePolicy(byte movePolicy)
movePolicy
- one of
java.lang.IllegalArgumentException
- if movePolicy
does not equal
one of the movement policy constants.public boolean startsEditing(Mouse2DEvent event)
MouseInputEditor
event
- the event that happened
MouseInputEditor.isInterestedInEvents()
public void mouse2DEventHappened(Mouse2DEvent event)
MouseInputEditor
event
- the event that happenedMouseInputEditor.isInterestedInEvents()
public java.awt.Cursor getCursor(Mouse2DEvent event)
Cursor.MOVE_CURSOR
if the event
's location is a valid start position or
null otherwise.
- Specified by:
getCursor
in interface MultiplexingNodeEditor.NodeEditor
- Parameters:
event
- The mouse event a cursor can be returned for.
- Returns:
Cursor.MOVE_CURSOR
if the event
's location is a valid start position or
null
otherwise.
public boolean isExtendedMovementHitEnabled()
true
if the editor should allow reordering for
columns and rows that have no children upon drags outside of the column's
top inset area or the row's left inset area and false
otherwise.
Note, that even if this property is true
column reordering
is only allowed by dragging outside of any rows and row reordering
is only allowed by dragging outside of any columns.
By default, this property is true
.
true
if the editor should allow column and row
reordering for columns and rows that have no children upon drags outside
of the column's top inset area or the row's left inset area and
false
otherwise.setExtendedMovementHitEnabled(boolean)
,
columnMovementHit(y.view.tabular.TableGroupNodeRealizer.Column, double, double)
,
rowMovementHit(y.view.tabular.TableGroupNodeRealizer.Row, double, double)
public void setExtendedMovementHitEnabled(boolean enabled)
By default, this property is true
.
enabled
- if true
the editor may reorder columns and
rows that have no children upon drags outside of the column's top inset
area or the row's left inset area; if false
only drags
inside a column's top inset area or a row's left inset area will result
in any reordering.isExtendedMovementHitEnabled()
,
columnMovementHit(y.view.tabular.TableGroupNodeRealizer.Column, double, double)
,
rowMovementHit(y.view.tabular.TableGroupNodeRealizer.Row, double, double)
public void setContext(Graph2DView view, MultiplexingNodeEditor parent, NodeRealizer realizer)
MultiplexingNodeEditor.NodeEditor
setContext
in interface MultiplexingNodeEditor.NodeEditor
view
- the current view in which the editing is done.parent
- the multiplexing editor that delegates to the node editor.realizer
- the realizer representing the node to edit.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |