chemaxon.marvin.beans
Class MViewPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JRootPane
                  extended by chemaxon.marvin.beans.MarvinPane
                      extended by chemaxon.marvin.beans.MViewPane
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
MViewRenderer

public class MViewPane
extends MarvinPane

The MarvinView Bean.

Version:
5.2.5, 08/28/2009
Author:
Peter Csizmadia, Tamas Vertse
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JRootPane
javax.swing.JRootPane.AccessibleJRootPane, javax.swing.JRootPane.RootLayout
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
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.
 
Fields inherited from class chemaxon.marvin.beans.MarvinPane
molPanel, params, topLevelContainer, VERSION
 
Fields inherited from class javax.swing.JRootPane
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
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MViewPane()
          Constructs the viewer.
MViewPane(UserSettings settings)
          Constructs the viewer with the specified user settings.
 
Method Summary
 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 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.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.
 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 m)
          Sets the nth molecule.
 void setM(int n, Molecule[] mols)
          Sets the nth animation.
 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.
 
Methods inherited from class chemaxon.marvin.beans.MarvinPane
addActionListener, addHelpMenu, addMenuBarChangeListener, addToolsMenu, arePopupMenusEnabled, beginHourglass, closeWindows, componentHidden, componentMoved, componentResized, componentShown, createMenu, endHourglass, exit, getAtomNumbersVisible, getAtomSetColor, getAtomsize, getBallRadius, getBondSpacing, getBondWidth, getChiralitySupport, getCleanDim, getColorScheme, getDebug, getDirectory, getDispopts, getDispQuality, getDownWedge, getExplicitH, getFile, getFormat, getImplicitH, getInvisibleSets, getLabels, getLonePairsVisible, getMolbg, getMolPanel, 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, isPrintEnabled, isRgroupsVisible, isSaveIniEnabled, isSetColoringEnabled, keyPressed, keyReleased, keyTyped, propertyChange, readDoc, readMol, readResources, removeActionListener, setAtomMappingVisible, setAtomNumbersVisible, setAtomSetColor, setAtomsize, setAtomSymbolsVisible, setBallRadius, setBondLengthVisible, setBondSetColor, setBondSpacing, setBondWidth, setChiralitySupport, setCleanDim, setColorScheme, setDebug, setDirectory, setDispopts, setDispQuality, setDownWedge, setExperimentalEnabled, setExplicitH, setEzVisible, setFile, setFormat, setGlobalGUIProperties, setGrinv, setGrinvVisible, setImplicitH, setInvisibleSets, setLabels, setLonePairsVisible, setMolbg, setParams, setPopupMenusEnabled, setPrintEnabled, setRendering, setRgroupsVisible, setSaveIniEnabled, setSetColor, setSetColoringEnabled, setStickThickness, setTopLevelContainer, setUserSettings, setWireThickness, showErrorDialog, showFileDialog, showFileOpenDialog, writeMol
 
Methods inherited from class javax.swing.JRootPane
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
 
Methods inherited from class javax.swing.JComponent
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, 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
 
Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VIEW_ONLY

public static final int VIEW_ONLY
Editing mode identifier meaning the structures cannot be edited.

See Also:
Constant Field Values

EDITABLE

public static final 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.

See Also:
Constant Field Values

SKETCHABLE

public static final 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.

See Also:
Constant Field Values
Constructor Detail

MViewPane

public MViewPane()
Constructs the viewer.


MViewPane

public MViewPane(UserSettings settings)
Constructs the viewer with the specified user settings.

Parameters:
settings - the user settings
Since:
Marvin 3.0
Method Detail

getCommonActions

public chemaxon.marvin.common.swing.CommonActions getCommonActions()
Gets the common actions.

Overrides:
getCommonActions in class MarvinPane
Returns:
the actions
Since:
Marvin 5.0, 11/17/2006

makeSaveAsMenu

public void makeSaveAsMenu(java.awt.Container menu)
Creates the "Save As" menu and adds it to the specified parent menu.

Parameters:
menu - the parent menu
Since:
Marvin 4.1, 03/29/2006

makeRecentFileListMenu

public void makeRecentFileListMenu(java.awt.Container menu)
Read the recent file list from marvin.properties, and add it to the specified parent menu.

Parameters:
menu - the parent menu
Since:
Marvin 5.0.2

makeEditMenu

public void makeEditMenu(java.awt.Container menu)
Adds menu items to the specified Edit menu.

Parameters:
menu - the Edit menu

makeViewMenu

public void makeViewMenu(java.awt.Container menu)
Adds menu items to the specified View menu.

Parameters:
menu - the View menu

makeStructureMenu

public void makeStructureMenu(java.awt.Container menu)

makeToolsMenu

public javax.swing.JMenu makeToolsMenu()
Deprecated. As of Marvin 3.4, MarvinPane.addToolsMenu(java.awt.Container) should be used.

Makes the Tools menu.


makeHelpMenu

public void makeHelpMenu(java.awt.Container menu)
Deprecated. As of Marvin 3.4, MarvinPane.addHelpMenu(java.awt.Container) should be used.

Add menu items to the specified Help menu.

Parameters:
menu - the Help menu

getTableSupport

public TableSupport getTableSupport()
Gets an object that helps to build and use a viewer table.

Since:
Marvin 5.2, 02/14/2009

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a 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

Overrides:
addPropertyChangeListener in class java.awt.Container
Parameters:
propertyName - the name of the property to listen on
listener - the PropertyChangeListener to be added

getRecordIDBackground

public java.awt.Color getRecordIDBackground(int k)
Gets the highlight color of a record.

Parameters:
k - record index
Returns:
the color if the record is highlighted, null otherwise
Since:
Marvin 5.2, 02/22/2009

setRecordIDBackground

public void setRecordIDBackground(int k,
                                  java.awt.Color color)
Highlights a record by setting the background of its identifier field.

Parameters:
k - record index
color - the highlight color or null to restore the default color
Since:
Marvin 5.2, 02/22/2009

getRecordIDForeground

public java.awt.Color getRecordIDForeground(int k)
Gets the foreground color of a record.

Parameters:
k - record index
Returns:
the color if the record is highlighted, null otherwise
Since:
Marvin 5.2.1, 04/14/2009

setRecordIDForeground

public void setRecordIDForeground(int k,
                                  java.awt.Color color)
Highlights a record by setting the foreground of its identifier field.

Parameters:
k - record index
color - the highlight color or null to restore the default color
Since:
Marvin 5.2.1, 04/14/2009

setSetSeq

public boolean setSetSeq(int i,
                         int atom,
                         int id)
Deprecated. as of Marvin 3.3, replaced by setAtomSetSeq

Parameters:
i - molecule cell index
atom - atom index
id - a number between 0 and 63. 0 is the default set. It contains all atoms that are not in another set.
Returns:
true if the operation was succesful, false if there is no such molecule or atom
Since:
Marvin 2.9.13

getTopLeftIndex

public int getTopLeftIndex()
Gets the index of the top left cell.

Returns:
the top left cell index
Since:
Marvin 4.1.3, 11/07/2006

setTopLeftIndex

public void setTopLeftIndex(int v)
Scrolls to the specified cell.

Parameters:
v - top left cell index
Since:
Marvin 4.1.3, 11/07/2006

getCanvasComponent

public javax.swing.JComponent getCanvasComponent(int i)
Deprecated. as of Marvin 3.0, replaced by getVisibleCellComponent


getVisibleCellComponent

public javax.swing.JComponent getVisibleCellComponent(int i)
Gets the canvas of the specified cell in a GridBag layout based table. This method is required to add new eventlistener to MarvinView. (E.g.: creating a custom popup menu. ) Example:
 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);
 }
 

Parameters:
i - visible index of the cell. If Viewer is not a table, set index to 0.
Returns:
component of the cell
Since:
Marvin 3.0
See Also:
MarvinPane.setPopupMenusEnabled(boolean), getVisibleCellCount(), getVisibleCellIndex(int)

getVisibleCellCount

public int getVisibleCellCount()
Gets the number of the visible cells in a GridBag layout based table.

Returns:
numbers of the visible cells or 0 in case of another layout
Since:
Marvin 3.0

getVisibleCellIndex

public int getVisibleCellIndex(int absoluteIndex)
Determines the visible cell index of a cell

Parameters:
absoluteIndex - absolute index of the cell
Returns:
relative index of the cell between visible cells or -1, if cell is not visible.
Since:
Marvin 3.0

getAbsoluteCellIndex

public int getAbsoluteCellIndex(int visibleIndex)
Determines the absolute cell index of a visible cell

Parameters:
visibleIndex - relative index of the visible cell
Returns:
absolute index of the cell.
Since:
Marvin 3.0

getAbsoluteCellIndex

public int getAbsoluteCellIndex(javax.swing.JComponent component)
Determines in which cell the specified component is located.

Parameters:
component - canvas specified component where the molecule is displayed
Returns:
absolute cell index of the specified component or -1, if component is not in any cell.
Since:
Marvin 3.0

getAnimated

public java.lang.String getAnimated()
Gets index of animated cells of the table (or simple viewer).

Returns:
List of index of animated cells in String format (separated by ",") or empty string if no cell selected. Returns null, if animation has not been set yet.
Since:
Marvin 2.9.11

isAnimated

public boolean isAnimated(int index)
                   throws java.lang.ArrayIndexOutOfBoundsException
Selected cell is animated or not.

Parameters:
index - Cell index. (0 for simple viewer).
Returns:
true if cell is animated, else false.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index out of range (index < 0 || index >= number of cells)
Since:
Marvin 2.9.11

setAtomSetSeq

public boolean setAtomSetSeq(int i,
                             int atom,
                             int id)
Sets the set sequence number of the atom.

Parameters:
i - molecule cell index
atom - atom index
id - a number between 0 and 63. 0 is the default set. It contains all atoms that are not in another set.
Returns:
true if the operation was succesful, false if there is no such molecule or atom
Since:
Marvin 3.3

setAnimated

public void setAnimated(boolean animated)
Starts or stops animation in each cells of the table or in the simple viewer.

Parameters:
animated - True to start animation, false to stop it.
Since:
Marvin 2.9.11

setAnimated

public void setAnimated(int index,
                        boolean animated)
Sets animation of a cell of the table.

Parameters:
index - Index of specified cell (0 for simple viewer).
animated - True to start animation, false to stop it.
Since:
Marvin 2.9.11

getDocuments

public MDocument[] getDocuments()
Gets the array of documents.

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

Returns:
the array of molecules
Since:
Marvin 4.0, 06/30/2005

getDocStorage

public MDocStorage getDocStorage()
Gets the sparse dynamic document storage.

Note that MDocStorage should only be used via record access tasks if the input is an MDocSource, see TableSupport.scheduler.

Returns:
the storage object
Since:
Marvin 4.1, 04/17/2006

getM

public Molecule getM(int n)
Gets the nth molecule in memory.

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.

Parameters:
n - molecule cell number (0 for simple viewer)
Returns:
the molecule or null if the record is not in cache

setM

public void setM(int n,
                 Molecule m)
Sets the nth molecule.

Parameters:
n - molecule cell number (0 for simple viewer)
m - the molecule

setM

public void setM(int n,
                 Molecule[] mols)
Sets the nth animation.

Parameters:
n - molecule cell number (0 for simple viewer)
mols - the animation sequence

getM

public java.lang.String getM(int n,
                             java.lang.String fmt)
Gets the nth molecule in a text format.

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.

Parameters:
n - molecule cell number
fmt - the format descriptor string
Returns:
the molecule in the specified format

setM

public 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.


setM

public 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.


setM

public 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.


getDocument

public MDocument getDocument(int i)
Gets the nth document.

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.

Parameters:
i - cell index
Returns:
the document
Since:
Marvin 3.4, 06/03/2004

setDocument

public void setDocument(int i,
                        MDocument doc)
Sets the document

Parameters:
i - cell number (0 for simple viewer)
doc - the document
Since:
Marvin 3.4, 06/03/2004

getL

public java.lang.String getL(int i)
Gets a label.

Parameters:
i - the label index
Returns:
the label

setL

public void setL(int i,
                 java.lang.String s)
Sets a label in a GridBagView table.

Parameters:
i - the label index
s - the label

getC

public boolean getC(int i)
Gets the state of a checkbox in a GridBagView table.

Parameters:
i - the checkbox index
Returns:
the state

setC

public void setC(int i,
                 boolean s)
Sets the state of a checkbox in a GridBagView table.

Parameters:
i - the checkbox index
s - the state

setActionB

public void setActionB(int i,
                       java.lang.String s)
Sets the action string (URL or JavaScript expression) of a button in a GridBagView table.

Parameters:
i - the button index
s - action string

setActionC

public void setActionC(int i,
                       java.lang.String s)
Sets one of the two action strings (JavaScript expressions) of a checkbox in a GridBagView table.

Parameters:
i - two times the checkbox index plus 0 for unchecked, 1 for checked state
s - action string

getT

public java.lang.String getT(int i)
Gets a text field value in a GridBagView table.

Parameters:
i - text field index
Returns:
text

setT

public void setT(int i,
                 java.lang.String s)
Sets a text field in a GridBagView table.

Parameters:
i - text field index
s - text

getCellCount

public int getCellCount()
Gets the number of molecule cells in the table. Header cells are not counted.

Returns:
the number of cells, or 1 if the viewer is not a table

getNavmode

public java.lang.String getNavmode()
Gets the mouse drag action.

Returns:
"translate", "zoom", "rotZ" or "rot3d"

setNavmode

public void setNavmode(java.lang.String s)
Sets the mouse drag action.

Parameters:
s - "translate", "zoom", "rotZ" or "rot3d"

getEditable

public int getEditable()
Returns the mode that determines if the structure is editable.

Returns:
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.

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.

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.

Parameters:
e - identifier of the mode

isSelectable

public boolean isSelectable()
Are the cells selectable?

Returns:
true if selectable, false otherwise
See Also:
getSelectedIndex(), setSelectedIndex(int)

setSelectable

public void setSelectable(boolean v)
Enables the user to select a cell by clicking on it or using the cursor movement keys.

Parameters:
v - true to enable, false to disable cell selection
See Also:
getSelectedIndex(), setSelectedIndex(int)

getSelectedIndex

public int getSelectedIndex()
Gets the index of the molecule that is selected by the user.

Returns:
the cell index or -1 if no molecule is selected
See Also:
isSelectable(), setSelectable(boolean)

setSelectedIndex

public void setSelectedIndex(int i)
Selects a molecule.

Parameters:
i - the cell index or -1 to unselect
See Also:
isSelectable(), setSelectable(boolean)

getBorderWidth

public int getBorderWidth()
Gets the width of the border between cells.

Returns:
the border width

setBorderWidth

public void setBorderWidth(int w)
Sets the width of the border between cells.

Parameters:
w - the border width

getAnimFPS

public double getAnimFPS()
Gets the frames per second for animations.

Returns:
frames per second

setAnimFPS

public void setAnimFPS(double r)
Sets the frames per second for animations.

Parameters:
r - frames per second

getAnimDelay

public double getAnimDelay()
Gets the repeat delay for animations.

Returns:
delay in seconds

setAnimDelay

public void setAnimDelay(double delay)
Sets the repeat delay for animations.

Parameters:
delay - seconds

isAnimSync

public boolean isAnimSync()
Gets the animation synchronization. Animations are synchronized if they start at the same time, even if repeated.

Returns:
true if synchronized, false otherwise

setAnimSync

public void setAnimSync(boolean sync)
Sets the animation synchronization.

Parameters:
sync - true to synchronize, false to omit synchronization

getWinScale

public double getWinScale()
Gets the magnification in the zoom windows.

Returns:
displayed length of a C-C bond in pixels

setWinScale

public void setWinScale(double scale)
Sets the magnification in the zoom windows.

Parameters:
scale - displayed length of a C-C bond in pixels

getTabScale

public double getTabScale()
Gets the magnification in the molecule cells.

Returns:
displayed length of a C-C bond in pixels, or -1 if scaling is automatic

getTabScale

public double getTabScale(int i)
Gets the magnification for a molecule cell. The scale that would be used in non-window mode is returned even if the cell is in its own window.

Parameters:
i - the molecule cell index
Returns:
displayed length of a C-C bond in pixels, or -1 if scaling is automatic
Since:
Marvin 2.9.2

setTabScale

public void setTabScale(double scale)
Sets the magnification in the molecule cells.

Parameters:
scale - displayed length of a C-C bond in pixels, or -1 for automatic scaling

getBestTabScale

public double getBestTabScale(int i)
Gets the best scale value for a molecule cell.

Parameters:
i - the cell index
Returns:
displayed length of a C-C bond in pixels
Since:
Marvin 2.9.2

getBestTabScale

public double getBestTabScale()
Gets the smallest best scale value in the molecule table.

Returns:
displayed length of a C-C bond in pixels
Since:
Marvin 2.9.2

getAutoTabScale

public boolean getAutoTabScale()
Is tab scale automatically changed?

Returns:
true if tab scale is automatically changed, false otherwise
Since:
Marvin 2.9.2

setAutoTabScale

public void setAutoTabScale(boolean a)
Allows or disallows automatic changing of tab scale.

Parameters:
a - true to allow, false to disallow

print

public void print()
Prints the molecule table.


getRotationMatrix

public CTransform3D getRotationMatrix(int cellIndex)
Gets the rotation part of the transformation matrix.

Parameters:
cellIndex - the molecule cell index
Returns:
the transformation or null if the specified cell does not exist
Since:
Marvin 5.2.4, 08/09/2009

applyRotationMatrix

public void applyRotationMatrix(int cellIndex)
Applies the rotation part of the viewing transformation matrix on the atom coordinates in the specified molecule cell. The transformation matrix is multiplied by the inverse of the rotation.

Parameters:
cellIndex - the molecule cell index

applyRotationMatrices

public void applyRotationMatrices()
Applies the rotation part of the viewing transformation matrix on the atom coordinates in all molecule cells.


openSketcher

public boolean openSketcher(int index)
Opens the sketcher window with the molecule from the specified cell if the viewer is editable.

Parameters:
index - the cell index
Returns:
True, if opening of the editor window is allowed, else false.
Since:
Marvin 4.1 07/20/2006
See Also:
getEditable()

isViewWindowOpened

public boolean isViewWindowOpened(int index)
Checks whether the view canvas of the specified cell is detached into a separate window or not.

Parameters:
index - the cell index
Returns:
True, if it is in separate window, else false.
Since:
Marvin 5.1.4 12/04/2008

isSketchWindowOpened

public boolean isSketchWindowOpened(int index)
Checks whether the molecule from the specified cell is opened in a sketcher window or not.

Parameters:
index - the cell index
Returns:
True, if it is in a sketcher window, else false.
Since:
Marvin 5.1.4 12/04/2008

openWindow

public boolean openWindow(int index)
Detaches the view canvas of the specified cell into a separate window if the viewer is detachable.

Parameters:
index - the cell index
Returns:
True, if detaching is allowed, else false.
Since:
Marvin 4.1 07/20/2006
See Also:
isDetachable()

closeWindow

public void closeWindow(int index)
Closes the detached viewer window of the specified cell.

Parameters:
index - the cell index
Since:
Marvin 4.1 07/20/2006

closeSketcher

public void closeSketcher(int index)
Closes the sketcher window that belongs the the specified cell.

Parameters:
index - the cell index
Since:
Marvin 5.1.4 Marvin 12/04/2008

destroySketcher

public void destroySketcher()
Closes all detached sketcher windows.

Since:
Marvin 4.1 07/20/2006

isDetachable

public boolean isDetachable()
Gets the detachable property.

Returns:
true if the opening of the selected structure in a separated window is allowed. False if the opening of the window is disabled.
See Also:
getEditable()

setDetachable

public void setDetachable(boolean b)
Sets the detachable property.

Parameters:
b - true to allow opening a new window with selected structure. False if it is not allowed.
See Also:
setEditable(int)

getVisibleButtonB

public javax.swing.AbstractButton getVisibleButtonB(int i)
Gets the i-th button in the visible area of the viewer. This index differs from the absolute index if the viewer is scrollable.

Parameters:
i - button index
Returns:
the GUI component
Since:
Marvin 3.0
See Also:
indexOfButtonB(javax.swing.AbstractButton)

getVisibleButtonC

public javax.swing.AbstractButton getVisibleButtonC(int i)
Gets the i-th checkbox in the visible area of the viewer. This index differs from the absolute index if the viewer is scrollable.

Parameters:
i - checkbox index
Returns:
the GUI component
Since:
Marvin 3.0
See Also:
indexOfButtonC(javax.swing.AbstractButton)

indexOfButtonC

public int indexOfButtonC(javax.swing.AbstractButton checkbox)
Gets the index of the checkbox in the visible area of the viewer.

Parameters:
checkbox - a GUI component which implements a checkbox.
Returns:
index of the checkbox if it is in the visible area of the viewer. Returns -1 if object is not found there.
Since:
Marvin 3.0
See Also:
getVisibleButtonC(int)

indexOfButtonB

public int indexOfButtonB(javax.swing.AbstractButton button)
Gets the index of the button on the visible area of the viewer.

Parameters:
button - a GUI component which implements a button.
Returns:
index of the button if it is in the visible area of the viewer. Returns -1 if object is not found there.
Since:
Marvin 3.0
See Also:
getVisibleButtonB(int)

getFieldFont

public java.awt.Font getFieldFont(java.lang.String key)
Gets the font of a named field in a table.

Parameters:
key - the field name or null to get the default font
Returns:
the font
Since:
Marvin 5.0, 11/17/2007

setFieldFont

public void setFieldFont(java.lang.String key,
                         java.awt.Font f)
Sets the font for a named field in a table.

Parameters:
key - the field name or null to set the default font
f - the font
Since:
Marvin 5.0, 11/17/2007

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Saves object state. For internal use only! This method does not implement the Externalizable interface. It is called by the writeExternal method of class MView, which does implement it.

Overrides:
writeExternal in class MarvinPane
Parameters:
out - the stream to write the object to
Throws:
java.io.IOException - Includes any I/O exceptions that may occur
Since:
Marvin 3.5, 2004/11/02

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Restores object state. For internal use only! This method does not implement the Externalizable interface. It is called by the readExternal method of class MView, which does implement it.

Overrides:
readExternal in class MarvinPane
Parameters:
in - the stream to read data from in order to restore the object
Throws:
java.io.IOException - if I/O errors occur
java.lang.ClassNotFoundException - If the class for an object being restored cannot be found.
Since:
Marvin 3.5, 2004/11/02

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this component, depending on the value of the parameter b. An enabled component can respond to user input and generate events. Components are enabled initially by default. Note: Overwrites MarvinPane.setEnabled(boolean).

Overrides:
setEnabled in class MarvinPane
Parameters:
enabled - If true, this component is enabled; otherwise this component is disabled.
Since:
Marvin 4.1.6

isDraggable

public boolean isDraggable()
Determines whether mouse dragged evens are allowed or not.

Returns:
True to allow, false to deny.
Since:
Marvin 4.1.6

setDraggable

public void setDraggable(boolean enabled)
Allows or denies mouse dragged events in cells.

Parameters:
enabled - True to allow, false to deny.
Since:
Marvin 4.1.6

doPaste

public void doPaste()
Invokes Paste action.

Specified by:
doPaste in class MarvinPane
Since:
Marvin 5.0

isValenceErrorVisibleInView

public boolean isValenceErrorVisibleInView()
Are valence errors highlighted?

Returns:
True, if valence errors are highlighted with underline.
Since:
Marvin 5.0.1

setValenceErrorVisibleInView

public void setValenceErrorVisibleInView(boolean v)
Shows or hides valence errors

Parameters:
v - True, underlines atom symbols in case valence errors.
Since:
Marvin 5.0.1

setPreferredSize

public void setPreferredSize(java.awt.Dimension sz)
Sets the preferred size of the component.

Overrides:
setPreferredSize in class javax.swing.JComponent
Parameters:
sz - the preferred size
Since:
Marvin 5.2, 02/15/2009

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of the component.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
the preferred size
Since:
Marvin 5.2, 02/15/2009