|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.tabular.RowDropTargetListener
public class RowDropTargetListener
This DropTargetListener
can be used to create new rows in a TableGroupNodeRealizer
via drag'n'drop.
It can be configured to use the default settings for the row size, minimum size and inset of the new row's table or those set at this listener.
A maximum level for nested row structures can be set so that no new row with a deeper nesting level can be created.
While dragging, a drawable indicates possible positions of the new row.
Constructor Summary | |
---|---|
RowDropTargetListener(Graph2DView view)
Constructs a new listener that works on the given view. |
Method Summary | |
---|---|
protected Drawable |
createDrawable(java.awt.geom.Rectangle2D bounds,
YInsets insets)
Creates a new drawable used to indicate the possible bounds of the new row. |
void |
dragEnter(java.awt.dnd.DropTargetDragEvent event)
On entering the drawable returned by createDrawable(java.awt.geom.Rectangle2D,y.geom.YInsets) is added to the view. |
void |
dragExit(java.awt.dnd.DropTargetEvent event)
Ends the drag gesture and does some clean ups. |
void |
dragOver(java.awt.dnd.DropTargetDragEvent event)
The new possible position for the row at the event 's location is determined and the drawable is updated. |
void |
drop(java.awt.dnd.DropTargetDropEvent event)
If a possible position for a new row can be determined, a row is created. |
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
This implementation doesn't react to a drop action change. |
double |
getDefaultHeight()
Returns the initial height of rows created by this listener. |
YInsets |
getDefaultInsets()
Returns the insets of rows created by this listener. |
double |
getDefaultMinimumHeight()
Returns the minimum height of rows created by this listener. |
double |
getDrawableWidth()
Returns the width assigned to the drawable while no valid position for a new row can be found at the cursor position. |
int |
getMaxLevel()
Returns the maximum level the new row may lie in. |
TableSupport |
getTableSupport()
Returns the TableSupport used to create new rows. |
boolean |
isUsingTableDefaults()
Returns true if default settings for height, minimum height,
and insets are taken from the target table or false if the
default settings of the listener are used when creating a new row in
a table. |
void |
setDefaultHeight(double defaultHeight)
Specifies the initial height of rows created by this listener. |
void |
setDefaultInsets(YInsets defaultInsets)
Specifies the insets of rows created by this listener. |
void |
setDefaultMinimumHeight(double defaultMinimumHeight)
Specifies the minimum height of rows created by this listener. |
void |
setDrawableWidth(double drawableWidth)
Specifies the width assigned to the drawable while no valid position for a new row can be found at the cursor position. |
void |
setMaxLevel(int maxLevel)
Specifies the maximum level the new row may lie in. |
void |
setTableSupport(TableSupport support)
Specifies the TableSupport used to create new rows. |
void |
setUsingTableDefaults(boolean usingTableDefaults)
Specifies whether default settings for height, minimum height, and insets are taken from the target table or whether the default settings of the listener are used when creating a new row in a table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RowDropTargetListener(Graph2DView view)
view
- The Graph2DView to work on.Method Detail |
---|
public TableSupport getTableSupport()
TableSupport
used to create new rows.
TableSupport
used to create new rows.setTableSupport(TableSupport)
public void setTableSupport(TableSupport support)
TableSupport
used to create new rows.
support
- the TableSupport
instance to be used.getTableSupport()
protected Drawable createDrawable(java.awt.geom.Rectangle2D bounds, YInsets insets)
bounds
of the new row.
The insets
can be used to indicate the possible insets of the new row.
bounds
- The possible bounds of the new row.insets
- The possible insets of the new row.public void dragEnter(java.awt.dnd.DropTargetDragEvent event)
createDrawable(java.awt.geom.Rectangle2D,y.geom.YInsets)
is added to the view.
dragEnter
in interface java.awt.dnd.DropTargetListener
public void dragOver(java.awt.dnd.DropTargetDragEvent event)
event
's location is determined and the drawable is updated.
dragOver
in interface java.awt.dnd.DropTargetListener
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
dropActionChanged
in interface java.awt.dnd.DropTargetListener
public void dragExit(java.awt.dnd.DropTargetEvent event)
dragExit
in interface java.awt.dnd.DropTargetListener
public void drop(java.awt.dnd.DropTargetDropEvent event)
usingTableDefaults
the default settings for rows of the TableGroupNodeRealizer
the row is created in
or the settings of this listener are used for the new row.
drop
in interface java.awt.dnd.DropTargetListener
event
- The drop event to handle.public double getDefaultHeight()
The default value of this property is 10.
setDefaultHeight(double)
public void setDefaultHeight(double defaultHeight)
The default value of this property is 10.
defaultHeight
- the initial height of rows.getDefaultHeight()
public double getDefaultMinimumHeight()
The default value of this property is 10.
setDefaultMinimumHeight(double)
public void setDefaultMinimumHeight(double defaultMinimumHeight)
The default value of this property is 10.
defaultMinimumHeight
- the default minimum height of rows.getDefaultMinimumHeight()
public YInsets getDefaultInsets()
The default insets are top = 0
, left = 10
,
bottom = 0
, right = 0
.
setDefaultInsets(y.geom.YInsets)
public void setDefaultInsets(YInsets defaultInsets)
The default insets are top = 0
, left = 10
,
bottom = 0
, right = 0
.
defaultInsets
- the insets of rows created by this listener.getDefaultInsets()
public int getMaxLevel()
The default value of this property is Integer.MAX_VALUE
.
setMaxLevel(int)
public void setMaxLevel(int maxLevel)
The default value of this property is Integer.MAX_VALUE
.
maxLevel
- the maximum level of a new row.getMaxLevel()
public boolean isUsingTableDefaults()
true
if default settings for height, minimum height,
and insets are taken from the target table or false
if the
default settings of the listener are used when creating a new row in
a table.
The default value of this property is false
.
setUsingTableDefaults(boolean)
public void setUsingTableDefaults(boolean usingTableDefaults)
The default value of this property is false
.
usingTableDefaults
- if true
the default settings
of the target table are used; otherwise the default settings from the
listener are used.isUsingTableDefaults()
public double getDrawableWidth()
The default value of this property is 100.
setDrawableWidth(double)
public void setDrawableWidth(double drawableWidth)
The default value of this property is 100.
drawableWidth
- the width assigned to the drawable.getDrawableWidth()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |