|
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.ColumnDropTargetListener
public class ColumnDropTargetListener
This DropTargetListener
can be used to create new columns in a TableGroupNodeRealizer
via drag'n'drop.
It can be configured to use the default settings for the column size, minimum size and inset of the new column's table or those set at this listener.
A maximum level for nested column structures can be set so that no new column with a deeper nesting level can be created.
While dragging, a drawable indicates possible positions of the new column.
Constructor Summary | |
---|---|
ColumnDropTargetListener(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 column. |
void |
dragEnter(java.awt.dnd.DropTargetDragEvent event)
On entering a new drawable is created via createDrawable(java.awt.geom.Rectangle2D,y.geom.YInsets)
and 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 column 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 column can be determined, a column is created. |
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
This implementation doesn't react to a drop action change. |
YInsets |
getDefaultInsets()
Returns the insets of columns created by this listener. |
double |
getDefaultMinimumWidth()
Returns the minimum width of columns created by this listener. |
double |
getDefaultWidth()
Returns the initial width of columns created by this listener. |
double |
getDrawableHeight()
Returns the height assigned to the drawable while no valid position for a new column can be found at the cursor position. |
int |
getMaxLevel()
Returns the maximum level the new column may lie in. |
TableSupport |
getTableSupport()
Returns the TableSupport used to create new columns. |
boolean |
isUsingTableDefaults()
Returns true if default settings for width, minimum width,
and insets are taken from the target table or false if the
default settings of the listener are used when creating a new column in
a table. |
void |
setDefaultInsets(YInsets defaultInsets)
Specifies the insets of columns created by this listener. |
void |
setDefaultMinimumWidth(double defaultMinimumWidth)
Specifies the minimum width of columns created by this listener. |
void |
setDefaultWidth(double defaultWidth)
Specifies the initial width of columns created by this listener. |
void |
setDrawableHeight(double drawableHeight)
Specifies the height assigned to the drawable while no valid position for a new column can be found at the cursor position. |
void |
setMaxLevel(int maxLevel)
Specifies the maximum level the new column may lie in. |
void |
setTableSupport(TableSupport support)
Specifies the TableSupport used to create new columns. |
void |
setUsingTableDefaults(boolean usingTableDefaults)
Specifies whether default settings for width, minimum width, and insets are taken from the target table or whether the default settings of the listener are used when creating a new column in a table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColumnDropTargetListener(Graph2DView view)
view
- The Graph2DView to work on.Method Detail |
---|
public TableSupport getTableSupport()
TableSupport
used to create new columns.
TableSupport
used to create new columns.setTableSupport(TableSupport)
public void setTableSupport(TableSupport support)
TableSupport
used to create new columns.
support
- the TableSupport
instance to be used.getTableSupport()
protected Drawable createDrawable(java.awt.geom.Rectangle2D bounds, YInsets insets)
bounds
of the new column.
The insets
can be used to indicate the possible insets of the new column.
bounds
- The possible bounds of the new column.insets
- The possible insets of the new column.public void dragEnter(java.awt.dnd.DropTargetDragEvent event)
createDrawable(java.awt.geom.Rectangle2D,y.geom.YInsets)
and 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 columns of the TableGroupNodeRealizer
the column is created in or the settings of this listener are used for the new column.
drop
in interface java.awt.dnd.DropTargetListener
public double getDefaultWidth()
The default value of this property is 10.
setDefaultWidth(double)
public void setDefaultWidth(double defaultWidth)
The default value of this property is 10.
defaultWidth
- the initial width of columns.getDefaultWidth()
public double getDefaultMinimumWidth()
The default value of this property is 10.
setDefaultMinimumWidth(double)
public void setDefaultMinimumWidth(double defaultMinimumWidth)
The default value of this property is 10.
defaultMinimumWidth
- the default minimum width of columns.getDefaultMinimumWidth()
public YInsets getDefaultInsets()
The default insets are top = 10
, left = 0
,
bottom = 0
, right = 0
.
setDefaultInsets(y.geom.YInsets)
public void setDefaultInsets(YInsets defaultInsets)
The default insets are top = 10
, left = 0
,
bottom = 0
, right = 0
.
defaultInsets
- the insets of columns 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 column.getMaxLevel()
public boolean isUsingTableDefaults()
true
if default settings for width, minimum width,
and insets are taken from the target table or false
if the
default settings of the listener are used when creating a new column 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 getDrawableHeight()
The default value of this property is 100.
setDrawableHeight(double)
public void setDrawableHeight(double drawableHeight)
The default value of this property is 100.
drawableHeight
- the height assigned to the drawable.getDrawableHeight()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |