|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.zfqjava.swing.cell.AbstractCellEditor
AbstractCellEditor
provides a abstract cell editor,
can be used as JTable
, JTree
cell editor.
Field Summary | |
protected javax.swing.event.ChangeEvent |
changeEvent
|
protected javax.swing.event.EventListenerList |
listenerList
|
protected boolean |
useSelectionColor
True use the selection color when the cell is selected. |
Constructor Summary | |
AbstractCellEditor()
|
Method Summary | |
void |
addCellEditorListener(javax.swing.event.CellEditorListener l)
Adds a CellEditorListener to the listener list. |
void |
cancelCellEditing()
Calls fireEditingCanceled . |
protected abstract void |
commitEdit()
Commits the editing. |
protected void |
fireEditingCanceled()
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireEditingStopped()
Notifies all listeners that have registered interest for notification on this event type. |
javax.swing.event.CellEditorListener[] |
getCellEditorListeners()
Returns an array of all the CellEditorListener s added
to this AbstractCellEditor with addCellEditorListener(). |
java.lang.Object |
getCellEditorValue()
Returns the value contained in the editor. |
CellProvider |
getCellProvider()
Returns the cell provider to add extra info for current editor. |
abstract java.awt.Component |
getComponent()
Returns the component for this editor. |
java.awt.Component |
getListCellEditorComponent(javax.swing.JList list,
java.lang.Object value,
int index,
boolean isSelected)
Sets an initial value for the editor. |
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Sets an initial value for the editor. |
java.awt.Component |
getTreeCellEditorComponent(javax.swing.JTree tree,
java.lang.Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
Sets an initial value for the editor. |
protected abstract java.lang.Object |
getValue()
Returns the value for current editor |
boolean |
isCellEditable(java.util.EventObject e)
Returns true. |
void |
removeCellEditorListener(javax.swing.event.CellEditorListener l)
Removes a CellEditorListener from the listener list. |
void |
setCellProvider(CellProvider provider)
Sets the cell provider to add extra info for current editor. |
protected abstract void |
setValue(java.lang.Object value)
Sets the value for current editor. |
boolean |
shouldSelectCell(java.util.EventObject anEvent)
Returns true. |
boolean |
stopCellEditing()
Calls fireEditingStopped and returns true. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean useSelectionColor
false
.protected javax.swing.event.EventListenerList listenerList
protected transient javax.swing.event.ChangeEvent changeEvent
Constructor Detail |
public AbstractCellEditor()
Method Detail |
public java.awt.Component getListCellEditorComponent(javax.swing.JList list, java.lang.Object value, int index, boolean isSelected)
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.
Returns the component that should be added to the client's
Component
hierarchy. Once installed in the client's
hierarchy this component will then be able to draw and receive
user input.
list
- the JList
that is asking the
editor to edit; can be null
The JList we're painting.value
- The value returned by list.getModel().getElementAt(index).index
- The cells index.isSelected
- True if the specified cell was selected.public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
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.
Returns the component that should be added to the client's
Component
hierarchy. Once installed in the client's
hierarchy this component will then be able to draw and receive
user input.
getTableCellEditorComponent
in interface javax.swing.table.TableCellEditor
table
- the JTable
that is asking the
editor to edit; can be null
value
- the value of the cell to be edited; it is
up to the specific editor to interpret
and draw the value. For example, if value is
the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null
is a valid valueisSelected
- true if the cell is to be rendered with
highlightingrow
- the row of the cell being editedcolumn
- the column of the cell being editedpublic java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
Returns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input.
getTreeCellEditorComponent
in interface javax.swing.tree.TreeCellEditor
tree
- the JTree that is asking the editor to edit;
this parameter can be nullvalue
- the value of the cell to be editedisSelected
- true is the cell is to be renderer with
selection highlightingexpanded
- true if the node is expandedleaf
- true if the node is a leaf noderow
- the row index of the node being editedpublic void setCellProvider(CellProvider provider)
provider
- the cell providergetCellProvider()
public CellProvider getCellProvider()
setCellProvider(com.zfqjava.swing.cell.CellProvider)
public abstract java.awt.Component getComponent()
protected abstract void setValue(java.lang.Object value)
value
- the value to editorprotected abstract java.lang.Object getValue()
protected abstract void commitEdit() throws java.text.ParseException
stopCellEditing()
, if
cannot commit current editing, should throws exception.java.text.ParseException
- if cannot commit the editingpublic java.lang.Object getCellEditorValue()
getCellEditorValue
in interface javax.swing.CellEditor
public boolean isCellEditable(java.util.EventObject e)
isCellEditable
in interface javax.swing.CellEditor
e
- an event objectpublic boolean shouldSelectCell(java.util.EventObject anEvent)
shouldSelectCell
in interface javax.swing.CellEditor
e
- an event objectpublic boolean stopCellEditing()
fireEditingStopped
and returns true.stopCellEditing
in interface javax.swing.CellEditor
public void cancelCellEditing()
fireEditingCanceled
.cancelCellEditing
in interface javax.swing.CellEditor
public void addCellEditorListener(javax.swing.event.CellEditorListener l)
CellEditorListener
to the listener list.addCellEditorListener
in interface javax.swing.CellEditor
l
- the new listener to be addedpublic void removeCellEditorListener(javax.swing.event.CellEditorListener l)
CellEditorListener
from the listener list.removeCellEditorListener
in interface javax.swing.CellEditor
l
- the listener to be removedpublic javax.swing.event.CellEditorListener[] getCellEditorListeners()
CellEditorListener
s added
to this AbstractCellEditor with addCellEditorListener().CellEditorListener
s added or an empty
array if no listeners have been addedprotected void fireEditingStopped()
EventListenerList
protected void fireEditingCanceled()
EventListenerList
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |