mxGraph 2.5.0.1


com.mxgraph.swing.view
Class mxCellEditor

java.lang.Object
  extended by com.mxgraph.swing.view.mxCellEditor
All Implemented Interfaces:
mxICellEditor

public class mxCellEditor
extends Object
implements mxICellEditor

To control this editor, use mxGraph.invokesStopCellEditing, mxGraph. enterStopsCellEditing and mxGraph.escapeEnabled.


Field Summary
protected  AbstractAction cancelEditingAction
           
static int DEFAULT_MIN_HEIGHT
           
static int DEFAULT_MIN_WIDTH
           
static double DEFAULT_MINIMUM_EDITOR_SCALE
           
protected  Object editingCell
           
protected  JEditorPane editorPane
          Holds the editor for HTML editing.
protected  boolean extractHtmlBody
          Specifies if the text content of the HTML body should be extracted before and after editing for HTML markup.
protected  mxGraphComponent graphComponent
           
protected  double minimumEditorScale
          Defines the minimum scale to be used for the editor.
protected  int minimumHeight
           
protected  int minimumWidth
           
protected  boolean replaceLinefeeds
          Specifies if linefeeds should be replaced with BREAKS before editing, and BREAKS should be replaced with linefeeds after editing.
protected  JScrollPane scrollPane
           
protected  boolean shiftEnterSubmitsText
          Specifies if shift ENTER should submit text if enterStopsCellEditing is true.
protected  JTextArea textArea
          Holds the editor for plain text editing.
protected  AbstractAction textSubmitAction
           
protected  EventObject trigger
           
 
Constructor Summary
mxCellEditor(mxGraphComponent graphComponent)
           
 
Method Summary
protected  void configureActionMaps()
          Installs the keyListener in the textArea and editorPane for handling the enter keystroke and updating the modified state.
 String getCurrentValue()
          Returns the current editing value.
 Object getEditingCell()
          Returns the cell that is currently being edited.
 Component getEditor()
          Returns the current editor or null if no editing is in progress.
 Rectangle getEditorBounds(mxCellState state, double scale)
          Returns the bounds to be used for the editor.
protected  String getInitialValue(mxCellState state, EventObject trigger)
          Gets the initial editing value for the given cell.
 double getMinimumEditorScale()
           
 int getMinimumHeight()
           
 int getMinimumWidth()
           
 boolean isExtractHtmlBody()
          Returns replaceHtmlLinefeeds
protected  boolean isHideLabel(mxCellState state)
           
 boolean isReplaceHtmlLinefeeds()
          Returns replaceHtmlLinefeeds
 boolean isShiftEnterSubmitsText()
          Returns shiftEnterSubmitsText
 void setExtractHtmlBody(boolean value)
          Sets extractHtmlBody
 void setMinimumEditorScale(double minimumEditorScale)
           
 void setMinimumHeight(int minimumHeight)
           
 void setMinimumWidth(int minimumWidth)
           
 void setReplaceHtmlLinefeeds(boolean value)
          Sets replaceHtmlLinefeeds
 void setShiftEnterSubmitsText(boolean value)
          Sets shiftEnterSubmitsText
 void startEditing(Object cell, EventObject evt)
          Starts editing the given cell.
 void stopEditing(boolean cancel)
          Stops the current editing.
protected  boolean useLabelBounds(mxCellState state)
          Returns true if the label bounds of the state should be used for the editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MIN_WIDTH

public static int DEFAULT_MIN_WIDTH

DEFAULT_MIN_HEIGHT

public static int DEFAULT_MIN_HEIGHT

DEFAULT_MINIMUM_EDITOR_SCALE

public static double DEFAULT_MINIMUM_EDITOR_SCALE

graphComponent

protected mxGraphComponent graphComponent

minimumEditorScale

protected double minimumEditorScale
Defines the minimum scale to be used for the editor. Set this to 0 if the font size in the editor


minimumWidth

protected int minimumWidth

minimumHeight

protected int minimumHeight

editingCell

protected transient Object editingCell

trigger

protected transient EventObject trigger

scrollPane

protected transient JScrollPane scrollPane

textArea

protected transient JTextArea textArea
Holds the editor for plain text editing.


editorPane

protected transient JEditorPane editorPane
Holds the editor for HTML editing.


extractHtmlBody

protected boolean extractHtmlBody
Specifies if the text content of the HTML body should be extracted before and after editing for HTML markup. Default is true.


replaceLinefeeds

protected boolean replaceLinefeeds
Specifies if linefeeds should be replaced with BREAKS before editing, and BREAKS should be replaced with linefeeds after editing. This value is ignored if extractHtmlBody is false. Default is true.


shiftEnterSubmitsText

protected boolean shiftEnterSubmitsText
Specifies if shift ENTER should submit text if enterStopsCellEditing is true. Default is false.


cancelEditingAction

protected AbstractAction cancelEditingAction

textSubmitAction

protected AbstractAction textSubmitAction
Constructor Detail

mxCellEditor

public mxCellEditor(mxGraphComponent graphComponent)
Method Detail

isExtractHtmlBody

public boolean isExtractHtmlBody()
Returns replaceHtmlLinefeeds


setExtractHtmlBody

public void setExtractHtmlBody(boolean value)
Sets extractHtmlBody


isReplaceHtmlLinefeeds

public boolean isReplaceHtmlLinefeeds()
Returns replaceHtmlLinefeeds


setReplaceHtmlLinefeeds

public void setReplaceHtmlLinefeeds(boolean value)
Sets replaceHtmlLinefeeds


isShiftEnterSubmitsText

public boolean isShiftEnterSubmitsText()
Returns shiftEnterSubmitsText


setShiftEnterSubmitsText

public void setShiftEnterSubmitsText(boolean value)
Sets shiftEnterSubmitsText


configureActionMaps

protected void configureActionMaps()
Installs the keyListener in the textArea and editorPane for handling the enter keystroke and updating the modified state.


getEditor

public Component getEditor()
Returns the current editor or null if no editing is in progress.


useLabelBounds

protected boolean useLabelBounds(mxCellState state)
Returns true if the label bounds of the state should be used for the editor.


getEditorBounds

public Rectangle getEditorBounds(mxCellState state,
                                 double scale)
Returns the bounds to be used for the editor.


startEditing

public void startEditing(Object cell,
                         EventObject evt)
Description copied from interface: mxICellEditor
Starts editing the given cell.

Specified by:
startEditing in interface mxICellEditor

isHideLabel

protected boolean isHideLabel(mxCellState state)

stopEditing

public void stopEditing(boolean cancel)
Description copied from interface: mxICellEditor
Stops the current editing.

Specified by:
stopEditing in interface mxICellEditor

getInitialValue

protected String getInitialValue(mxCellState state,
                                 EventObject trigger)
Gets the initial editing value for the given cell.


getCurrentValue

public String getCurrentValue()
Returns the current editing value.


getEditingCell

public Object getEditingCell()
Description copied from interface: mxICellEditor
Returns the cell that is currently being edited.

Specified by:
getEditingCell in interface mxICellEditor

getMinimumEditorScale

public double getMinimumEditorScale()
Returns:
the minimumEditorScale

setMinimumEditorScale

public void setMinimumEditorScale(double minimumEditorScale)
Parameters:
minimumEditorScale - the minimumEditorScale to set

getMinimumWidth

public int getMinimumWidth()
Returns:
the minimumWidth

setMinimumWidth

public void setMinimumWidth(int minimumWidth)
Parameters:
minimumWidth - the minimumWidth to set

getMinimumHeight

public int getMinimumHeight()
Returns:
the minimumHeight

setMinimumHeight

public void setMinimumHeight(int minimumHeight)
Parameters:
minimumHeight - the minimumHeight to set

mxGraph 2.5.0.1


Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.