chemaxon.marvin.beans
Class MViewEditor
java.lang.Object
javax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
chemaxon.marvin.beans.MViewEditor
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor
public class MViewEditor
- extends javax.swing.DefaultCellEditor
MViewEditor is a DefaultCellEditor component that can be used to assign cell
editor to Molecule objects in JTables.
Using MViewPane as a cell editor provides two major advantages.
- It offers many functionalities that modify the visualization but not
the structure itself, for example rotation, zoom, display and color schemas,
or the dimension in which the structure is shown.
- It can also be used as an indirect cell editor. Double clicking on the
MViewPane cell editor brings up MarvinSketch, in which the structure
can be modified. After MarvinSketch is closed, the molecule is updated.
Example of usage:
http://www.chemaxon.com/marvin/examples/beans/view-jtable/index.html
- Since:
- Marvin 5.1.2
- Version:
- 5.1.2 2008.08.21.
- Author:
- Peter Csizmadia, Judit Vasko-Szedlar
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor |
javax.swing.DefaultCellEditor.EditorDelegate |
| Fields inherited from class javax.swing.DefaultCellEditor |
clickCountToStart, delegate, editorComponent |
| Fields inherited from class javax.swing.AbstractCellEditor |
changeEvent, listenerList |
|
Constructor Summary |
MViewEditor()
Creates the cell editor. |
| Methods inherited from class javax.swing.DefaultCellEditor |
cancelCellEditing, getClickCountToStart, getComponent, getTreeCellEditorComponent, isCellEditable, setClickCountToStart, shouldSelectCell, stopCellEditing |
| Methods inherited from class javax.swing.AbstractCellEditor |
addCellEditorListener, fireEditingCanceled, 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 |
| Methods inherited from interface javax.swing.CellEditor |
addCellEditorListener, removeCellEditorListener |
MViewEditor
public MViewEditor()
- Creates the cell editor. It can be assigned to JTables for example with
table.setDefaultEditor(Molecule.class, new MViewEditor());
getEditorComponent
public MViewPane getEditorComponent()
- Returns the reference to the editor component.
- Returns:
- the editor component as
MViewPane
getEditable
public int getEditable()
- Returns the mode that determines if the structure is editable.
- Returns:
MViewPane.VIEW_ONLY (0) if molecules can be viewed only,
MViewPane.EDITABLE (1) if they are editable with MarvinView,
MViewPane.SKETCHABLE (2) if they are editable with MarvinSketch.
setEditable
public void setEditable(int e)
- Sets the mode that determines if the structure is editable.
If the structure is allowed to be edited, the Edit > Structure menu or the double
mouse click performs the editing.
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.
- Parameters:
e - identifier of the mode
fireEditingStopped
protected void fireEditingStopped()
- Overrides:
fireEditingStopped in class javax.swing.AbstractCellEditor
getCellEditorValue
public java.lang.Object getCellEditorValue()
- Returns the edited molecule that is a
Molecule instance.
- Specified by:
getCellEditorValue in interface javax.swing.CellEditor- Overrides:
getCellEditorValue in class javax.swing.DefaultCellEditor
getTableCellEditorComponent
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
- Sets up the editor component.
- Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor- Overrides:
getTableCellEditorComponent in class javax.swing.DefaultCellEditor
- Parameters:
table - 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
- Returns:
- the component for editing