@PublicAPI public class MSketchPane extends MarvinPane
LicenseHandler lm = LicenseHandler.getInstance(); lm.setLicenseFile(path_to_license_file);
javax.swing.JRootPane.AccessibleJRootPane, javax.swing.JRootPane.RootLayout
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
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.
|
static int |
SM_SELECT_LASSO
Lasso select mode.
|
molPanel, params, topLevelContainer, VERSION
COLOR_CHOOSER_DIALOG, contentPane, defaultButton, defaultPressAction, defaultReleaseAction, ERROR_DIALOG, FILE_CHOOSER_DIALOG, FRAME, glassPane, INFORMATION_DIALOG, layeredPane, menuBar, NONE, PLAIN_DIALOG, QUESTION_DIALOG, WARNING_DIALOG
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
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.
|
MSketchPane(UserSettings settings,
boolean loadtmpl,
javax.swing.JComponent parent)
Constructs the sketcher with the specified user settings object.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a
PropertyChangeListener for a specific property. |
void |
centralizeMoleculeDisplay()
Puts the molecule into the center of the display.
|
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.
|
chemaxon.marvin.common.swing.action.CommonActions |
getCommonActions()
Deprecated.
at N/A (before 02/12/2015)
|
static double |
getDefaultScale()
Returns the default scale factor which is equivalent to 100%
magnification.
|
java.util.List<java.lang.String> |
getDisabledGroupTypes() |
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.
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()); |
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.
|
chemaxon.marvin.sketch.swing.SketchPanel |
getMolPanel()
Returns the underlying panel.
|
java.lang.String |
getMrvWithSettings()
Deprecated.
use
getMol(String) instead |
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()
Deprecated.
As of Version 5.3.2, this method is deprecated and has no
replacement. It will be removed in a future version of
Marvin.
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 |
setDisabledGroupTypes(java.util.List<java.lang.String> disabledGroupTypes) |
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)
Deprecated.
use
setMol(Molecule) instead of this method. |
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)
Deprecated.
use
setMol(String) |
void |
setPiece(java.lang.String s)
Sets the molecule piece.
|
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 |
showStartupSelector()
This method is used in startup time to throw up a skin selector dialog.
|
void |
undo()
Invokes an undo command.
|
void |
writeExternal(java.io.ObjectOutput out)
Saves object state.
|
addActionListener, addHelpMenu, addMenuBarChangeListener, addToolsMenu, arePopupMenusEnabled, beginHourglass, closeWindows, componentHidden, componentMoved, componentResized, 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, readDoc, readMol, readResources, removeActionListener, setAtomMappingVisible, setAtomNumberingType, setAtomNumbersVisible, setAtomSetColor, setAtomsize, setAtomSymbolsVisible, setBallRadius, setBoldBondWidth, setBondLength, setBondLengthVisible, setBondSetColor, setBondSpacing, setBondWidth, setChiralitySupport, setCleanDim, setColorScheme, setDebug, setDirectory, setDispopts, setDownWedge, setEnabled, setExperimentalEnabled, setEzVisible, setFile, setFormat, setGlobalGUIProperties, setGrinv, setGrinvVisible, setImplicitH, setInvisibleSets, setLabels, setLonePairsVisible, setMarginSize, setMolbg, setMPVisible, setParams, setPopupMenusEnabled, setPrintEnabled, setRendering, setRgroupsVisible, setSaveIniEnabled, setSetColor, setSetColoringEnabled, setStickThickness, setTopLevelContainer, setUserSettings, setWireThickness, showErrorDialog, showFileDialog, showFileOpenDialog, writeMol
addImpl, addNotify, createContentPane, createGlassPane, createLayeredPane, createRootLayout, getAccessibleContext, getContentPane, getDefaultButton, getGlassPane, getJMenuBar, getLayeredPane, getMenuBar, getUI, getUIClassID, getWindowDecorationStyle, isOptimizedDrawingEnabled, isValidateRoot, paramString, removeNotify, setContentPane, setDefaultButton, setDoubleBuffered, setGlassPane, setJMenuBar, setLayeredPane, setMenuBar, setUI, setWindowDecorationStyle, updateUI
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, 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, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int SM_SELECT
public static final int SM_DELETE
public static final int SM_ATOM
setSketchMode(MSketchPane.SM_Atom | (6 << MSketchPane.SM_FLAGS_OFF));
public static final int SM_BOND
setSketchMode(MSketchPane.SM_BOND | (1 << MSketchPane.SM_FLAGS_OFF));
public static final int SM_SELECT_LASSO
public static final int SM_MASK
public static final int SM_FLAGS_OFF
public MSketchPane()
chemaxon.license.LicenseException
- if no valid license foundpublic MSketchPane(UserSettings settings)
settings
- the user settingschemaxon.license.LicenseException
- if no valid license foundpublic MSketchPane(UserSettings settings, boolean loadtmpl)
settings
- the user settingsloadtmpl
- load template structures and abbreviated groups immediately (
true
) or not (false
)chemaxon.license.LicenseException
- if no valid license foundpublic MSketchPane(UserSettings settings, boolean loadtmpl, javax.swing.JComponent parent)
settings
- the user settingsloadtmpl
- load template structures and abbreviated groups immediately (
true
) or not (false
)parent
- the parent Component of the MSketchPanechemaxon.license.LicenseException
- if no valid license foundpublic javax.swing.JComponent getCanvasComponent()
MarvinPane.setPopupMenusEnabled(boolean)
public void setAutoScale(boolean as)
as
- set to true to enable autoscalepublic boolean getAutoScale()
public void propertyChange(java.beans.PropertyChangeEvent ev)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class MarvinPane
ev
- the event objectpublic void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
PropertyChangeListener
for a specific property. The
listener will be invoked only when a call on
firePropertyChange
names that specific property.
If listener is null
, no exception is thrown and no action is
performed.
addPropertyChangeListener
in class java.awt.Container
propertyName
- the name of the property to listen onlistener
- the PropertyChangeListener
to be addedpublic Molecule getMol()
public java.lang.String getMol(java.lang.String fmt)
s1 = msketch.getMol("mol"); s2 = msketch.getMol("smiles:a-H"); // aromatize and remove Hydrogens
fmt
- the format descriptor stringpublic void setMol(Molecule m)
m
- the molecule@Deprecated public void setMol(Molecule m, boolean init)
setMol(Molecule)
instead of this method.m
- the moleculeinit
- parameter is not usedpublic void setMol(java.lang.String s)
s
- molfile contents, URL or (Unix) filenamepublic void setMol(java.lang.String s, java.lang.String opts)
s
- molfile contents, URL or (Unix) filenameopts
- options or nullpublic void setMol(java.io.File f, java.lang.String opts)
f
- the molecule fileopts
- import options or nullpublic MDocument getDocument()
public void setDocument(MDocument doc)
doc
- the documentpublic Molecule getSelection()
public java.lang.Object getObjectAtPointer()
public java.lang.String getPiece(java.lang.String fmt)
fmt
- the formatgetMol(java.lang.String)
public void setPiece(java.lang.String s)
s
- the piece in some molecule file formatpublic java.awt.Image getImage(double scale)
getImage(getDefaultScale());
getImage(getScale());
scale
- the absolute scale factor, see getScale()
public java.awt.Image getImage(java.awt.Dimension size)
getBoundRectSize()
method.size
- the image sizepublic double[] getBoundRectSize()
MolBond.CCLENGTH
,
getScale()
public static double getDefaultScale()
public double getScale()
getDefaultScale()
.MolBond.CCLENGTH
public void setScale(double m)
getDefaultScale()
is
set, the magnification of the canvas will be set to 100%.m
- displayed length of a C-C bond in pixelsMolBond.CCLENGTH
public double getStickdst()
MolBond.CCLENGTH
public void setStickdst(double d)
d
- the stick distance in C-C bond length unitsMolBond.CCLENGTH
public double getMergedst()
MolBond.CCLENGTH
public void setMergedst(double d)
d
- the merge distance in C-C bond length unitsMolBond.CCLENGTH
public int getUndo()
public void setUndo(int u)
u
- maximum history lengthpublic boolean getReactionSupport()
public void setReactionSupport(boolean v)
v
- true to allow, false to disallow@Deprecated public boolean isReactionErrorVisible()
Are reaction errors highlighted?
false
public boolean isValenceErrorVisible()
public void setValenceErrorVisible(boolean v)
v
- True, underlines atom symbols in case valence errors.public boolean isBondDraggedAlong()
public void setBondDraggedAlong(boolean v)
v
- true to drag along the bond by the mouse cursor, false to hide
itpublic void setSketchMode(int mode)
mode
- the sketching modeSM_SELECT
,
SM_DELETE
,
SM_ATOM
,
SM_BOND
,
SM_SELECT_LASSO
public int getSketchMode()
SM_SELECT
,
SM_DELETE
,
SM_ATOM
,
SM_BOND
,
SM_SELECT_LASSO
@Deprecated public int getSimpView()
isBondDraggedAlong()
@Deprecated public void setSimpView(int v)
setBondDraggedAlong(boolean)
v
- 0 for normal behaviour, 1 to hide bond in hand@Deprecated public double getMag()
@Deprecated public void setMag(double m)
m
- the magnificationpublic void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
method of class MSketch
,
which does implement it.writeExternal
in class MarvinPane
out
- the stream to write the object tojava.io.IOException
- Includes any I/O exceptions that may occurpublic void readExternal(java.io.ObjectInput in) throws java.io.IOException
readExternal
method of class MSketch
,
which does implement it.readExternal
in class MarvinPane
in
- the stream to read data from in order to restore the objectjava.io.IOException
- if I/O errors occurjava.lang.ClassNotFoundException
- If the class for an object being restored cannot be found.@Deprecated public java.lang.String getMrvWithSettings()
getMol(String)
insteadsetMrvWithSettings(String)
@Deprecated public void setMrvWithSettings(java.lang.String mrvsource)
setMol(String)
mrvsource
- the MRV sourcegetMrvWithSettings()
public boolean isCloseEnabled()
setCloseEnabled(boolean)
public void setCloseEnabled(boolean b)
b
- True to enable close operation from the file menu. False to
set it to disabled.isCloseEnabled()
public void undo()
public void redo()
public void setConfirmExit(boolean b)
b
- True, confirmation dialog will be appear by exit if
modifications were not saved, else false.public boolean isConfirmExit()
public boolean isLoadedMolModified()
public void doPaste()
doPaste
in class MarvinPane
public void clearHistory()
@Deprecated public chemaxon.marvin.common.swing.action.CommonActions getCommonActions()
MarvinPane
getCommonActions
in class MarvinPane
public void centralizeMoleculeDisplay()
public void setDisabledGroupTypes(java.util.List<java.lang.String> disabledGroupTypes)
public java.util.List<java.lang.String> getDisabledGroupTypes()
public void showStartupSelector()
public chemaxon.marvin.sketch.swing.SketchPanel getMolPanel()
MarvinPane
getMolPanel
in class MarvinPane