|
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.TableSizeEditor
public class TableSizeEditor
This MultiplexingNodeEditor.NodeEditor
can be used to resize rows and columns of a
TableGroupNodeRealizer
. During the resize gesture the new bounds of the row or column as
well as the new bounds of the realizer are indicated by a drawable.
As this resizing can cause other rows or columns to change their position, nodes residing in these rows or columns
are moved accordingly by use of tableSupport
.
A reduction of a row's or column's size is restricted to respect the following criteria:
resizePolicy
property, see getResizePolicy()
).isModifierPressed(y.view.Mouse2DEvent)
returns true
at the start of the resize gesture,
the sizes of the two adjacent rows or columns can be redistributed instead of in- or decreasing only one row's or
column's size. This is indicated by one drawable for each of the two rows or columns as well as a drawable for the
realizer (whose bounds stay the same).
Field Summary | |
---|---|
protected TableGroupNodeRealizer.Column |
activeColumn
The column that gets resized or null if there is none. |
protected TableGroupNodeRealizer.Row |
activeRow
The row that gets resized or null if there is none. |
protected double |
dx
The last recent delta of a horizontal resizing. |
protected double |
dy
The last recent delta of a vertical resizing. |
static byte |
RESIZE_POLICY_CONSIDER_BOUNDS
Using this resize policy the bounds of the content nodes are used to determine if a row's or column's size may be reduced further. |
static byte |
RESIZE_POLICY_CONSIDER_CENTER
Using this resize policy the center coordinates of the content nodes are used to determine if a row's or column's size may be reduced further. |
static byte |
RESIZE_POLICY_IGNORE_CONTENT
Using this resize policy content elements are completely ignored, that is content nodes do no restrict minimum column or row size and neither nodes nor bends are moved due to column or row size changes. |
protected TableGroupNodeRealizer.Column |
secondActiveColumn
The second column that gets resized if this is a column size redistribution gesture or null otherwise. |
protected TableGroupNodeRealizer.Row |
secondActiveRow
The second row that gets resized if this is a row size redistribution gesture or null otherwise. |
protected TableGroupNodeRealizer.Table |
table
The table whose rows or columns get resized. |
Constructor Summary | |
---|---|
TableSizeEditor()
Default constructor of this class. |
Method Summary | |
---|---|
protected void |
assignNewBounds()
Assigns the new sizes of the rows/columns. |
protected Drawable |
createColumnResizeDrawable(TableGroupNodeRealizer.Column column,
java.awt.geom.Rectangle2D bounds)
Creates a new drawable with the specified bounds indicating the new size of the given column. |
protected Drawable |
createRowResizeDrawable(TableGroupNodeRealizer.Row row,
java.awt.geom.Rectangle2D bounds)
Creates a new drawable with the specified bounds indicating the new size of the given row. |
protected Drawable |
createTableResizeDrawable(TableGroupNodeRealizer.Table table,
java.awt.geom.Rectangle2D bounds)
Creates a new drawable with the specified bounds indicating the new size of the given table. |
java.awt.Cursor |
getCursor(Mouse2DEvent event)
If the position of the event is valid to start a row (column) resize gesture,
Cursor.W_RESIZE_CURSOR (Cursor.N_RESIZE_CURSOR ) is returned. |
double |
getEpsilon()
Returns the maximal distance the mouse cursor may have to the realizer's bounding box, a column's right border or a row's bottom border so that a resize gesture still may start there. |
byte |
getResizePolicy()
Returns the current resize policy. |
TableSupport |
getTableSupport()
Returns the TableSupport used to resize the columns and rows. |
protected boolean |
isModifierPressed(Mouse2DEvent event)
Returns true if SHIFT was pressed during the specified event . |
boolean |
isTableResizeDrawableEnabled()
Determines if a drawable shall indicate the new bounds of the TableGroupNodeRealizer.Table . |
boolean |
isValidStartPosition(double x,
double y)
Determines whether the editor may start editing at the specified position. |
void |
mouse2DEventHappened(Mouse2DEvent event)
Listener-like interface that will be notified of Mouse2DEvents. |
protected void |
mouseDragged(double x,
double y)
Updates the bounds of the drawables indicating the new size(s) of the rows/columns. |
protected void |
mousePressed(double x,
double y,
boolean modifierPressed)
Initializes a drag gesture starting at the specified coordinates. |
protected void |
mouseReleased(double x,
double y)
Calls assignNewBounds() and finally ends the resize gesture. |
void |
setContext(Graph2DView view,
MultiplexingNodeEditor parent,
NodeRealizer realizer)
Provides context information for the editor. |
void |
setEpsilon(double epsilon)
Specifies the maximal distance the mouse cursor may have to the realizer's bounding box, a column's right border or a row's bottom border so that a resize gesture still may start there. |
void |
setResizePolicy(byte resizePolicy)
Specifies the resize policy to use. |
void |
setTableResizeDrawableEnabled(boolean enabled)
Specifies whether a resize preview should be displayed or not. |
void |
setTableSupport(TableSupport support)
Specifies the support class to handle content (nodes and bends) moving during resize 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 RESIZE_POLICY_CONSIDER_CENTER
getResizePolicy()
,
setResizePolicy(byte)
,
Constant Field Valuespublic static final byte RESIZE_POLICY_CONSIDER_BOUNDS
getResizePolicy()
,
setResizePolicy(byte)
,
Constant Field Valuespublic static final byte RESIZE_POLICY_IGNORE_CONTENT
getResizePolicy()
,
setResizePolicy(byte)
,
Constant Field Valuesprotected TableGroupNodeRealizer.Table table
protected TableGroupNodeRealizer.Row activeRow
null
if there is none.
protected TableGroupNodeRealizer.Row secondActiveRow
null
otherwise.
protected TableGroupNodeRealizer.Column activeColumn
null
if there is none.
protected TableGroupNodeRealizer.Column secondActiveColumn
null
otherwise.
protected double dx
protected double dy
Constructor Detail |
---|
public TableSizeEditor()
Method Detail |
---|
public TableSupport getTableSupport()
TableSupport
used to resize the columns and rows.
TableSupport
used to resize the columns and rows.getTableSupport()
public void setTableSupport(TableSupport support)
support
- the support class to handle content (nodes and bends) moving.getTableSupport()
public boolean isValidStartPosition(double x, double y)
In this context close means, that the distance is less than the
return value of getEpsilon()
.
x
- The horizontal position to check.y
- The vertical position to check.
true
if the editor may start editing at the specified
position and false
otherwise.protected boolean isModifierPressed(Mouse2DEvent event)
true
if SHIFT
was pressed during the specified event
.
event
- The mouse event to check.
SHIFT
was pressed during the given mouse event.protected void mousePressed(double x, double y, boolean modifierPressed)
x
- The horizontal start position of the gesture.y
- The vertical start position of the gesture.modifierPressed
- If isModifierPressed(y.view.Mouse2DEvent)
had returned true
for the
initial mouse gesture.protected void mouseDragged(double x, double y)
x
- The current horizontal position of the dragged mouse.y
- The current vertical position of the dragged mouse.protected void mouseReleased(double x, double y)
assignNewBounds()
and finally ends the resize gesture.
x
- the x-coordinate of the mouse release event.y
- the y-coordinate of the mouse release event.protected void assignNewBounds()
protected Drawable createTableResizeDrawable(TableGroupNodeRealizer.Table table, java.awt.geom.Rectangle2D bounds)
bounds
indicating the new size of the given table.
table
- The TableGroupNodeRealizer.Table
to create a drawable for.bounds
- The new table
bounds that shall be indicated.protected Drawable createRowResizeDrawable(TableGroupNodeRealizer.Row row, java.awt.geom.Rectangle2D bounds)
bounds
indicating the new size of the given row.
row
- The TableGroupNodeRealizer.Row
to create a drawable for.bounds
- The new bounds of the row
that shall be indicated.protected Drawable createColumnResizeDrawable(TableGroupNodeRealizer.Column column, java.awt.geom.Rectangle2D bounds)
bounds
indicating the new size of the given column.
column
- The TableGroupNodeRealizer.Column
to create a drawable for.bounds
- The new bounds of the column
that shall be indicated.public byte getResizePolicy()
RESIZE_POLICY_CONSIDER_BOUNDS
) or center coordinates (RESIZE_POLICY_CONSIDER_CENTER
).
The default setting for this policy is RESIZE_POLICY_CONSIDER_BOUNDS
.
RESIZE_POLICY_CONSIDER_BOUNDS
or RESIZE_POLICY_CONSIDER_CENTER
.setResizePolicy(byte)
public void setResizePolicy(byte resizePolicy)
The default setting for this policy is RESIZE_POLICY_CONSIDER_BOUNDS
.
resizePolicy
- one of
java.lang.IllegalArgumentException
- if resizePolicy
does not equal
one of the resize policy constants.getResizePolicy()
public boolean isTableResizeDrawableEnabled()
TableGroupNodeRealizer.Table
.
The default setting of this property is true
.
true
if a resize preview is displayed and
false
otherwise.setTableResizeDrawableEnabled(boolean)
,
createTableResizeDrawable(y.view.tabular.TableGroupNodeRealizer.Table, java.awt.geom.Rectangle2D)
public void setTableResizeDrawableEnabled(boolean enabled)
enabled
- if true
a drawable is displayed as a preview for the new bounds.isTableResizeDrawableEnabled()
,
createTableResizeDrawable(y.view.tabular.TableGroupNodeRealizer.Table, java.awt.geom.Rectangle2D)
public double getEpsilon()
The default value of this property is 5.
setEpsilon(double)
public void setEpsilon(double epsilon)
epsilon
- the distance.getEpsilon()
public void stopEditing()
MouseInputEditor
stopEditing
in interface MouseInputEditor
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)
event
is valid to start a row (column) resize gesture,
Cursor.W_RESIZE_CURSOR
(Cursor.N_RESIZE_CURSOR
) is returned.
getCursor
in interface MultiplexingNodeEditor.NodeEditor
event
- the Mouse2DEvent
that determines which Cursor
to return.
Cursor.W_RESIZE_CURSOR
or Cursor.N_RESIZE_CURSOR
if a resize gesture
may start at the location of the event
or null
otherwise.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 |