Search this API

y.view.tabular
Class TableLabelEditor

java.lang.Object
  extended by y.view.AbstractMouseInputEditor
      extended by y.view.tabular.TableLabelEditor
All Implemented Interfaces:
MouseInputEditor, MultiplexingNodeEditor.NodeEditor

public class TableLabelEditor
extends AbstractMouseInputEditor

This MultiplexingNodeEditor.NodeEditor can be used to edit the labels of rows and columns of a TableGroupNodeRealizer. An text editor for the label is opened when double clicking on the header of the row or column.

 
Your browser does not support SVG content.

Constructor Summary
TableLabelEditor()
          The default constructor of this class.
 
Method Summary
protected  boolean columnLabelHit(TableGroupNodeRealizer.Column column, double x, double y)
          Determines whether a double mouse click at the specified hit location should start label editing for the specified column.
protected  NodeLabel createLabel(TableGroupNodeRealizer.Column column)
          Creates and returns a new NodeLabel for the given TableGroupNodeRealizer.Column.
protected  NodeLabel createLabel(TableGroupNodeRealizer.Row row)
          Creates and returns a new NodeLabel for the given TableGroupNodeRealizer.Row.
 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.
protected  NodeLabel getLabel(TableGroupNodeRealizer.Column column)
          Returns a NodeLabel for the column.
protected  NodeLabel getLabel(TableGroupNodeRealizer.Row row)
          Returns a NodeLabel for the row.
 boolean isExtendedLabelHitEnabled()
          Returns true if the editor should start label editing for 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 isLabelCreationEnabled()
          Determines whether or not the editor may create new labels for columns or rows that do not have any associated labels.
 boolean isValidStartPosition(double x, double y)
          The given position is considered a valid start position if the header of a TableGroupNodeRealizer.Row or TableGroupNodeRealizer.Column can be found there.
 void mouse2DEventHappened(Mouse2DEvent event)
          Listener-like interface that will be notified of Mouse2DEvents.
protected  boolean rowLabelHit(TableGroupNodeRealizer.Row row, double x, double y)
          Determines whether a double mouse click at the specified hit location should start label editing for the specified row.
 void setContext(Graph2DView view, MultiplexingNodeEditor parent, NodeRealizer realizer)
          Provides context information for the editor.
 void setExtendedLabelHitEnabled(boolean enabled)
          Specifies whether the editor may start label editing for 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 setLabelCreationEnabled(boolean enabled)
          Specifies whether or not the editor may create new labels for columns or rows that do not have any associated labels.
 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
 

Constructor Detail

TableLabelEditor

public TableLabelEditor()
The default constructor of this class.

Method Detail

isValidStartPosition

public boolean isValidStartPosition(double x,
                                    double y)
The given position is considered a valid start position if the header of a TableGroupNodeRealizer.Row or TableGroupNodeRealizer.Column can be found there.

Parameters:
x - The horizontal position.
y - The vertical position.
Returns:
true, if the header of a TableGroupNodeRealizer.Row or TableGroupNodeRealizer.Column can be found at the given coordinates; false otherwise.

columnLabelHit

protected boolean columnLabelHit(TableGroupNodeRealizer.Column column,
                                 double x,
                                 double y)
Determines whether a double mouse click at the specified hit location should start label editing for the specified column.

Parameters:
column - the Column to check.
x - the x-coordinate of the hit location.
y - the y-coordinate of the hit location.
Returns:
true if label editing should be started; false otherwise.

rowLabelHit

protected boolean rowLabelHit(TableGroupNodeRealizer.Row row,
                              double x,
                              double y)
Determines whether a double mouse click at the specified hit location should start label editing for the specified row.

Parameters:
row - the Row to check.
x - the x-coordinate of the hit location.
y - the y-coordinate of the hit location.
Returns:
true if label editing should be started; false otherwise.

getLabel

protected NodeLabel getLabel(TableGroupNodeRealizer.Row row)

Returns a NodeLabel for the row. If there is already a node label for row added to the TableGroupNodeRealizer to which row belongs, it is returned.

Otherwise createLabel(y.view.tabular.TableGroupNodeRealizer.Row) is called so that a new label can be returned.

Parameters:
row - The row to get the node label for.
Returns:
A node label that corresponds to the given row.

getLabel

protected NodeLabel getLabel(TableGroupNodeRealizer.Column column)

Returns a NodeLabel for the column. If there is already a node label for column added to the TableGroupNodeRealizer to which column belongs, it is returned.

Otherwise createLabel(y.view.tabular.TableGroupNodeRealizer.Column) is called so that a new label can be returned.

Parameters:
column - The column to get the node label for.
Returns:
A node label that corresponds to the given column.

createLabel

protected NodeLabel createLabel(TableGroupNodeRealizer.Row row)
Creates and returns a new NodeLabel for the given TableGroupNodeRealizer.Row.

Parameters:
row - The row to create a label for.
Returns:
A new NodeLabel.

createLabel

protected NodeLabel createLabel(TableGroupNodeRealizer.Column column)
Creates and returns a new NodeLabel for the given TableGroupNodeRealizer.Column.

Parameters:
column - The column to create a label for.
Returns:
A new NodeLabel.

isLabelCreationEnabled

public boolean isLabelCreationEnabled()
Determines whether or not the editor may create new labels for columns or rows that do not have any associated labels.

Returns:
true if the editor may create new labels for columns or rows that do not have any associated labels; false otherwise.
See Also:
setLabelCreationEnabled(boolean)

setLabelCreationEnabled

public void setLabelCreationEnabled(boolean enabled)
Specifies whether or not the editor may create new labels for columns or rows that do not have any associated labels.

Parameters:
enabled - true if the editor may create new labels for columns or rows that do not have any associated labels; false otherwise.
See Also:
isLabelCreationEnabled()

isExtendedLabelHitEnabled

public boolean isExtendedLabelHitEnabled()
Returns true if the editor should start label editing for 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 column label editing is only triggered outside of any rows and row label editing is only triggered outside of any columns.

By default, this property is true.

Returns:
true if the editor should start label editing 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.
See Also:
setExtendedLabelHitEnabled(boolean), columnLabelHit(y.view.tabular.TableGroupNodeRealizer.Column, double, double), rowLabelHit(y.view.tabular.TableGroupNodeRealizer.Row, double, double)

setExtendedLabelHitEnabled

public void setExtendedLabelHitEnabled(boolean enabled)
Specifies whether the editor may start label editing for columns and rows that have no children upon hits outside of the column's top inset area or the row's left inset area.

By default, this property is true.

Parameters:
enabled - if true the editor may start label editing 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 label editing.
See Also:
isExtendedLabelHitEnabled(), columnLabelHit(y.view.tabular.TableGroupNodeRealizer.Column, double, double), rowLabelHit(y.view.tabular.TableGroupNodeRealizer.Row, double, double)

startsEditing

public boolean startsEditing(Mouse2DEvent event)
Description copied from interface: MouseInputEditor
This method is used by clients to query whether the given event is deemed as a starting gesture.

Parameters:
event - the event that happened
Returns:
whether the given gesture can be used to start the editing
See Also:
MouseInputEditor.isInterestedInEvents()

mouse2DEventHappened

public void mouse2DEventHappened(Mouse2DEvent event)
Description copied from interface: MouseInputEditor
Listener-like interface that will be notified of Mouse2DEvents.

Parameters:
event - the event that happened
See Also:
MouseInputEditor.isInterestedInEvents()

setContext

public void setContext(Graph2DView view,
                       MultiplexingNodeEditor parent,
                       NodeRealizer realizer)
Description copied from interface: MultiplexingNodeEditor.NodeEditor
Provides context information for the editor.

Specified by:
setContext in interface MultiplexingNodeEditor.NodeEditor
Parameters:
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.

getCursor

public java.awt.Cursor getCursor(Mouse2DEvent event)
Description copied from interface: MultiplexingNodeEditor.NodeEditor
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.

Specified by:
getCursor in interface MultiplexingNodeEditor.NodeEditor
Parameters:
event - The mouse event a cursor can be returned for.
Returns:
A Cursor if a possible action for this mouse event shall be indicated or null.

stopEditing

public void stopEditing()
Description copied from interface: MouseInputEditor
Called by clients to stop the editing process cleanly.

Specified by:
stopEditing in interface MouseInputEditor
Overrides:
stopEditing in class AbstractMouseInputEditor

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.