chemaxon.marvin.beans
Class MSketchPane

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

public class MSketchPane
extends MarvinPane

The MarvinSketch Bean.

Version:
5.0.2, 02/29/2008
Author:
Peter Csizmadia, Tamas Vertse, Szilveszter Juhos
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 SM_ATOM
          Atom mode.
static int SM_BOND
          Bond mode.
static int SM_DELETE
          Delete mode.
static int SM_FLAGS_OFF
          Offset of flags in sketch mode.
static int SM_MASK
          Sketch mode mask.
static int SM_SELECT
          Select mode.
 
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
MSketchPane()
          Constructs the sketcher.
MSketchPane(UserSettings settings)
          Constructs the sketcher with the specified user settings object.
MSketchPane(UserSettings settings, boolean loadtmpl)
          Constructs the sketcher with the specified user settings object.
 
Method Summary
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener for a specific property.
 void clearHistory()
          Reset undo queue.
 void doPaste()
          Invokes Paste action.
 boolean getAutoScale()
          Returns autoscale property.
 double[] getBoundRectSize()
          Gets the size of the bounding rectangle.
 javax.swing.JComponent getCanvasComponent()
          Determines canvas component of MarvinSketch.
static double getDefaultScale()
          Returns the default scale factor which is equivalent to 100% magnification.
 MDocument getDocument()
          Gets the document.
 java.awt.Image getImage(java.awt.Dimension size)
          Gets the canvas contents as an image scaled to fit in the specified rectangle.
 java.awt.Image getImage(double scale)
          Gets the canvas contents as an image using a scale factor.
 double getMag()
          Deprecated. As of Marvin 2.8.1, replaced by getScale()
 double getMergedst()
          Gets the merge distance.
 Molecule getMol()
          Returns the clone of the current molecule being on the canvas.
 java.lang.String getMol(java.lang.String fmt)
          Gets the molecule in a text format.
 java.lang.String getMrvWithSettings()
          Gets the molecule in the sketcher with its current settings in MRV format.
 java.lang.Object getObjectAtPointer()
          Get the object at the mouse pointer.
 java.lang.String getPiece(java.lang.String fmt)
          Gets the current molecule piece in the specified format.
 boolean getReactionSupport()
          Is reaction drawing supported?
 double getScale()
          Returns the scale factor of the current magnification.
 Molecule getSelection()
          Gets a clone of the selection.
 int getSimpView()
          Deprecated. as of Marvin 3.5, replaced by isBondDraggedAlong()
 int getSketchMode()
          Gets the sketching mode.
 double getStickdst()
          Gets the sticking distance.
 int getUndo()
          Gets the maximum undo depth.
 boolean isBondDraggedAlong()
          Is the currently used bond shown at the mouse cursor?
 boolean isCloseEnabled()
          Determines if the File->Close menu item is enabled or not.
 boolean isConfirmExit()
          Gets whether the confirmation dialog will be appear or not by exit.
 boolean isLoadedMolModified()
          Determines whether the original molecule that is loaded in is modified or not.
 boolean isReactionErrorVisible()
          Are reaction errors highlighted?
 boolean isValenceErrorVisible()
          Are valence errors highlighted?
 void propertyChange(java.beans.PropertyChangeEvent ev)
          Handles property change events.
 void readExternal(java.io.ObjectInput in)
          Restores object state.
 void redo()
          Invokes a redo command.
 void setAutoScale(boolean as)
          Sets the autoscale property.
 void setBondDraggedAlong(boolean v)
          Sets the visibility of the currently used bond at the mouse cursor.
 void setCloseEnabled(boolean b)
          Set the accessibility of the Close menu item in the File menu.
 void setConfirmExit(boolean b)
          Sets to drop confirmation dialog about exit or not.
 void setDocument(MDocument doc)
          Sets the document.
 void setMag(double m)
          Deprecated. As of Marvin 2.8.1, replaced by setScale()
 void setMergedst(double d)
          Sets the merge distance.
 void setMol(java.io.File f, java.lang.String opts)
          Sets the molecule.
 void setMol(Molecule m)
          Sets the molecule.
 void setMol(Molecule m, boolean init)
          Sets the molecule.
 void setMol(java.lang.String s)
          Starts loading a molecule into the sketcher.
 void setMol(java.lang.String s, java.lang.String opts)
          Starts loading a molecule into the sketcher.
 void setMrvWithSettings(java.lang.String mrvsource)
          Sets the molecule and its display settings.
 void setPiece(java.lang.String s)
          Sets the molecule piece.
 void setReactionErrorVisible(boolean v)
          Shows or hides reaction errors
 void setReactionSupport(boolean v)
          Allows or disallows reaction drawing.
 void setScale(double m)
          Sets the scale factor and changes magnification of the canvas.
 void setSimpView(int v)
          Deprecated. as of Marvin 3.5, replaced by setBondDraggedAlong(boolean)
 void setSketchMode(int mode)
          Sets the sketching mode.
 void setStickdst(double d)
          Sets the sticking distance.
 void setUndo(int u)
          Sets the maximum undo depth.
 void setValenceErrorVisible(boolean v)
          Shows or hides valence errors
 void undo()
          Invokes an undo command.
 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, readDoc, readMol, readResources, removeActionListener, setAtomMappingVisible, setAtomNumbersVisible, setAtomSetColor, setAtomsize, setAtomSymbolsVisible, setBallRadius, setBondLengthVisible, setBondSetColor, setBondSpacing, setBondWidth, setChiralitySupport, setCleanDim, setColorScheme, setDebug, setDirectory, setDispopts, setDispQuality, setDownWedge, setEnabled, 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

SM_SELECT

public static final int SM_SELECT
Select mode.

Since:
4.0, 02/17/2004
See Also:
Constant Field Values

SM_DELETE

public static final int SM_DELETE
Delete mode.

Since:
4.0, 02/17/2004
See Also:
Constant Field Values

SM_ATOM

public static final int SM_ATOM
Atom mode. Additional flags must be used to specify the element type. Example:
 setSketchMode(MSketchPane.SM_Atom | (6 << MSketchPane.SM_FLAGS_OFF));
 

Since:
4.0, 02/17/2004
See Also:
Constant Field Values

SM_BOND

public static final int SM_BOND
Bond mode. Additional flags must be used to specify the bond type. Example:
 setSketchMode(MSketchPane.SM_BOND | (1 << MSketchPane.SM_FLAGS_OFF));
 

Since:
4.0, 02/17/2004
See Also:
Constant Field Values

SM_MASK

public static final int SM_MASK
Sketch mode mask.

Since:
4.0, 02/17/2004
See Also:
Constant Field Values

SM_FLAGS_OFF

public static final int SM_FLAGS_OFF
Offset of flags in sketch mode.

Since:
4.0, 02/17/2004
See Also:
Constant Field Values
Constructor Detail

MSketchPane

public MSketchPane()
Constructs the sketcher.


MSketchPane

public MSketchPane(UserSettings settings)
Constructs the sketcher with the specified user settings object.

Parameters:
settings - the user settings
Since:
Marvin 3.0

MSketchPane

public MSketchPane(UserSettings settings,
                   boolean loadtmpl)
Constructs the sketcher with the specified user settings object.

Parameters:
settings - the user settings
loadtmpl - load template structures and abbreviated groups immediately (true) or not (false)
Since:
Marvin 3.4.2
Method Detail

getCanvasComponent

public javax.swing.JComponent getCanvasComponent()
Determines canvas component of MarvinSketch. This method is required to add new eventlistener to MarvinSketch. (e.g.: getCanvasComponent().addMouseListener(actionListener); This method is required for creating a custom popup menu.)

Returns:
Canvas component of MarvinSketch.
Since:
Marvin 2.9.12
See Also:
MarvinPane.setPopupMenusEnabled(boolean)

setAutoScale

public void setAutoScale(boolean as)
Sets the autoscale property. If autoscale is true the molecule is sized to fit on the molecule panel.

Parameters:
as - set to true to enable autoscale

getAutoScale

public boolean getAutoScale()
Returns autoscale property.

Returns:
true, if autoscale is enabled

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent ev)
Handles property change events.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class MarvinPane
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.

MarvinSketch: 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

getMol

public Molecule getMol()
Returns the clone of the current molecule being on the canvas. In case this molecule is changed, it will not affect the content of the canvas.

Returns:
the molecule

getMol

public java.lang.String getMol(java.lang.String fmt)
Gets the molecule in a text format. 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 = msketch.getMol("mol");
 s2 = msketch.getMol("smiles:a-H"); // aromatize and remove Hydrogens
 

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

setMol

public void setMol(Molecule m)
Sets the molecule. Initialization is always performed.

Parameters:
m - the molecule

setMol

public void setMol(Molecule m,
                   boolean init)
Sets the molecule.

Parameters:
m - the molecule
init - set this to false if initialization is not needed

setMol

public void setMol(java.lang.String s)
Starts loading a molecule into the sketcher. The argument can be a molecule in text format, or a reference/URL to a molecule file. The file format and/or import options can be specified if the 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.
Examples:
setMol(dir+fileSeparator+"foo.xyz.gz{gzip:xyz:f1.4C4}");
setMol("CCCC=O");

Parameters:
s - molfile contents, URL or (Unix) filename

setMol

public void setMol(java.lang.String s,
                   java.lang.String opts)
Starts loading a molecule into the sketcher. The first argument can be a molecule in text format, or a reference/URL to a molecule file. The file format and/or import options can be specified if the second 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:
s - molfile contents, URL or (Unix) filename
opts - options or null
Since:
Marvin 3.3

setMol

public void setMol(java.io.File f,
                   java.lang.String opts)
Sets the molecule. The file format and/or import options can be specified with the opts argument 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: setMol(new File(dir, "foo.xyz.gz"), "gzip:xyz:f1.4C4");

Parameters:
f - the molecule file
opts - import options or null

getDocument

public MDocument getDocument()
Gets the document.

Returns:
the document
Since:
Marvin 3.4, 06/03/2004

setDocument

public void setDocument(MDocument doc)
Sets the document.

Parameters:
doc - the document
Since:
Marvin 3.4, 06/03/2004

getSelection

public Molecule getSelection()
Gets a clone of the selection.

Returns:
the selection

getObjectAtPointer

public java.lang.Object getObjectAtPointer()
Get the object at the mouse pointer.

Returns:
a MolAtom or MolBond object.

getPiece

public java.lang.String getPiece(java.lang.String fmt)
Gets the current molecule piece in the specified format.

Parameters:
fmt - the format
Returns:
the piece in the specified molecule file format
See Also:
getMol(java.lang.String)

setPiece

public void setPiece(java.lang.String s)
Sets the molecule piece.

Parameters:
s - the piece in some molecule file format

getImage

public java.awt.Image getImage(double scale)
Gets the canvas contents as an image using a scale factor.
Examples:
To get an image with a scale factor equivalent to 100% magnification: getImage(getDefaultScale());
To get an image with the actual scale factor: getImage(getScale());

Parameters:
scale - the absolute scale factor, see getScale()
Returns:
the molecule image
Since:
Marvin 4.0, 07/09/2005

getImage

public java.awt.Image getImage(java.awt.Dimension size)
Gets the canvas contents as an image scaled to fit in the specified rectangle. The best width/height ratio can be determined using the getBoundRectSize() method.

Parameters:
size - the image size
Returns:
the molecule image
Since:
Marvin 4.0, 07/09/2005

getBoundRectSize

public double[] getBoundRectSize()
Gets the size of the bounding rectangle.

Returns:
two-element array containing the width and height in C-C bond length units
Since:
Marvin 4.0, 07/09/2005
See Also:
MolBond.CCLENGTH, getScale()

getDefaultScale

public static double getDefaultScale()
Returns the default scale factor which is equivalent to 100% magnification.

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

getScale

public double getScale()
Returns the scale factor of the current magnification. The scale factor determines the displayed size of a Carbon-Carbon single bond measured in pixels. In case the magnification is 100%, the returned scale factor equals with the value of getDefaultScale().

Returns:
displayed length of a C-C bond in pixels
See Also:
MolBond.CCLENGTH

setScale

public void setScale(double m)
Sets the scale factor and changes magnification of the canvas. The scale factor determines the displayed size of a Carbon-Carbon single bond measured in pixels. In case the value of getDefaultScale() is set, the magnification of the canvas will be set to 100%.

Parameters:
m - displayed length of a C-C bond in pixels
See Also:
MolBond.CCLENGTH

getStickdst

public double getStickdst()
Gets the sticking distance.

Returns:
the stick distance in C-C bond length units
See Also:
MolBond.CCLENGTH

setStickdst

public void setStickdst(double d)
Sets the sticking distance.

Parameters:
d - the stick distance in C-C bond length units
See Also:
MolBond.CCLENGTH

getMergedst

public double getMergedst()
Gets the merge distance.

Returns:
the merge distance in C-C bond length units
See Also:
MolBond.CCLENGTH

setMergedst

public void setMergedst(double d)
Sets the merge distance.

Parameters:
d - the merge distance in C-C bond length units
See Also:
MolBond.CCLENGTH

getUndo

public int getUndo()
Gets the maximum undo depth.

Returns:
maximum history length

setUndo

public void setUndo(int u)
Sets the maximum undo depth.

Parameters:
u - maximum history length

getReactionSupport

public boolean getReactionSupport()
Is reaction drawing supported?

Returns:
true if supported, false otherwise

setReactionSupport

public void setReactionSupport(boolean v)
Allows or disallows reaction drawing.

Parameters:
v - true to allow, false to disallow

isReactionErrorVisible

public boolean isReactionErrorVisible()
Are reaction errors highlighted?

Returns:
True, if invalide reactions are highlighted with red rectangles around the reaction arrows.
Since:
Marvin 2.9.13

setReactionErrorVisible

public void setReactionErrorVisible(boolean v)
Shows or hides reaction errors

Parameters:
v - True, draws red rectangles around the reaction arrows, if reactions are invalid.
Since:
Marvin 2.9.13

isValenceErrorVisible

public boolean isValenceErrorVisible()
Are valence errors highlighted?

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

setValenceErrorVisible

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

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

isBondDraggedAlong

public boolean isBondDraggedAlong()
Is the currently used bond shown at the mouse cursor?

Returns:
true if the bond is dragged along by the mouse cursor, false otherwise
Since:
Marvin 3.5, 09/30/2004

setBondDraggedAlong

public void setBondDraggedAlong(boolean v)
Sets the visibility of the currently used bond at the mouse cursor.

Parameters:
v - true to drag along the bond by the mouse cursor, false to hide it
Since:
Marvin 3.5, 09/30/2004

setSketchMode

public void setSketchMode(int mode)
Sets the sketching mode.

Parameters:
mode - the sketching mode
Since:
Marvin 4.0
See Also:
SM_SELECT, SM_DELETE, SM_ATOM, SM_BOND

getSketchMode

public int getSketchMode()
Gets the sketching mode.

Returns:
the sketching mode or -1 for special modes
Since:
Marvin 4.0
See Also:
SM_SELECT, SM_DELETE, SM_ATOM, SM_BOND

getSimpView

public int getSimpView()
Deprecated. as of Marvin 3.5, replaced by isBondDraggedAlong()

Gets the visibility of the object in hand.

Returns:
0 normally, 1 if the objects in hand are invisible

setSimpView

public void setSimpView(int v)
Deprecated. as of Marvin 3.5, replaced by setBondDraggedAlong(boolean)

Hides the object in hand.

Parameters:
v - 0 for normal behaviour, 1 to hide bond in hand

getMag

public double getMag()
Deprecated. As of Marvin 2.8.1, replaced by getScale()

Returns:
the magnification

setMag

public void setMag(double m)
Deprecated. As of Marvin 2.8.1, replaced by setScale()

Parameters:
m - the magnification

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 MSketch, 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/01

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 MSketch, 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/01

getMrvWithSettings

public java.lang.String getMrvWithSettings()
Gets the molecule in the sketcher with its current settings in MRV format.

Returns:
the MRV source
Since:
4.0 07/01/2005
See Also:
setMrvWithSettings(String)

setMrvWithSettings

public void setMrvWithSettings(java.lang.String mrvsource)
Sets the molecule and its display settings. Settings can be imported if the MRV source includes display infos.

Parameters:
mrvsource - the MRV source
Since:
4.0 07/01/2005
See Also:
getMrvWithSettings()

isCloseEnabled

public boolean isCloseEnabled()
Determines if the File->Close menu item is enabled or not.

Returns:
True, if Close is enabled in the menu, else false.
Since:
4.0 07/05/2005
See Also:
setCloseEnabled(boolean)

setCloseEnabled

public void setCloseEnabled(boolean b)
Set the accessibility of the Close menu item in the File menu.

Parameters:
b - True to enable close operation from the file menu. False to set it to disabled.
Since:
4.0 07/05/2005
See Also:
isCloseEnabled()

undo

public void undo()
Invokes an undo command.


redo

public void redo()
Invokes a redo command.


setConfirmExit

public void setConfirmExit(boolean b)
Sets to drop confirmation dialog about exit or not.

Parameters:
b - True, confirmation dialog will be appear by exit if modifications were not saved, else false.

isConfirmExit

public boolean isConfirmExit()
Gets whether the confirmation dialog will be appear or not by exit.

Returns:
True, confirmation dialog will be appear by exit if modifications were not saved, else false.

isLoadedMolModified

public boolean isLoadedMolModified()
Determines whether the original molecule that is loaded in is modified or not.

Returns:
If modified returns with true, else false.
Since:
5.0.2 02/29/2008

doPaste

public void doPaste()
Invokes Paste action.

Specified by:
doPaste in class MarvinPane
Since:
Marvin 5.0

clearHistory

public void clearHistory()
Reset undo queue.

Since:
Marvin 4.1.11 07/06/2007