org.geotools.gui.swing.legend
Class LegendTreeCellNameEditor

java.lang.Object
  extended byjavax.swing.AbstractCellEditor
      extended byorg.geotools.gui.swing.legend.LegendTreeCellNameEditor
All Implemented Interfaces:
java.awt.event.ActionListener, javax.swing.CellEditor, java.util.EventListener, java.io.Serializable, javax.swing.tree.TreeCellEditor

public class LegendTreeCellNameEditor
extends javax.swing.AbstractCellEditor
implements javax.swing.tree.TreeCellEditor, java.awt.event.ActionListener

A TreeCellEditor to edit every legend node name by trible click, since double click will open a node.

Author:
jianhuij
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
LegendTreeCellNameEditor(Legend legend)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void cancelCellEditing()
          Cancels editing.
 java.lang.Object getCellEditorValue()
           
 int getClickCountToStart()
          Returns the number of clicks needed to start editing.
 java.awt.Component getComponent()
          Returns a reference to the editor component.
 java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
           
 boolean isCellEditable(java.util.EventObject anEvent)
          Returns true if anEvent is not a MouseEvent.
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 void setValue(java.lang.Object value)
           
 boolean shouldSelectCell(java.util.EventObject anEvent)
          Returns true to indicate that the editing cell may be selected.
 boolean startCellEditing(java.util.EventObject anEvent)
          Returns true to indicate that editing has begun.
 boolean stopCellEditing()
          Stops editing and returns true to indicate that editing has stopped.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, removeCellEditorListener
 

Constructor Detail

LegendTreeCellNameEditor

public LegendTreeCellNameEditor(Legend legend)
Method Detail

getComponent

public java.awt.Component getComponent()
Returns a reference to the editor component.

Returns:
the editor Component

getTreeCellEditorComponent

public java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree,
                                                     java.lang.Object value,
                                                     boolean isSelected,
                                                     boolean expanded,
                                                     boolean leaf,
                                                     int row)
Specified by:
getTreeCellEditorComponent in interface javax.swing.tree.TreeCellEditor

setValue

public void setValue(java.lang.Object value)

isCellEditable

public boolean isCellEditable(java.util.EventObject anEvent)
Returns true if anEvent is not a MouseEvent. Otherwise, it returns true if the necessary number of clicks have occurred, and returns false otherwise.

Specified by:
isCellEditable in interface javax.swing.CellEditor
Parameters:
anEvent - the event
Returns:
true if cell is ready for editing, false otherwise
See Also:
setClickCountToStart(int), shouldSelectCell(java.util.EventObject)

getCellEditorValue

public java.lang.Object getCellEditorValue()
Specified by:
getCellEditorValue in interface javax.swing.CellEditor

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.

Parameters:
count - an int specifying the number of clicks needed to start editing
See Also:
getClickCountToStart()

getClickCountToStart

public int getClickCountToStart()
Returns the number of clicks needed to start editing.

Returns:
the number of clicks needed to start editing

shouldSelectCell

public boolean shouldSelectCell(java.util.EventObject anEvent)
Returns true to indicate that the editing cell may be selected.

Specified by:
shouldSelectCell in interface javax.swing.CellEditor
Parameters:
anEvent - the event
Returns:
true
See Also:
isCellEditable(java.util.EventObject)

startCellEditing

public boolean startCellEditing(java.util.EventObject anEvent)
Returns true to indicate that editing has begun.

Parameters:
anEvent - the event
Returns:
DOCUMENT ME!

stopCellEditing

public boolean stopCellEditing()
Stops editing and returns true to indicate that editing has stopped. This method calls fireEditingStopped.

Specified by:
stopCellEditing in interface javax.swing.CellEditor
Returns:
true

cancelCellEditing

public void cancelCellEditing()
Cancels editing. This method calls fireEditingCanceled.

Specified by:
cancelCellEditing in interface javax.swing.CellEditor

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener


Copyright © GeoTools. All Rights Reserved.