|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractAction y.view.Graph2DViewActions.EditLabelAction
public static class Graph2DViewActions.EditLabelAction
Action that opens the label editor for interactive text editing.
Field Summary |
---|
Fields inherited from class javax.swing.AbstractAction |
---|
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
---|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary | |
---|---|
Graph2DViewActions.EditLabelAction()
Initializes a new EditLabelAction instance that has
no default view, that means if the view cannot be determined from the
event that triggers a delete action, no editor is opened. |
|
Graph2DViewActions.EditLabelAction(Graph2DView view)
Initializes a new EditLabelAction instance. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invokes editLabel for the view returned by
getView . |
protected NodeLabel |
createColumnLabel(TableGroupNodeRealizer realizer,
TableGroupNodeRealizer.Column c)
Creates a new NodeLabel instance, adds the created
instance to the specified realizer, and associates the instance
to the specified column. |
protected EdgeLabel |
createEdgeLabel(EdgeRealizer realizer)
Creates a new EdgeLabel instance and adds the created
instance to the specified realizer. |
protected NodeLabel |
createNodeLabel(NodeRealizer realizer)
Creates a new NodeLabel instance and adds the created
instance to the specified realizer. |
protected NodeLabel |
createRowLabel(TableGroupNodeRealizer realizer,
TableGroupNodeRealizer.Row r)
Creates a new NodeLabel instance, adds the created
instance to the specified realizer, and associates the instance
to the specified row. |
void |
editLabel(Graph2DView view)
Opens the interactive label editor for the specified view. |
protected YLabel |
findLabel(Graph2DView view)
Determines the label to edit. |
protected java.beans.PropertyChangeListener |
getPropertyChangeListener()
Returns a PropertyChangeListener that is notified of text
changes when interactive label text editing is done. |
protected Graph2DView |
getView(java.awt.event.ActionEvent e)
Determines the view in which to edit labels. |
protected boolean |
isSingleLineModeEnabled()
Determines the interactive editor's line editing mode. |
protected void |
openLabelEditor(Graph2DView view,
YLabel label,
java.beans.PropertyChangeListener listener,
boolean useSingleLineMode)
Opens the specified view's editor for interactive label text editing. |
protected void |
setText(YLabel label,
java.lang.String text)
Sets the text of the specified label. |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Graph2DViewActions.EditLabelAction()
EditLabelAction
instance that has
no default view, that means if the view cannot be determined from the
event that triggers a delete action, no editor is opened.
Invoking this constructor is equivalent to:
new EditLabelAction(null)
public Graph2DViewActions.EditLabelAction(Graph2DView view)
EditLabelAction
instance.
view
- the default view that is used if the actual view cannot be
determined from the information provided by an ActionEvent
.Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
editLabel
for the view returned by
getView
.
e
- the ActionEvent
that triggers label text editing.getView(java.awt.event.ActionEvent)
,
editLabel(y.view.Graph2DView)
public void editLabel(Graph2DView view)
findLabel(y.view.Graph2DView)
to determine the label to editgetPropertyChangeListener()
isSingleLineModeEnabled()
to determine the editing mode of the
interactive label editoropenLabelEditor(Graph2DView, YLabel, java.beans.PropertyChangeListener, boolean)
Note: The label editor is only opened for labels that are visible in the specified view (i.e. the label's bounds intersect the visible region of the view).
view
- the view in which to delete graph elements.
java.lang.NullPointerException
- if the specified view is null
.findLabel(Graph2DView)
,
openLabelEditor(Graph2DView, YLabel, java.beans.PropertyChangeListener, boolean)
protected java.beans.PropertyChangeListener getPropertyChangeListener()
PropertyChangeListener
that is notified of text
changes when interactive label text editing is done.
By default, null
is returned. To specify a listener use
putValue("PROPERTY_CHANGE_LISTENER", listener);
PropertyChangeListener
that is notified of text
changes when interactive label text editing is done or
null
if no notification is desired.protected boolean isSingleLineModeEnabled()
By default, single line mode is assumed. To activate multiple lines mode, use
putValue("SINGLE_LINE_MODE", Boolean.FALSE);
true
for single line mode and false
for multiple lines mode.protected void openLabelEditor(Graph2DView view, YLabel label, java.beans.PropertyChangeListener listener, boolean useSingleLineMode)
view
- the view in which a label is edited.label
- the label whose text is edited.listener
- a listener that has to be notified of label text changes.
May be null
if no notification is desired.useSingleLineMode
- if true
label editing should be
done in single line mode; otherwise multiple lines mode should be used.getPropertyChangeListener()
,
isSingleLineModeEnabled()
,
Graph2DView.openLabelEditorCentered(YLabel, double, double, java.beans.PropertyChangeListener, boolean, boolean)
protected Graph2DView getView(java.awt.event.ActionEvent e)
e
- the ActionEvent
that triggers label text editing.
actionPerformed(java.awt.event.ActionEvent)
,
Graph2DViewActions.EditLabelAction(y.view.Graph2DView)
protected YLabel findLabel(Graph2DView view)
createNodeLabel
,
createEdgeLabel
,
createRowLabel
,
or
createColumnLabel
).
If there is no selected element, null
is returned.
view
- the view whose graph is searched for a label to edit.
YLabel
instance to edit or null
if no label should be edited.protected EdgeLabel createEdgeLabel(EdgeRealizer realizer)
EdgeLabel
instance and adds the created
instance to the specified realizer.
The default implementation simply returns
realizer.getLabel()
.
realizer
- the owner realizer of the new label.
EdgeLabel
instance.protected NodeLabel createNodeLabel(NodeRealizer realizer)
NodeLabel
instance and adds the created
instance to the specified realizer.
The default implementation simply returns
realizer.getLabel()
.
realizer
- the owner realizer of the new label.
NodeLabel
instance.protected NodeLabel createColumnLabel(TableGroupNodeRealizer realizer, TableGroupNodeRealizer.Column c)
NodeLabel
instance, adds the created
instance to the specified realizer, and associates the instance
to the specified column.
realizer
- the owner realizer of the new label.c
- the column to which the label is associated.
NodeLabel
instance.protected NodeLabel createRowLabel(TableGroupNodeRealizer realizer, TableGroupNodeRealizer.Row r)
NodeLabel
instance, adds the created
instance to the specified realizer, and associates the instance
to the specified row.
realizer
- the owner realizer of the new label.r
- the row to which the label is associated.
NodeLabel
instance.protected void setText(YLabel label, java.lang.String text)
label
- the label whose text content is set.text
- the new text content.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |