@PublicAPI public class MViewPane extends MarvinPane
LicenseHandler lm = LicenseHandler.getInstance(); lm.setLicenseFile(path_to_license_file);
javax.swing.JRootPane.AccessibleJRootPane, javax.swing.JRootPane.RootLayout
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
EDITABLE
Editing mode identifier meaning the structures can be edited with the Edit > Structure menu
or double click and launches MarvinView in a new window.
|
static int |
SKETCHABLE
Editing mode identifier meaning the structures can be edited with the Edit > Structure menu
or double click and launches MarvinSketch in a new window.
|
static int |
VIEW_ONLY
Editing mode identifier meaning the structures cannot be edited.
|
molPanel, params, topLevelContainer, VERSION
COLOR_CHOOSER_DIALOG, contentPane, defaultButton, defaultPressAction, defaultReleaseAction, ERROR_DIALOG, FILE_CHOOSER_DIALOG, FRAME, glassPane, INFORMATION_DIALOG, layeredPane, menuBar, NONE, PLAIN_DIALOG, QUESTION_DIALOG, WARNING_DIALOG
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MViewPane()
Constructs the viewer.
|
MViewPane(UserSettings settings)
Constructs the viewer with the specified user settings.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a
PropertyChangeListener for a specific property. |
void |
applyRotationMatrices()
Applies the rotation part of the viewing transformation matrix on the atom coordinates in all
molecule cells.
|
void |
applyRotationMatrix(int cellIndex)
Applies the rotation part of the viewing transformation matrix on the atom coordinates in the
specified molecule cell.
|
void |
closeSketcher(int index)
Closes the sketcher window that belongs the the specified cell.
|
void |
closeWindow(int index)
Closes the detached viewer window of the specified cell.
|
void |
componentResized(java.awt.event.ComponentEvent event)
Does nothing.
|
void |
destroySketcher()
Closes all detached sketcher windows.
|
void |
doPaste()
Invokes Paste action.
|
int |
getAbsoluteCellIndex(int visibleIndex)
Determines the absolute cell index of a visible cell
|
int |
getAbsoluteCellIndex(javax.swing.JComponent component)
Determines in which cell the specified component is located.
|
java.lang.String |
getAnimated()
Gets index of animated cells of the table (or simple viewer).
|
double |
getAnimDelay()
Gets the repeat delay for animations.
|
double |
getAnimFPS()
Gets the frames per second for animations.
|
boolean |
getAutoTabScale()
Is tab scale automatically changed?
|
double |
getBestTabScale()
Gets the smallest best scale value in the molecule table.
|
double |
getBestTabScale(int i)
Gets the best scale value for a molecule cell.
|
int |
getBorderWidth()
Gets the width of the border between cells.
|
boolean |
getC(int i)
Gets the state of a checkbox in a GridBagView table.
|
javax.swing.JComponent |
getCanvasComponent(int i)
Deprecated.
as of Marvin 3.0, replaced by getVisibleCellComponent
|
int |
getCellCount()
Gets the number of molecule cells in the table.
|
chemaxon.marvin.common.swing.action.CommonActions |
getCommonActions()
Gets the common actions.
|
MDocStorage |
getDocStorage()
Gets the sparse dynamic document storage.
|
MDocument |
getDocument(int i)
Gets the nth document.
|
MDocument[] |
getDocuments()
Gets the array of documents.
|
int |
getEditable()
Returns the mode that determines if the structure is editable.
|
java.awt.Font |
getFieldFont(java.lang.String key)
Gets the font of a named field in a table.
|
java.lang.String |
getL(int i)
Gets a label.
|
Molecule |
getM(int n)
Gets the nth molecule in memory.
|
java.lang.String |
getM(int n,
java.lang.String fmt)
Gets the nth molecule in a text format.
|
chemaxon.marvin.view.swing.ViewPanel |
getMolPanel()
Returns the underlying panel.
|
java.lang.String |
getNavmode()
Gets the mouse drag action.
|
java.awt.Dimension |
getPreferredSize()
Gets the preferred size of the component.
|
java.awt.Color |
getRecordIDBackground(int k)
Gets the highlight color of a record.
|
java.awt.Color |
getRecordIDForeground(int k)
Gets the foreground color of a record.
|
CTransform3D |
getRotationMatrix(int cellIndex)
Gets the rotation part of the transformation matrix.
|
int |
getSelectedIndex()
Gets the index of the molecule that is selected by the user.
|
java.lang.String |
getT(int i)
Gets a text field value in a GridBagView table.
|
TableSupport |
getTableSupport()
Gets an object that helps to build and use a viewer table.
|
double |
getTabScale()
Gets the magnification in the molecule cells.
|
double |
getTabScale(int i)
Gets the magnification for a molecule cell.
|
int |
getTopLeftIndex()
Gets the index of the top left cell.
|
javax.swing.AbstractButton |
getVisibleButtonB(int i)
Gets the i-th button in the visible area of the viewer.
|
javax.swing.AbstractButton |
getVisibleButtonC(int i)
Gets the i-th checkbox in the visible area of the viewer.
|
javax.swing.JComponent |
getVisibleCellComponent(int i)
Gets the canvas of the specified cell in a GridBag layout based table.
|
int |
getVisibleCellCount()
Gets the number of the visible cells in a GridBag layout based table.
|
int |
getVisibleCellIndex(int absoluteIndex)
Determines the visible cell index of a cell
|
double |
getWinScale()
Gets the magnification in the zoom windows.
|
int |
indexOfButtonB(javax.swing.AbstractButton button)
Gets the index of the button on the visible area of the viewer.
|
int |
indexOfButtonC(javax.swing.AbstractButton checkbox)
Gets the index of the checkbox in the visible area of the viewer.
|
boolean |
isAnimated(int index)
Selected cell is animated or not.
|
boolean |
isAnimSync()
Gets the animation synchronization.
|
boolean |
isDetachable()
Gets the detachable property.
|
boolean |
isDraggable()
Determines whether mouse dragged evens are allowed or not.
|
boolean |
isSelectable()
Are the cells selectable?
|
boolean |
isSketchWindowOpened(int index)
Checks whether the molecule from the specified cell is opened in a sketcher window or not.
|
boolean |
isValenceErrorVisibleInView()
Are valence errors highlighted?
|
boolean |
isViewWindowOpened(int index)
Checks whether the view canvas of the specified cell is detached into a separate window or
not.
|
void |
makeEditMenu(java.awt.Container menu)
Adds menu items to the specified Edit menu.
|
void |
makeHelpMenu(java.awt.Container menu)
Deprecated.
As of Marvin 3.4,
MarvinPane.addHelpMenu(java.awt.Container) should be
used. |
void |
makeRecentFileListMenu(java.awt.Container menu)
Read the recent file list from marvin.properties, and add it to the specified parent menu.
|
void |
makeSaveAsMenu(java.awt.Container menu)
Creates the "Save As" menu and adds it to the specified parent menu.
|
void |
makeStructureMenu(java.awt.Container menu) |
javax.swing.JMenu |
makeToolsMenu()
Deprecated.
As of Marvin 3.4,
MarvinPane.addToolsMenu(java.awt.Container) should be
used. |
void |
makeViewMenu(java.awt.Container menu)
Adds menu items to the specified View menu.
|
boolean |
openSketcher(int index)
Opens the sketcher window with the molecule from the specified cell if the viewer is
editable.
|
boolean |
openWindow(int index)
Detaches the view canvas of the specified cell into a separate window if the viewer is
detachable.
|
void |
print()
Prints the molecule table.
|
void |
readExternal(java.io.ObjectInput in)
Restores object state.
|
void |
setActionB(int i,
java.lang.String s)
Sets the action string (URL or JavaScript expression) of a button in a GridBagView table.
|
void |
setActionC(int i,
java.lang.String s)
Sets one of the two action strings (JavaScript expressions) of a checkbox in a GridBagView
table.
|
void |
setAnimated(boolean animated)
Starts or stops animation in each cells of the table or in the simple viewer.
|
void |
setAnimated(int index,
boolean animated)
Sets animation of a cell of the table.
|
void |
setAnimDelay(double delay)
Sets the repeat delay for animations.
|
void |
setAnimFPS(double r)
Sets the frames per second for animations.
|
void |
setAnimSync(boolean sync)
Sets the animation synchronization.
|
boolean |
setAtomSetSeq(int i,
int atom,
int id)
Sets the set sequence number of the atom.
|
void |
setAutoTabScale(boolean a)
Allows or disallows automatic changing of tab scale.
|
void |
setBorderWidth(int w)
Sets the width of the border between cells.
|
void |
setC(int i,
boolean s)
Sets the state of a checkbox in a GridBagView table.
|
void |
setDetachable(boolean b)
Sets the detachable property.
|
void |
setDocument(int i,
MDocument doc)
Sets the document
|
void |
setDraggable(boolean enabled)
Allows or denies mouse dragged events in cells.
|
void |
setEditable(int e)
Sets the mode that determines if the structure is editable.
|
void |
setEnabled(boolean enabled)
Enables or disables this component, depending on the value of the parameter b.
|
void |
setFieldFont(java.lang.String key,
java.awt.Font f)
Sets the font for a named field in a table.
|
void |
setL(int i,
java.lang.String s)
Sets a label in a GridBagView table.
|
void |
setM(int n,
java.io.File f,
java.lang.String opts)
Deprecated.
As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g. by
using
MolImporter , then set the cell synchronously using
setM(int, Molecule...) . The reason is to simplify the public API and
minimize the risk of related concurrency problems in user codes. |
void |
setM(int n,
Molecule... mols)
Sets the nth animation or structure.
|
void |
setM(int n,
java.lang.String s)
Deprecated.
As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g. by
using
MolImporter , then set the cell synchronously using
setM(int, Molecule...) . The reason is to simplify the public API and
minimize the risk of related concurrency problems in user codes. |
void |
setM(int n,
java.lang.String s,
java.lang.String opts)
Deprecated.
As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g. by
using
MolImporter , then set the cell synchronously using
setM(int, Molecule...) . The reason is to simplify the public API and
minimize the risk of related concurrency problems in user codes. |
void |
setNavmode(java.lang.String s)
Sets the mouse drag action.
|
void |
setPreferredSize(java.awt.Dimension sz)
Sets the preferred size of the component.
|
void |
setRecordIDBackground(int k,
java.awt.Color color)
Highlights a record by setting the background of its identifier field.
|
void |
setRecordIDForeground(int k,
java.awt.Color color)
Highlights a record by setting the foreground of its identifier field.
|
void |
setSelectable(boolean v)
Enables the user to select a cell by clicking on it or using the cursor movement keys.
|
void |
setSelectedIndex(int i)
Selects a molecule.
|
boolean |
setSetSeq(int i,
int atom,
int id)
Deprecated.
as of Marvin 3.3, replaced by setAtomSetSeq
|
void |
setT(int i,
java.lang.String s)
Sets a text field in a GridBagView table.
|
void |
setTabScale(double scale)
Sets the magnification in the molecule cells.
|
void |
setTopLeftIndex(int v)
Scrolls to the specified cell.
|
void |
setValenceErrorVisibleInView(boolean v)
Shows or hides valence errors
|
void |
setWinScale(double scale)
Sets the magnification in the zoom windows.
|
void |
writeExternal(java.io.ObjectOutput out)
Saves object state.
|
addActionListener, addHelpMenu, addMenuBarChangeListener, addToolsMenu, arePopupMenusEnabled, beginHourglass, closeWindows, componentHidden, componentMoved, componentShown, createMenu, endHourglass, exit, getAtomNumberingType, getAtomSetColor, getAtomsize, getBallRadius, getBoldBondWidth, getBondLength, getBondSpacing, getBondWidth, getChiralitySupport, getCleanDim, getColorScheme, getDebug, getDirectory, getDispopts, getDownWedge, getFile, getFormat, getImplicitH, getInvisibleSets, getLabels, getLonePairsVisible, getMarginSize, getMolbg, getParameter, getParams, getPopupMenusEnabled, getReadGlobalGUIProperties, getRendering, getResourceBundle, getSaveGlobalGUIProperties, getSetColor, getStickThickness, getTopLevelContainer, getUserSettings, getWireThickness, init, init, initAction, initButton, isAtomMappingVisible, isAtomNumbersVisible, isAtomSymbolsVisible, isBondLengthVisible, isExitCanceled, isExperimentalEnabled, isEzVisible, isGrinv, isGrinvVisible, isMPVisible, isPrintEnabled, isRgroupsVisible, isSaveIniEnabled, isSetColoringEnabled, propertyChange, readDoc, readMol, readResources, removeActionListener, setAtomMappingVisible, setAtomNumberingType, setAtomNumbersVisible, setAtomSetColor, setAtomsize, setAtomSymbolsVisible, setBallRadius, setBoldBondWidth, setBondLength, setBondLengthVisible, setBondSetColor, setBondSpacing, setBondWidth, setChiralitySupport, setCleanDim, setColorScheme, setDebug, setDirectory, setDispopts, setDownWedge, setExperimentalEnabled, setEzVisible, setFile, setFormat, setGlobalGUIProperties, setGrinv, setGrinvVisible, setImplicitH, setInvisibleSets, setLabels, setLonePairsVisible, setMarginSize, setMolbg, setMPVisible, setParams, setPopupMenusEnabled, setPrintEnabled, setRendering, setRgroupsVisible, setSaveIniEnabled, setSetColor, setSetColoringEnabled, setStickThickness, setTopLevelContainer, setUserSettings, setWireThickness, showErrorDialog, showFileDialog, showFileOpenDialog, writeMol
addImpl, addNotify, createContentPane, createGlassPane, createLayeredPane, createRootLayout, getAccessibleContext, getContentPane, getDefaultButton, getGlassPane, getJMenuBar, getLayeredPane, getMenuBar, getUI, getUIClassID, getWindowDecorationStyle, isOptimizedDrawingEnabled, isValidateRoot, paramString, removeNotify, setContentPane, setDefaultButton, setDoubleBuffered, setGlassPane, setJMenuBar, setLayeredPane, setMenuBar, setUI, setWindowDecorationStyle, updateUI
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int VIEW_ONLY
public static final int EDITABLE
public static final int SKETCHABLE
public MViewPane()
chemaxon.license.LicenseException
- if no valid license foundpublic MViewPane(UserSettings settings)
settings
- the user settingschemaxon.license.LicenseException
- if no valid license foundpublic chemaxon.marvin.common.swing.action.CommonActions getCommonActions()
getCommonActions
in class MarvinPane
public void makeSaveAsMenu(java.awt.Container menu)
menu
- the parent menupublic void makeRecentFileListMenu(java.awt.Container menu)
menu
- the parent menupublic void makeEditMenu(java.awt.Container menu)
menu
- the Edit menupublic void makeViewMenu(java.awt.Container menu)
menu
- the View menupublic void makeStructureMenu(java.awt.Container menu)
@Deprecated public javax.swing.JMenu makeToolsMenu()
MarvinPane.addToolsMenu(java.awt.Container)
should be
used.@Deprecated public void makeHelpMenu(java.awt.Container menu)
MarvinPane.addHelpMenu(java.awt.Container)
should be
used.menu
- the Help menupublic TableSupport getTableSupport()
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
PropertyChangeListener
for a specific property. The listener will be
invoked only when a call on firePropertyChange
names that specific property.
If listener is null
, no exception is thrown and no action is performed.
For the list of used properties, please visit MarvinView: parameters and events
addPropertyChangeListener
in class java.awt.Container
propertyName
- the name of the property to listen onlistener
- the PropertyChangeListener
to be addedpublic java.awt.Color getRecordIDBackground(int k)
k
- record indexnull
otherwisepublic void setRecordIDBackground(int k, java.awt.Color color)
k
- record indexcolor
- the highlight color or null
to restore the default colorpublic java.awt.Color getRecordIDForeground(int k)
k
- record indexnull
otherwisepublic void setRecordIDForeground(int k, java.awt.Color color)
k
- record indexcolor
- the highlight color or null
to restore the default color@Deprecated public boolean setSetSeq(int i, int atom, int id)
i
- molecule cell indexatom
- atom indexid
- a number between 0 and 63. 0 is the default set. It contains all atoms that are
not in another set.public int getTopLeftIndex()
public void setTopLeftIndex(int v)
v
- top left cell index@Deprecated public javax.swing.JComponent getCanvasComponent(int i)
public javax.swing.JComponent getVisibleCellComponent(int i)
for (int i = 0; i < viewPane.getVisibleCellCount(); i++) { JComponent comp = viewPane.getVisibleCellComponent(i); comp.addMouseListener(actionListener); comp.add(customPopupMenu); }
Do not refer not visible cells and avoid using of absolute indexes, they can cause false result at scrolling. If you do not know relative index you can do this:
int visibleIndex = viewPane.getVisibleCellIndex(absoluteIndex); if (visibleIndex != -1) { JComponent comp = viewPane.getCanvasComponent(visibleIndex); }
i
- visible index of the cell. If Viewer is not a table, set index to 0.MarvinPane.setPopupMenusEnabled(boolean)
,
getVisibleCellCount()
,
getVisibleCellIndex(int)
public int getVisibleCellCount()
public int getVisibleCellIndex(int absoluteIndex)
absoluteIndex
- absolute index of the cellpublic int getAbsoluteCellIndex(int visibleIndex)
visibleIndex
- relative index of the visible cellpublic int getAbsoluteCellIndex(javax.swing.JComponent component)
component
- canvas specified component where the molecule is displayedpublic java.lang.String getAnimated()
public boolean isAnimated(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- Cell index. (0 for simple viewer).java.lang.ArrayIndexOutOfBoundsException
- index out of range (index < 0 || index >= number of cells)public boolean setAtomSetSeq(int i, int atom, int id)
i
- molecule cell indexatom
- atom indexid
- a number between 0 and 63. 0 is the default set. It contains all atoms that are
not in another set.public void setAnimated(boolean animated)
animated
- True to start animation, false to stop it.public void setAnimated(int index, boolean animated)
index
- Index of specified cell (0 for simple viewer).animated
- True to start animation, false to stop it.public MDocument[] getDocuments()
The size of the array equals to the number of the last non-empty molecule cell.
Note that using this method is not recommended if the input is a molecule file or any kind of
MDocSource
, because it returns null
for non-cached
molecules. The thread-safe way to query molecules in such cases is by creating a record
access task, see TableSupport.scheduler
public MDocStorage getDocStorage()
Note that MDocStorage
should only be used via record access
tasks if the input is an MDocSource
, see
TableSupport.scheduler
.
public Molecule getM(int n)
Note that using this method is not recommended if the input is a molecule file or any kind of
MDocSource
, because it returns null
for non-cached
molecules. The thread-safe way to query molecules in such cases is by creating a record
access task, see TableSupport.scheduler
.
n
- molecule cell number (0 for simple viewer)null
if the record is not in cachepublic void setM(int n, Molecule... mols)
n
- molecule cell number (0 for simple viewer)mols
- the animation sequence or the structurepublic java.lang.String getM(int n, java.lang.String fmt)
For a simple viewer with only one molecule, n must be zero. Nonzero n should only be used if the viewer is a molecule table. The format descriptor string can also contain export options. Format and options are separated by a colon, multiple options can be separated by commas. See the text formats and their options on the File Formats in Marvin page. Examples:
s1 = mview.getM(0, "mol"); s2 = mview.getM(0, "smiles:a-H"); // aromatize and remove Hydrogens
Note that using this method is not recommended if the input is a molecule file or any kind of
MDocSource
, because it returns null
for non-cached
molecules. The thread-safe way to query molecules in such cases is by creating a record
access task, see TableSupport.scheduler
.
n
- molecule cell numberfmt
- the format descriptor string@Deprecated public void setM(int n, java.lang.String s)
MolImporter
, then set the cell synchronously using
setM(int, Molecule...)
. The reason is to simplify the public API and
minimize the risk of related concurrency problems in user codes.@Deprecated public void setM(int n, java.lang.String s, java.lang.String opts)
MolImporter
, then set the cell synchronously using
setM(int, Molecule...)
. The reason is to simplify the public API and
minimize the risk of related concurrency problems in user codes.@Deprecated public void setM(int n, java.io.File f, java.lang.String opts)
MolImporter
, then set the cell synchronously using
setM(int, Molecule...)
. The reason is to simplify the public API and
minimize the risk of related concurrency problems in user codes.public MDocument getDocument(int i)
Note that using this method is not recommended if the input is a molecule file or any kind of
MDocSource
, because it returns null
for non-cached
molecules. The thread-safe way to query molecules in such cases is by creating a record
access task, see TableSupport.scheduler
.
i
- cell indexpublic void setDocument(int i, MDocument doc)
i
- cell number (0 for simple viewer)doc
- the documentpublic java.lang.String getL(int i)
i
- the label indexpublic void setL(int i, java.lang.String s)
i
- the label indexs
- the labelpublic boolean getC(int i)
i
- the checkbox indexpublic void setC(int i, boolean s)
i
- the checkbox indexs
- the statepublic void setActionB(int i, java.lang.String s)
i
- the button indexs
- action stringpublic void setActionC(int i, java.lang.String s)
i
- two times the checkbox index plus 0 for unchecked, 1 for checked states
- action stringpublic java.lang.String getT(int i)
i
- text field indexpublic void setT(int i, java.lang.String s)
i
- text field indexs
- textpublic int getCellCount()
public java.lang.String getNavmode()
public void setNavmode(java.lang.String s)
s
- "translate", "zoom", "rotZ" or "rot3d"public int getEditable()
VIEW_ONLY
(0) if molecules can be viewed only,
EDITABLE
(1) if they are editable with MarvinView,
SKETCHABLE
(2) if they are editable with MarvinSketch.public void setEditable(int e)
VIEW_ONLY
: editing is disabled,
EDITABLE
: editing is enabled and launches MarvinView in a new window,
SKETCHABLE
: editing is enabled and launches MarvinSketch in a new window.
e
- identifier of the modepublic boolean isSelectable()
getSelectedIndex()
,
setSelectedIndex(int)
public void setSelectable(boolean v)
v
- true to enable, false to disable cell selectiongetSelectedIndex()
,
setSelectedIndex(int)
public int getSelectedIndex()
isSelectable()
,
setSelectable(boolean)
public void setSelectedIndex(int i)
i
- the cell index or -1 to unselectisSelectable()
,
setSelectable(boolean)
public int getBorderWidth()
public void setBorderWidth(int w)
w
- the border widthpublic double getAnimFPS()
public void setAnimFPS(double r)
r
- frames per secondpublic double getAnimDelay()
public void setAnimDelay(double delay)
delay
- secondspublic boolean isAnimSync()
public void setAnimSync(boolean sync)
sync
- true to synchronize, false to omit synchronizationpublic double getWinScale()
public void setWinScale(double scale)
scale
- displayed length of a C-C bond in pixelspublic double getTabScale()
public double getTabScale(int i)
i
- the molecule cell indexpublic void setTabScale(double scale)
scale
- displayed length of a C-C bond in pixels, or -1 for automatic scalingpublic double getBestTabScale(int i)
i
- the cell indexpublic double getBestTabScale()
public boolean getAutoTabScale()
public void setAutoTabScale(boolean a)
a
- true to allow, false to disallowpublic void print()
public CTransform3D getRotationMatrix(int cellIndex)
cellIndex
- the molecule cell indexnull
if the specified cell does not existpublic void applyRotationMatrix(int cellIndex)
cellIndex
- the molecule cell indexpublic void applyRotationMatrices()
public boolean openSketcher(int index)
index
- the cell indexgetEditable()
public boolean isViewWindowOpened(int index)
index
- the cell indexpublic boolean isSketchWindowOpened(int index)
index
- the cell indexpublic boolean openWindow(int index)
index
- the cell indexisDetachable()
public void closeWindow(int index)
index
- the cell indexpublic void closeSketcher(int index)
index
- the cell indexpublic void destroySketcher()
public boolean isDetachable()
getEditable()
public void setDetachable(boolean b)
b
- true to allow opening a new window with selected structure. False if it is not
allowed.setEditable(int)
public javax.swing.AbstractButton getVisibleButtonB(int i)
i
- button indexindexOfButtonB(javax.swing.AbstractButton)
public javax.swing.AbstractButton getVisibleButtonC(int i)
i
- checkbox indexindexOfButtonC(javax.swing.AbstractButton)
public int indexOfButtonC(javax.swing.AbstractButton checkbox)
checkbox
- a GUI component which implements a checkbox.getVisibleButtonC(int)
public int indexOfButtonB(javax.swing.AbstractButton button)
button
- a GUI component which implements a button.getVisibleButtonB(int)
public java.awt.Font getFieldFont(java.lang.String key)
key
- the field name or null
to get the default fontpublic void setFieldFont(java.lang.String key, java.awt.Font f)
key
- the field name or null
to set the default fontf
- the fontpublic void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
method
of class MView
, which does implement it.writeExternal
in class MarvinPane
out
- the stream to write the object tojava.io.IOException
- Includes any I/O exceptions that may occurpublic void readExternal(java.io.ObjectInput in) throws java.io.IOException
readExternal
method of
class MView
, which does implement it.readExternal
in class MarvinPane
in
- the stream to read data from in order to restore the objectjava.io.IOException
- if I/O errors occurjava.lang.ClassNotFoundException
- If the class for an object being restored cannot be found.public void setEnabled(boolean enabled)
setEnabled
in class MarvinPane
enabled
- If true, this component is enabled; otherwise this component is disabled.public boolean isDraggable()
public void setDraggable(boolean enabled)
enabled
- True to allow, false to deny.public void doPaste()
doPaste
in class MarvinPane
public boolean isValenceErrorVisibleInView()
public void setValenceErrorVisibleInView(boolean v)
v
- True, underlines atom symbols in case valence errors.public void setPreferredSize(java.awt.Dimension sz)
setPreferredSize
in class javax.swing.JComponent
sz
- the preferred sizepublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void componentResized(java.awt.event.ComponentEvent event)
MarvinPane
componentResized
in interface java.awt.event.ComponentListener
componentResized
in class MarvinPane
event
- the event objectpublic chemaxon.marvin.view.swing.ViewPanel getMolPanel()
MarvinPane
getMolPanel
in class MarvinPane