Mp3dings 
20100427

de.mospace.swing.text
Class FullTextStringCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by de.mospace.swing.text.FullTextStringCellEditor
All Implemented Interfaces:
Serializable, CellEditor, TableCellEditor

public class FullTextStringCellEditor
extends AbstractCellEditor
implements TableCellEditor

A multiline string editor for JTables. The cell contents are displayed and edited in a text area aligned with the cell's top, left, and right bounds. The text area is displayed in the modal layer above the cell that is edited.

Version:
$Revision: 109 $ ($Date: 2007-11-05 18:33:59 +0100 (Mo, 05 Nov 2007) $)
Author:
Moritz Ringler
See Also:
FullTextString, FullTextStringCellRenderer, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
FullTextStringCellEditor()
          Creates a new FullTextStringCellEditor object.
 
Method Summary
 void cancelCellEditing()
          Closes the editor, notifies the JTable that editing has cancelled, and returns focus to the JTable and the cell that have been edited.
 Object getCellEditorValue()
          Returns the value contained in the editor.
 Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
          Returns the component that should be added to the client's Component hierarchy.
 void setHeight(int i)
          Sets the height for the text-area in which cell contents are edited.
 boolean stopCellEditing()
          Stops editing and returns true to indicate that editing has stopped.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell
 
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, isCellEditable, removeCellEditorListener, shouldSelectCell
 

Constructor Detail

FullTextStringCellEditor

public FullTextStringCellEditor()
Creates a new FullTextStringCellEditor object.

Method Detail

getCellEditorValue

public Object getCellEditorValue()
Returns the value contained in the editor.

Specified by:
getCellEditorValue in interface CellEditor
Returns:
the last edited value as a FullTextString or null for empty or invalid values
See Also:
FullTextString

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Returns the component that should be added to the client's Component hierarchy. Sets an initial value for the editor. This will cause the editor to stopEditing and lose any partially edited value if the editor is editing when this method is called. Once installed in the client's hierarchy the returned component will be able to draw and receive user input.

Specified by:
getTableCellEditorComponent in interface TableCellEditor
Parameters:
table - the JTable that is asking the editor to edit; can be null
value - the value of the cell to be edited, null is a valid value
isSelected - must be true, otherwise null is returned
row - the row of the cell being edited
column - the column of the cell being edited
Returns:
a JButton as the primary cell editor

cancelCellEditing

public void cancelCellEditing()
Closes the editor, notifies the JTable that editing has cancelled, and returns focus to the JTable and the cell that have been edited.

Specified by:
cancelCellEditing in interface CellEditor
Overrides:
cancelCellEditing in class AbstractCellEditor

stopCellEditing

public boolean stopCellEditing()
Stops editing and returns true to indicate that editing has stopped. Closes the editor, notifies the JTable that editing has stopped, and returns focus to the JTable and the cell that has been edited.

Specified by:
stopCellEditing in interface CellEditor
Overrides:
stopCellEditing in class AbstractCellEditor

setHeight

public void setHeight(int i)
Sets the height for the text-area in which cell contents are edited.

Parameters:
i - the new height in pixels, default is 100

Mp3dings 
20100427