|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.AbstractCellEditor
chemaxon.marvin.beans.MViewEditor
public class MViewEditor
MViewEditor is an implementation of AbstractCellEditor and TableCellEditor that can be used to assign a cell editor to Molecule objects in JTables.
Using MViewPane as a cell editor provides two major advantages.
| Field Summary |
|---|
| Fields inherited from class javax.swing.AbstractCellEditor |
|---|
changeEvent, listenerList |
| Constructor Summary | |
|---|---|
MViewEditor()
Creates the cell editor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getCellEditorValue()
Returns the edited molecule that is a Molecule instance. |
int |
getEditable()
Returns the mode that determines if the structure is editable. |
MViewPane |
getEditorComponent()
Returns the editor component. |
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Sets up the editor component. |
protected void |
setBackgroundColor(javax.swing.JTable table,
MViewPane mviewPane,
boolean isSelected,
int row,
int column)
Sets the background color for the current cell based on selection. |
protected void |
setBorder(javax.swing.JTable table,
MViewPane mviewPane,
boolean isSelected,
int row,
int column)
Sets the border for the current cell based on selection. |
void |
setEditable(int e)
Sets the mode that determines if the structure is editable. |
| Methods inherited from class javax.swing.AbstractCellEditor |
|---|
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing |
| 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, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing |
| Constructor Detail |
|---|
public MViewEditor()
table.setDefaultEditor(Molecule.class, new MViewEditor());
| Method Detail |
|---|
public MViewPane getEditorComponent()
MViewPane editor componentpublic int getEditable()
MViewPane.VIEW_ONLY if molecules can be viewed only,
MViewPane.EDITABLE if they are editable with MarvinView,
MViewPane.SKETCHABLE if they are editable with MarvinSketch.public void setEditable(int e)
MViewPane.VIEW_ONLY: editing is disabled,
MViewPane.EDITABLE: editing is enabled
and launches MarvinView in a new window,
MViewPane.SKETCHABLE: editing is enabled
and launches MarvinSketch in a new window.
e - identifier of the modepublic java.lang.Object getCellEditorValue()
Molecule instance.
getCellEditorValue in interface javax.swing.CellEditor
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
getTableCellEditorComponent in interface javax.swing.table.TableCellEditortable - the JTable that is asking the
editor to edit; can be nullvalue - the value of the cell to be edited; it is
considered to be a Molecule instance;
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 edited
protected void setBackgroundColor(javax.swing.JTable table,
MViewPane mviewPane,
boolean isSelected,
int row,
int column)
getTableCellEditorComponent(
javax.swing.JTable, Object, boolean, int, int),
overwrite to change the default behavior.
table - the JTable that is asking the
editor to edit; can be nullmviewPane - the editor componentisSelected - true if the cell is to be rendered with the
selection highlighted; otherwise falserow - the row of the cell being editedcolumn - the column of the cell being edited
protected void setBorder(javax.swing.JTable table,
MViewPane mviewPane,
boolean isSelected,
int row,
int column)
getTableCellEditorComponent(
javax.swing.JTable, Object, boolean, int, int),
overwrite to change the default behavior.
table - the JTable that is asking the
editor to edit; can be nullmviewPane - the editor componentisSelected - true if the cell is to be rendered with the
selection highlighted; otherwise falserow - the row of the cell being editedcolumn - the column of the cell being edited
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||