Class MViewPane
- All Implemented Interfaces:
ComponentListener,ImageObserver,MenuContainer,PropertyChangeListener,Serializable,EventListener,Accessible
- Direct Known Subclasses:
MViewRenderer
LicenseHandler lm = LicenseHandler.getInstance();
lm.setLicenseFile(path_to_license_file);
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JRootPane
JRootPane.AccessibleJRootPane, JRootPane.RootLayoutNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intEditing mode identifier meaning the structures can be edited with the Edit > Structure menu or double click and launches MarvinView in a new window.static final intEditing mode identifier meaning the structures can be edited with the Edit > Structure menu or double click and launches MarvinSketch in a new window.static final intEditing mode identifier meaning the structures cannot be edited.Fields inherited from class chemaxon.marvin.beans.MarvinPane
molPanel, params, topLevelContainer, VERSIONFields inherited from class javax.swing.JRootPane
COLOR_CHOOSER_DIALOG, contentPane, defaultButton, ERROR_DIALOG, FILE_CHOOSER_DIALOG, FRAME, glassPane, INFORMATION_DIALOG, layeredPane, menuBar, NONE, PLAIN_DIALOG, QUESTION_DIALOG, WARNING_DIALOGFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionConstructs the viewer.MViewPane(UserSettings settings) Constructs the viewer with the specified user settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Adds aPropertyChangeListenerfor a specific property.voidApplies the rotation part of the viewing transformation matrix on the atom coordinates in all molecule cells.voidapplyRotationMatrix(int cellIndex) Applies the rotation part of the viewing transformation matrix on the atom coordinates in the specified molecule cell.voidcloseSketcher(int index) Closes the sketcher window that belongs the the specified cell.voidcloseWindow(int index) Closes the detached viewer window of the specified cell.voidcomponentResized(ComponentEvent event) voidCloses all detached sketcher windows.voiddoPaste()Invokes Paste action.intgetAbsoluteCellIndex(int visibleIndex) Determines the absolute cell index of a visible cellintgetAbsoluteCellIndex(JComponent component) Determines in which cell the specified component is located.Gets index of animated cells of the table (or simple viewer).doubleGets the repeat delay for animations.doubleGets the frames per second for animations.booleanIs tab scale automatically changed?doubleGets the smallest best scale value in the molecule table.doublegetBestTabScale(int i) Gets the best scale value for a molecule cell.intGets the width of the border between cells.booleangetC(int i) Gets the state of a checkbox in a GridBagView table.getCanvasComponent(int i) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 3.0, replaced by getVisibleCellComponentintGets the number of molecule cells in the table.chemaxon.marvin.common.swing.action.CommonActionsDeprecated.Gets the sparse dynamic document storage.getDocument(int i) Gets the nth document.Gets the array of documents.intReturns the mode that determines if the structure is editable.getFieldFont(String key) Gets the font of a named field in a table.getL(int i) Gets a label.getM(int n) Gets the nth molecule in memory.Gets the nth molecule in a text format.chemaxon.marvin.view.swing.ViewPanelReturns the underlying panel.Gets the mouse drag action.Gets the preferred size of the component.getRecordIDBackground(int k) Gets the highlight color of a record.getRecordIDForeground(int k) Gets the foreground color of a record.getRotationMatrix(int cellIndex) Gets the rotation part of the transformation matrix.intGets the index of the molecule that is selected by the user.getT(int i) Gets a text field value in a GridBagView table.Gets an object that helps to build and use a viewer table.doubleGets the magnification in the molecule cells.doublegetTabScale(int i) Gets the magnification for a molecule cell.intGets the index of the top left cell.getVisibleButtonB(int i) Gets the i-th button in the visible area of the viewer.getVisibleButtonC(int i) Gets the i-th checkbox in the visible area of the viewer.getVisibleCellComponent(int i) Gets the canvas of the specified cell in a GridBag layout based table.intGets the number of the visible cells in a GridBag layout based table.intgetVisibleCellIndex(int absoluteIndex) Determines the visible cell index of a celldoubleGets the magnification in the zoom windows.intindexOfButtonB(AbstractButton button) Gets the index of the button on the visible area of the viewer.intindexOfButtonC(AbstractButton checkbox) Gets the index of the checkbox in the visible area of the viewer.booleanisAnimated(int index) Selected cell is animated or not.booleanGets the animation synchronization.booleanGets the detachable property.booleanDetermines whether mouse dragged evens are allowed or not.booleanAre the cells selectable?booleanisSketchWindowOpened(int index) Checks whether the molecule from the specified cell is opened in a sketcher window or not.booleanAre valence errors highlighted?booleanisViewWindowOpened(int index) Checks whether the view canvas of the specified cell is detached into a separate window or not.voidmakeEditMenu(Container menu) Adds menu items to the specified Edit menu.voidmakeHelpMenu(Container menu) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 3.4,MarvinPane.addHelpMenu(java.awt.Container)should be used.voidRead the recent file list from marvin.properties, and add it to the specified parent menu.voidmakeSaveAsMenu(Container menu) Creates the "Save As" menu and adds it to the specified parent menu.voidmakeStructureMenu(Container menu) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 3.4,MarvinPane.addToolsMenu(java.awt.Container)should be used.voidmakeViewMenu(Container menu) Adds menu items to the specified View menu.booleanopenSketcher(int index) Opens the sketcher window with the molecule from the specified cell if the viewer is editable.booleanopenWindow(int index) Detaches the view canvas of the specified cell into a separate window if the viewer is detachable.voidprint()Prints the molecule table.voidRestores object state.voidsetActionB(int i, String s) Sets the action string (URL or JavaScript expression) of a button in a GridBagView table.voidsetActionC(int i, String s) Sets one of the two action strings (JavaScript expressions) of a checkbox in a GridBagView table.voidsetAnimated(boolean animated) Starts or stops animation in each cells of the table or in the simple viewer.voidsetAnimated(int index, boolean animated) Sets animation of a cell of the table.voidsetAnimDelay(double delay) Sets the repeat delay for animations.voidsetAnimFPS(double r) Sets the frames per second for animations.voidsetAnimSync(boolean sync) Sets the animation synchronization.booleansetAtomSetSeq(int i, int atom, int id) Sets the set sequence number of the atom.voidsetAutoTabScale(boolean a) Allows or disallows automatic changing of tab scale.voidsetBorderWidth(int w) Sets the width of the border between cells.voidsetC(int i, boolean s) Sets the state of a checkbox in a GridBagView table.voidsetDetachable(boolean b) Sets the detachable property.voidsetDocument(int i, MDocument doc) Sets the documentvoidsetDraggable(boolean enabled) Allows or denies mouse dragged events in cells.voidsetEditable(int e) Sets the mode that determines if the structure is editable.voidsetEnabled(boolean enabled) Enables or disables this component, depending on the value of the parameter b.voidsetFieldFont(String key, Font f) Sets the font for a named field in a table.voidSets a label in a GridBagView table.voidSets the nth animation or structure.voidDeprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g.voidDeprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g.voidDeprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g.voidsetNavmode(String s) Sets the mouse drag action.voidSets the preferred size of the component.voidsetRecordIDBackground(int k, Color color) Highlights a record by setting the background of its identifier field.voidsetRecordIDForeground(int k, Color color) Highlights a record by setting the foreground of its identifier field.voidsetSelectable(boolean v) Enables the user to select a cell by clicking on it or using the cursor movement keys.voidsetSelectedIndex(int i) Selects a molecule.booleansetSetSeq(int i, int atom, int id) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 3.3, replaced by setAtomSetSeqvoidSets a text field in a GridBagView table.voidsetTabScale(double scale) Sets the magnification in the molecule cells.voidsetTopLeftIndex(int v) Scrolls to the specified cell.voidsetValenceErrorVisibleInView(boolean v) Shows or hides valence errorsvoidsetWinScale(double scale) Sets the magnification in the zoom windows.voidSaves object state.Methods inherited from class chemaxon.marvin.beans.MarvinPane
addActionListener, addHelpMenu, addMenuBarChangeListener, addToolsMenu, arePopupMenusEnabled, beginHourglass, closeWindows, componentHidden, componentMoved, componentShown, createMenu, endHourglass, exit, getAtomNumberingType, getAtomSetColor, getAtomsize, getBallRadius, getBoldBondWidth, getBondLength, getBondSpacing, getBondWidth, getChiralitySupport, getCleanDim, getColorScheme, getDebug, getDirectory, getDispopts, getDownWedge, getFile, getFormat, getImplicitH, getInvisibleSets, getLabels, getLonePairsVisible, getMarginSize, getMolbg, getParameter, getParams, getPopupMenusEnabled, getReadGlobalGUIProperties, getRendering, getResourceBundle, getSaveGlobalGUIProperties, getSetColor, getStickThickness, getTopLevelContainer, getUserSettings, getWireThickness, init, init, initAction, initButton, isAtomMappingVisible, isAtomNumbersVisible, isAtomSymbolsVisible, isBondLengthVisible, isExitCanceled, isExperimentalEnabled, isEzVisible, isGrinv, isGrinvVisible, isMPVisible, isPrintEnabled, isRgroupsVisible, isSaveIniEnabled, isSetColoringEnabled, isSgroupDataFormatted, propertyChange, readDoc, readMol, readResources, removeActionListener, setAtomMappingVisible, setAtomNumberingType, setAtomNumbersVisible, setAtomSetColor, setAtomsize, setAtomSymbolsVisible, setBallRadius, setBoldBondWidth, setBondLength, setBondLengthVisible, setBondSetColor, setBondSpacing, setBondWidth, setChiralitySupport, setCleanDim, setColorScheme, setDebug, setDirectory, setDispopts, setDownWedge, setExperimentalEnabled, setEzVisible, setFile, setFormat, setGlobalGUIProperties, setGrinv, setGrinvVisible, setImplicitH, setInvisibleSets, setLabels, setLonePairsVisible, setMarginSize, setMolbg, setMPVisible, setParams, setPopupMenusEnabled, setPrintEnabled, setRendering, setRgroupsVisible, setSaveIniEnabled, setSetColor, setSetColoringEnabled, setSgroupDataFormatted, setStickThickness, setTopLevelContainer, setUserSettings, setWireThickness, showErrorDialog, showFileDialog, showFileOpenDialog, writeMolMethods 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, updateUIMethods 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods 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, transferFocusDownCycle, validate, validateTreeMethods 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
VIEW_ONLY
public static final int VIEW_ONLYEditing mode identifier meaning the structures cannot be edited.- See Also:
-
EDITABLE
public static final int EDITABLEEditing 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:
-
SKETCHABLE
public static final int SKETCHABLEEditing 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:
-
-
Constructor Details
-
MViewPane
public MViewPane()Constructs the viewer.- Throws:
LicenseException- if no valid license found
-
MViewPane
Constructs the viewer with the specified user settings.- Parameters:
settings- the user settings- Throws:
LicenseException- if no valid license found- Since:
- Marvin 3.0
-
-
Method Details
-
getCommonActions
Deprecated.Description copied from class:MarvinPaneGets the common actions. For internal use only.- Overrides:
getCommonActionsin classMarvinPane- Returns:
- the actions
-
makeSaveAsMenu
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
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
Adds menu items to the specified Edit menu.- Parameters:
menu- the Edit menu
-
makeViewMenu
Adds menu items to the specified View menu.- Parameters:
menu- the View menu
-
makeStructureMenu
-
makeToolsMenu
Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 3.4,MarvinPane.addToolsMenu(java.awt.Container)should be used.Makes the Tools menu. -
makeHelpMenu
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void makeHelpMenu(Container menu) Deprecated, for removal: This API element is subject to removal in a future version.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
Gets an object that helps to build and use a viewer table.- Since:
- Marvin 5.2, 02/14/2009
-
addPropertyChangeListener
Adds aPropertyChangeListenerfor a specific property. The listener will be invoked only when a call onfirePropertyChangenames 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:
addPropertyChangeListenerin classContainer- Parameters:
propertyName- the name of the property to listen onlistener- thePropertyChangeListenerto be added
-
getRecordIDBackground
Gets the highlight color of a record.- Parameters:
k- record index- Returns:
- the color if the record is highlighted,
nullotherwise - Since:
- Marvin 5.2, 02/22/2009
-
setRecordIDBackground
Highlights a record by setting the background of its identifier field.- Parameters:
k- record indexcolor- the highlight color ornullto restore the default color- Since:
- Marvin 5.2, 02/22/2009
-
getRecordIDForeground
Gets the foreground color of a record.- Parameters:
k- record index- Returns:
- the color if the record is highlighted,
nullotherwise - Since:
- Marvin 5.2.1, 04/14/2009
-
setRecordIDForeground
Highlights a record by setting the foreground of its identifier field.- Parameters:
k- record indexcolor- the highlight color ornullto restore the default color- Since:
- Marvin 5.2.1, 04/14/2009
-
setSetSeq
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean setSetSeq(int i, int atom, int id) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 3.3, replaced by setAtomSetSeq- Parameters:
i- molecule cell indexatom- atom indexid- a number between 0 and 63. 0 is the default set. It contains all atoms that are not in another set.- 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
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public JComponent getCanvasComponent(int i) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 3.0, replaced by getVisibleCellComponent -
getVisibleCellComponent
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:
-
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
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
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
Selected cell is animated or not.- Parameters:
index- Cell index. (0 for simple viewer).- Returns:
- true if cell is animated, else false.
- Throws:
ArrayIndexOutOfBoundsException- index out of range (index invalid input: '<' 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 indexatom- atom indexid- 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
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 returnsnullfor non-cached molecules. The thread-safe way to query molecules in such cases is by creating a record access task, seeTableSupport.scheduler- Returns:
- the array of molecules
- Since:
- Marvin 4.0, 06/30/2005
-
getDocStorage
Gets the sparse dynamic document storage.Note that
MDocStorageshould only be used via record access tasks if the input is anMDocSource, seeTableSupport.scheduler.- Returns:
- the storage object
- Since:
- Marvin 4.1, 04/17/2006
-
getM
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 returnsnullfor non-cached molecules. The thread-safe way to query molecules in such cases is by creating a record access task, seeTableSupport.scheduler.- Parameters:
n- molecule cell number (0 for simple viewer)- Returns:
- the molecule or
nullif the record is not in cache
-
setM
Sets the nth animation or structure.- Parameters:
n- molecule cell number (0 for simple viewer)mols- the animation sequence or the structure
-
getM
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 returnsnullfor non-cached molecules. The thread-safe way to query molecules in such cases is by creating a record access task, seeTableSupport.scheduler.- Parameters:
n- molecule cell numberfmt- the format descriptor string- Returns:
- the molecule in the specified format
-
setM
Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g. by usingMolImporter, then set the cell synchronously usingsetM(int, Molecule...). The reason is to simplify the public API and minimize the risk of related concurrency problems in user codes. -
setM
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setM(int n, String s, String opts) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g. by usingMolImporter, then set the cell synchronously usingsetM(int, Molecule...). The reason is to simplify the public API and minimize the risk of related concurrency problems in user codes. -
setM
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setM(int n, File f, String opts) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.5, it is recommended to import the molecule in advance, e.g. by usingMolImporter, then set the cell synchronously usingsetM(int, Molecule...). The reason is to simplify the public API and minimize the risk of related concurrency problems in user codes. -
getDocument
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 returnsnullfor non-cached molecules. The thread-safe way to query molecules in such cases is by creating a record access task, seeTableSupport.scheduler.- Parameters:
i- cell index- Returns:
- the document
- Since:
- Marvin 3.4, 06/03/2004
-
setDocument
Sets the document- Parameters:
i- cell number (0 for simple viewer)doc- the document- Since:
- Marvin 3.4, 06/03/2004
-
getL
Gets a label.- Parameters:
i- the label index- Returns:
- the label
-
setL
Sets a label in a GridBagView table.- Parameters:
i- the label indexs- 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 indexs- the state
-
setActionB
Sets the action string (URL or JavaScript expression) of a button in a GridBagView table.- Parameters:
i- the button indexs- action string
-
setActionC
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 states- action string
-
getT
Gets a text field value in a GridBagView table.- Parameters:
i- text field index- Returns:
- text
-
setT
Sets a text field in a GridBagView table.- Parameters:
i- text field indexs- 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
-
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:
-
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
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:
-
setSelectedIndex
public void setSelectedIndex(int i) Selects a molecule.- Parameters:
i- the cell index or -1 to unselect- See Also:
-
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
Gets the rotation part of the transformation matrix.- Parameters:
cellIndex- the molecule cell index- Returns:
- the transformation or
nullif 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:
-
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:
-
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:
-
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:
-
getVisibleButtonB
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:
-
getVisibleButtonC
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
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:
-
indexOfButtonB
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:
-
getFieldFont
Gets the font of a named field in a table.- Parameters:
key- the field name ornullto get the default font- Returns:
- the font
- Since:
- Marvin 5.0, 11/17/2007
-
setFieldFont
Sets the font for a named field in a table.- Parameters:
key- the field name ornullto set the default fontf- the font- Since:
- Marvin 5.0, 11/17/2007
-
writeExternal
Saves object state. For internal use only! This method does not implement the Externalizable interface. It is called by thewriteExternalmethod of classMView, which does implement it.- Overrides:
writeExternalin classMarvinPane- Parameters:
out- the stream to write the object to- Throws:
IOException- Includes any I/O exceptions that may occur- Since:
- Marvin 3.5, 2004/11/02
-
readExternal
Restores object state. For internal use only! This method does not implement the Externalizable interface. It is called by thereadExternalmethod of classMView, which does implement it.- Overrides:
readExternalin classMarvinPane- Parameters:
in- the stream to read data from in order to restore the object- Throws:
IOException- if I/O errors occurClassNotFoundException- 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:
setEnabledin classMarvinPane- 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:
doPastein classMarvinPane- 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
Sets the preferred size of the component.- Overrides:
setPreferredSizein classJComponent- Parameters:
sz- the preferred size- Since:
- Marvin 5.2, 02/15/2009
-
getPreferredSize
Gets the preferred size of the component.- Overrides:
getPreferredSizein classJComponent- Returns:
- the preferred size
- Since:
- Marvin 5.2, 02/15/2009
-
componentResized
- Specified by:
componentResizedin interfaceComponentListener- Overrides:
componentResizedin classMarvinPane
-
getMolPanel
public chemaxon.marvin.view.swing.ViewPanel getMolPanel()Description copied from class:MarvinPaneReturns the underlying panel. For internal use only.- Overrides:
getMolPanelin classMarvinPane- Returns:
- the underlying panel
-