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.ActionListener, 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
implements java.awt.event.ActionListener

The MarvinView Bean.

Version:
5.0, 12/04/2007
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.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 actionPerformed(java.awt.event.ActionEvent ev)
          Handles menu item actions.
 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 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.
 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.
 MDocStorage getDocStorage()
          Gets the sparse dynamic document storage.
 MDocument getDocument(int i)
          Gets the 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.
 java.lang.String getM(int n, java.lang.String fmt)
          Gets the nth molecule in a text format.
 Molecule[][] getMols()
          Deprecated. as of Marvin 4.0, getDocuments() is recommended
 java.lang.String getNavmode()
          Gets the mouse drag action.
 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.
 double getTabScale()
          Gets the magnification in the molecule cells.
 double getTabScale(int i)
          Gets the magnification for a molecule cell.
 chemaxon.marvin.util.ThreadSerializer getThreadSerializer()
          Gets the thread serializer used by the viewer table.
 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 isValenceErrorVisibleInView()
          Are valence errors highlighted?
 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.
 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.
 void setActionC(int i, java.lang.String s)
          Sets one of the two action strings (JavaScript expressions) of a checkbox.
 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.
 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.
 void setM(int n, java.io.File f, java.lang.String opts)
          Starts loading a molecule into the nth cell.
 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)
          Starts loading a molecule into the nth cell.
 void setM(int n, java.lang.String s, java.lang.String opts)
          Starts loading a molecule into the nth cell.
 void setNavmode(java.lang.String s)
          Sets the mouse drag action.
 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.
 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, getCommonActions, 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, 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, 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, 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, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, 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, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, 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

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

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

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Handles menu item actions.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ev - the event object

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

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.

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

getDocStorage

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

Warning! This method is experimental, please do not use it yet.

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

getMols

public Molecule[][] getMols()
Deprecated. as of Marvin 4.0, getDocuments() is recommended

Returns:
the array of molecules
Since:
Marvin 2.8.3

getM

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

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

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
 

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)
Starts loading a molecule into the nth cell. The file format and/or import options can be specified if the second argument is in one of the following forms: "file{options}", "file{format:}", or "file{format:options}". See the text formats and their options on the File Formats in Marvin page. Example: setM(0, dir+fileSeparator+"foo.xyz.gz(gzip:xyz:f1.4C4)");

Parameters:
n - molecule cell number (0 for simple viewer)
s - molecule file contents, URL, or (Unix) filename

setM

public void setM(int n,
                 java.lang.String s,
                 java.lang.String opts)
Starts loading a molecule into the nth cell. The file format and/or import options can be specified if the third argument is in one of the following forms: "options", "format:", or "format:options". See the text formats and their options on the File Formats in Marvin page.

Parameters:
n - molecule cell number (0 for simple viewer)
s - molecule file contents, URL, or (Unix) filename
Since:
Marvin 3.3

setM

public void setM(int n,
                 java.io.File f,
                 java.lang.String opts)
Starts loading a molecule into the nth cell. The file format and/or import options can be specified if the third argument is in one of the following forms: "options", "format:", or "format:options". See the text formats and their options on the File Formats in Marvin page. Example: setM(0, new File(dir, "foo.xyz.gz"), "gzip:xyz:f1.4C4");

Parameters:
n - molecule cell number (0 for simple viewer)
f - molecule file
opts - options or null

getDocument

public MDocument getDocument(int i)
Gets the document.

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.

Parameters:
i - the label index
s - the label

getC

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

Parameters:
i - the checkbox index
Returns:
the state

setC

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

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.

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.

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.

Parameters:
i - text field index
Returns:
text

setT

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

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.


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()

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

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

getThreadSerializer

public chemaxon.marvin.util.ThreadSerializer getThreadSerializer()
Gets the thread serializer used by the viewer table. To prevent multithreading problems when the user scrolls the molecule table, record access operations should be enqueued.

Returns:
the thread serializer
Since:
Marvin 5.0, 12/04/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