|
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.TableSelectionEditor
public class TableSelectionEditor
This MultiplexingNodeEditor.NodeEditor
can be used to
change the selection status of rows and columns of a
TableGroupNodeRealizer
.
A row (column) can be selected by clicking somewhere inside it's left
(top) inset area. If isSelectionModifierPressed(y.view.Mouse2DEvent)
returns false
, this also results in an unselection of all
selected graph elements as well as all other selected rows and columns of
this TableGroupNodeRealizer
.
The selection status of the rows and columns of a
TableGroupNodeRealizer
can be connected to the
selection status of this realizer if
is set to
selectionPolicy
RELATE_TO_NODE_SELECTION
. In this case the selection of a row or
column results in the selection of the realizer and on deselecting the
realizer its rows and columns are deselected as well.
Field Summary | |
---|---|
static byte |
IGNORE_NODE_SELECTION
Using this selection policy the selection states of rows/columns and their TableGroupNodeRealizer are not related to each
other. |
static byte |
RELATE_TO_NODE_SELECTION
Using this selection policy the selection states of rows/columns and their TableGroupNodeRealizer are related to each other. |
Constructor Summary | |
---|---|
TableSelectionEditor()
The default constructor of this class. |
Method Summary | |
---|---|
protected void |
columnEventHappened(Graph2D graph,
TableGroupNodeRealizer.Column column,
boolean modifierPressed)
Handles (non-cyclic) selection state changes for the specified column. |
protected void |
columnEventHappened(Graph2D graph,
TableGroupNodeRealizer.Column column,
Mouse2DEvent event)
Handles selection state changes for the specified column. |
protected boolean |
columnSelectionHit(TableGroupNodeRealizer.Column column,
double x,
double y)
Determines whether a mouse click at the specified hit location should change the selection state of the specified column. |
java.awt.Cursor |
getCursor(Mouse2DEvent event)
Returns a mouse cursor to indicate what action this event could trigger or
null if the editor does not want to initiate a cursor change. |
byte |
getSelectionPolicy()
Return the current selection policy. |
boolean |
isCyclicSelectionEnabled()
Determines whether or not selection cycling is enabled. |
protected boolean |
isCyclicSelectionModifierPressed(Mouse2DEvent event)
Determines whether or not the specified event should result in cycling the selection through the elements at the current mouse position (if selection cycling is enabled). |
boolean |
isExtendedSelectionHitEnabled()
Returns true if the editor should change the selection state
of columns and rows that have no children upon hits outside of the column's
top inset area or the row's left inset area and false
otherwise. |
boolean |
isMixedSelectionEnabled()
Returns true if the editor allows mixed multi-selections of
columns and rows in a table and false otherwise. |
protected boolean |
isSelectionModifierPressed(Mouse2DEvent event)
Determines whether or not the specified event should result in expanding the current selection to include the clicked element instead of changing the selection to the clicked element. |
boolean |
isUnselectOnTableBorderEnabled()
Returns true if clicking on the table border will unselect
all selected columns and rows and false otherwise. |
boolean |
isValidStartPosition(double x,
double y)
The given position is considered to be valid if it is inside the left inset of a TableGroupNodeRealizer.Row
or the top inset of a TableGroupNodeRealizer.Column . |
void |
mouse2DEventHappened(Mouse2DEvent event)
Listener-like interface that will be notified of Mouse2DEvents. |
void |
onGraph2DSelectionEvent(Graph2DSelectionEvent event)
Sets the selection state of all columns and rows of a TableGroupNodeRealizer 's table model to
false whenever said realizer's selection state is changed
to false and the current selectionPolicy is
RELATE_TO_NODE_SELECTION . |
protected void |
rowEventHappened(Graph2D graph,
TableGroupNodeRealizer.Row row,
boolean modifierPressed)
Handles (non-cyclic) selection state changes for the specified row. |
protected void |
rowEventHappened(Graph2D graph,
TableGroupNodeRealizer.Row row,
Mouse2DEvent event)
Handles selection state changes for the specified row. |
protected boolean |
rowSelectionHit(TableGroupNodeRealizer.Row row,
double x,
double y)
Determines whether a mouse click at the specified hit location should change the selection state of the specified row. |
protected void |
setColumnSelectionState(TableGroupNodeRealizer.Column column,
boolean newState)
Sets the selection state of the given column. |
void |
setContext(Graph2DView view,
MultiplexingNodeEditor parent,
NodeRealizer realizer)
Provides context information for the editor. |
void |
setCyclicSelectionEnabled(boolean enabled)
Specifies whether or not selection cycling should be enabled. |
void |
setExtendedSelectionHitEnabled(boolean enabled)
Specifies whether the editor may change the selection state of columns and rows that have no children upon hits outside of the column's top inset area or the row's left inset area. |
void |
setMixedSelectionEnabled(boolean enabled)
Specifies whether or not the editor should allow mixed multi-selections of columns and rows in a table. |
protected void |
setRealizerSelectionState(TableGroupNodeRealizer realizer,
boolean newState)
Sets the selection state of the given table node realizer. |
protected void |
setRowSelectionState(TableGroupNodeRealizer.Row row,
boolean newState)
Sets the selection state of the given row. |
void |
setSelectionPolicy(byte selectionPolicy)
Specifies the selection policy of the editor. |
void |
setUnselectOnTableBorderEnabled(boolean enabled)
Specifies whether clicking on the table border should unselect selected columns and rows. |
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. |
protected void |
tableEventHappened(Graph2D graph,
TableGroupNodeRealizer.Table table,
boolean modifierPressed)
Handles (non-cyclic) selection state changes for the realizer associated to the specified table. |
protected void |
tableEventHappened(Graph2D graph,
TableGroupNodeRealizer.Table table,
Mouse2DEvent event)
Handles selection state changes for the realizer associated to the specified table. |
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 IGNORE_NODE_SELECTION
TableGroupNodeRealizer
are not related to each
other.
getSelectionPolicy()
,
setSelectionPolicy(byte)
,
Constant Field Valuespublic static final byte RELATE_TO_NODE_SELECTION
TableGroupNodeRealizer
are related to each other.
The selection of a row or column results in the selection of the realizer
and on deselecting the realizer it's rows and columns are deselected as
well.
getSelectionPolicy()
,
setSelectionPolicy(byte)
,
Constant Field ValuesConstructor Detail |
---|
public TableSelectionEditor()
Method Detail |
---|
public boolean isValidStartPosition(double x, double y)
TableGroupNodeRealizer.Row
or the top inset of a TableGroupNodeRealizer.Column
.
isValidStartPosition
in interface MultiplexingNodeEditor.NodeEditor
x
- The horizontal position to check.y
- The vertical position to check.
true
, if the given position is inside the left inset of a TableGroupNodeRealizer.Row
or the top inset of a TableGroupNodeRealizer.Column
; false
otherwise.protected boolean columnSelectionHit(TableGroupNodeRealizer.Column column, double x, double y)
column
- the Column
to check.x
- the x-coordinate of the hit location.y
- the y-coordinate of the hit location.
true
if the selection state of specified column
should change; false
otherwise.protected boolean rowSelectionHit(TableGroupNodeRealizer.Row row, double x, double y)
row
- the Row
to check.x
- the x-coordinate of the hit location.y
- the y-coordinate of the hit location.
true
if the selection state of specified column
should change; false
otherwise.protected boolean isSelectionModifierPressed(Mouse2DEvent event)
The default implementation checks if SHIFT
is pressed.
event
- The mouse event to check.
true
, if SHIFT
was pressed in the event
; false
otherwise.protected boolean isCyclicSelectionModifierPressed(Mouse2DEvent event)
The default implementation checks if CTRL
is pressed.
event
- the triggering event.
true
if the specified event should result
in selection cycling and false
otherwise.isCyclicSelectionEnabled()
,
setCyclicSelectionEnabled(boolean)
public void onGraph2DSelectionEvent(Graph2DSelectionEvent event)
TableGroupNodeRealizer
's table model to
false
whenever said realizer's selection state is changed
to false
and the current selectionPolicy
is
RELATE_TO_NODE_SELECTION
.
onGraph2DSelectionEvent
in interface Graph2DSelectionListener
event
- The selection event to check.public byte getSelectionPolicy()
The selection policy determines if the selection states of TableGroupNodeRealizer.Row
s and
TableGroupNodeRealizer.Column
s are related to the selection state of their
TableGroupNodeRealizer
.
The default setting of this policy is IGNORE_NODE_SELECTION
.
IGNORE_NODE_SELECTION
or RELATE_TO_NODE_SELECTION
.setSelectionPolicy(byte)
public void setSelectionPolicy(byte selectionPolicy)
selectionPolicy
- one of
java.lang.IllegalArgumentException
- if selectionPolicy
does not
equal on of the selection policy constants.getSelectionPolicy()
public boolean isUnselectOnTableBorderEnabled()
true
if clicking on the table border will unselect
all selected columns and rows and false
otherwise. In this
context the table border is defined as the area that does not belong to
any column or row.
By default, this property is set to true
.
true
if clicking on the table border will unselect
all selected columns and rows and false
otherwise.setUnselectOnTableBorderEnabled(boolean)
public void setUnselectOnTableBorderEnabled(boolean enabled)
By default, this property is set to true
.
enabled
- true
if clicking on the table border should
unselect all selected columns and rows and false
otherwise.isUnselectOnTableBorderEnabled()
public boolean isMixedSelectionEnabled()
true
if the editor allows mixed multi-selections of
columns and rows in a table and false
otherwise.
true
if the editor allows mixed multi-selections of
columns and rows in a table and false
otherwise.public void setMixedSelectionEnabled(boolean enabled)
enabled
- true
if the editor should allow mixed
multi-selections of columns and rows in a table and false
otherwise.public boolean isCyclicSelectionEnabled()
true
if selection cycling is enabled and
false
otherwise.setCyclicSelectionEnabled(boolean)
,
isCyclicSelectionEvent(y.view.Mouse2DEvent)
public void setCyclicSelectionEnabled(boolean enabled)
enabled
- if true
, selection cycling is enabled.isCyclicSelectionEnabled()
,
isCyclicSelectionEvent(y.view.Mouse2DEvent)
public boolean isExtendedSelectionHitEnabled()
true
if the editor should change the selection state
of columns and rows that have no children upon hits 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
a column
selection state change is only triggered outside of any rows and a row
selection state change is only triggered outside of any columns.
By default, this property is true
.
true
if the editor should change the selection state
of columns and rows that have no children upon hits outside of the column's
top inset area or the row's left inset area and false
otherwise.setExtendedSelectionHitEnabled(boolean)
,
columnSelectionHit(y.view.tabular.TableGroupNodeRealizer.Column, double, double)
,
rowSelectionHit(y.view.tabular.TableGroupNodeRealizer.Row, double, double)
public void setExtendedSelectionHitEnabled(boolean enabled)
By default, this property is true
.
enabled
- if true
the editor may change the selection
state upon hits outside of the column's top inset area or the row's left
inset area; if false
only hits inside a column's top inset
area or a row's left inset area will trigger selection state changes.isExtendedSelectionHitEnabled()
,
columnSelectionHit(y.view.tabular.TableGroupNodeRealizer.Column, double, double)
,
rowSelectionHit(y.view.tabular.TableGroupNodeRealizer.Row, double, double)
public boolean startsEditing(Mouse2DEvent event)
MouseInputEditor
startsEditing
in interface MouseInputEditor
event
- the event that happened
MouseInputEditor.isInterestedInEvents()
public void mouse2DEventHappened(Mouse2DEvent event)
MouseInputEditor
mouse2DEventHappened
in interface MouseInputEditor
event
- the event that happenedMouseInputEditor.isInterestedInEvents()
protected void columnEventHappened(Graph2D graph, TableGroupNodeRealizer.Column column, Mouse2DEvent event)
Calls
columnEventHappened(y.view.Graph2D, y.view.tabular.TableGroupNodeRealizer.Column, boolean)
if no cyclic selection change is required.
graph
- the Graph2D
that holds the table node to
which the specified column belongs.column
- the Column
whose selection state should be
changed.event
- the event that triggered the selection state change.isCyclicSelectionEnabled()
,
isCyclicSelectionEvent(y.view.Mouse2DEvent)
protected void columnEventHappened(Graph2D graph, TableGroupNodeRealizer.Column column, boolean modifierPressed)
Called from
columnEventHappened(y.view.Graph2D, y.view.tabular.TableGroupNodeRealizer.Column, y.view.Mouse2DEvent)
if no cyclic selection change is required.
graph
- the Graph2D
that holds the table node to
which the specified column belongs.column
- the Column
whose selection state should be
changed.modifierPressed
- the result of
isSelectionModifierPressed(y.view.Mouse2DEvent)
for the event
that triggered the selection state change of the specified column.protected void rowEventHappened(Graph2D graph, TableGroupNodeRealizer.Row row, Mouse2DEvent event)
Calls
rowEventHappened(y.view.Graph2D, y.view.tabular.TableGroupNodeRealizer.Row, boolean)
if no cyclic selection change is required.
graph
- the Graph2D
that holds the table node to
which the specified row belongs.row
- the Row
whose selection state should be
changed.event
- the event that triggered the selection state change.isCyclicSelectionEnabled()
,
isCyclicSelectionEvent(y.view.Mouse2DEvent)
protected void rowEventHappened(Graph2D graph, TableGroupNodeRealizer.Row row, boolean modifierPressed)
Called from
rowEventHappened(y.view.Graph2D, y.view.tabular.TableGroupNodeRealizer.Row, y.view.Mouse2DEvent)
if no cyclic selection change is required.
graph
- the Graph2D
that holds the table node to
which the specified row belongs.row
- the Row
whose selection state should be
changed.modifierPressed
- the result of
isSelectionModifierPressed(y.view.Mouse2DEvent)
for the event
that triggered the selection state change of the specified row.protected void tableEventHappened(Graph2D graph, TableGroupNodeRealizer.Table table, Mouse2DEvent event)
Calls
tableEventHappened(y.view.Graph2D, y.view.tabular.TableGroupNodeRealizer.Table, boolean)
if no cyclic selection change is required.
graph
- the Graph2D
that holds the table node.table
- the Table
whose associated realizer's
selection state should be changed.event
- the event that triggered the selection state change.isCyclicSelectionEnabled()
,
isCyclicSelectionEvent(y.view.Mouse2DEvent)
protected void tableEventHappened(Graph2D graph, TableGroupNodeRealizer.Table table, boolean modifierPressed)
Called from
tableEventHappened(y.view.Graph2D, y.view.tabular.TableGroupNodeRealizer.Table, y.view.Mouse2DEvent)
if no cyclic selection change is required.
graph
- the Graph2D
that holds the table node.table
- the Table
whose associated realizer's
selection state should be changed.modifierPressed
- the result of
isSelectionModifierPressed(y.view.Mouse2DEvent)
for the event
that triggered the selection state change.protected void setRealizerSelectionState(TableGroupNodeRealizer realizer, boolean newState)
true
.
realizer
- a table node realizernewState
- the new selection state for the realizerprotected void setColumnSelectionState(TableGroupNodeRealizer.Column column, boolean newState)
TableGroupNodeRealizer.Column.setSelected(boolean)
.
column
- a columnnewState
- the new selection state for the columnprotected void setRowSelectionState(TableGroupNodeRealizer.Row row, boolean newState)
TableGroupNodeRealizer.Row.setSelected(boolean)
.
row
- a rownewState
- the new selection state for the rowpublic 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.public java.awt.Cursor getCursor(Mouse2DEvent event)
MultiplexingNodeEditor.NodeEditor
event
could trigger or
null
if the editor does not want to initiate a cursor change.
getCursor
in interface MultiplexingNodeEditor.NodeEditor
event
- The mouse event a cursor can be returned for.
Cursor
if a possible action for this mouse event
shall be indicated or null
.public void stopEditing()
MouseInputEditor
stopEditing
in interface MouseInputEditor
stopEditing
in class AbstractMouseInputEditor
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |