Package com.actelion.research.gui.editor
Class GenericDrawArea
- java.lang.Object
-
- com.actelion.research.gui.editor.GenericDrawArea
-
- All Implemented Interfaces:
DialogEventConsumer,GenericKeyListener,GenericMouseListener
public class GenericDrawArea extends java.lang.Object implements DialogEventConsumer, GenericKeyListener, GenericMouseListener
-
-
Field Summary
Fields Modifier and Type Field Description static intMODE_DRAWING_OBJECTSstatic intMODE_MARKUSH_STRUCTUREstatic intMODE_MULTIPLE_FRAGMENTSstatic intMODE_REACTIONprotected static intUPDATE_CHECK_COORDSprotected static intUPDATE_CHECK_VIEWprotected static intUPDATE_INVENT_COORDSprotected static intUPDATE_NONEprotected static intUPDATE_REDRAWprotected static intUPDATE_SCALE_COORDSprotected static intUPDATE_SCALE_COORDS_USE_FRAGMENTS
-
Constructor Summary
Constructors Constructor Description GenericDrawArea(StereoMolecule mol, int mode, GenericDialogHelper helper, GenericCanvas canvas)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDrawAreaListener(DrawAreaListener l)booleanaddPastedOrDropped(StereoMolecule mol, java.awt.Point p)protected voidbuttonPressed(int button)static java.awt.ColorchainHiliteColor()voidclearAll()voiddialogEventHappened(DialogEvent e)intgetDisplayMode()DrawingObjectListgetDrawingObjects()StereoMolecule[]getFragments()intgetHiliteAtom()intgetHiliteBond()MarkushStructuregetMarkushStructure()intgetMode()StereoMoleculegetMolecule()ReactiongetReaction()ReactiongetReactionAndDrawings()booleanisAtomColorSupported()voidkeyActionHappened(GenericKeyEvent e)static java.awt.ColorlassoColor()static java.awt.ColormapToolColor()voidmoleculeChanged()Use this to inform the JDrawArea after changing its molecule from outside.voidmoleculeChanged(boolean userChange)Ideally don't use this from outside JDrawArea.voidmouseActionHappened(GenericMouseEvent e)voidpaintContent(GenericDrawContext context)protected voidrestoreState()static java.awt.ColorselectionColor()voidsetAllowQueryFeatures(boolean allow)If set to false then any query features will be removed from the molecule and any functionality that allows to define atom- or bond-query features won't be available.voidsetAtomColorSupported(boolean acs)voidsetAtomText(java.lang.String[] atomText)Defines additional atom text to be displayed in top right position of some/all atom label.voidsetClipboardHandler(IClipboardHandler h)Call this after initialization to get clipboard supportvoidsetDisplayMode(int dMode)voidsetDrawingObjects(DrawingObjectList drawingObjectList)voidsetFragments(StereoMolecule[] fragment)voidsetHiliteBondSet(int[] bondSet)voidsetMarkushStructure(MarkushStructure markush)voidsetMolecule(StereoMolecule theMolecule)voidsetReaction(Reaction rxn)static voidsetReactionMapper(IReactionMapper mapper)voidsetReactionMode(boolean rxn)protected voidsetUpdateMode(int mode)voidshowHelpDialog()voidstoreState()voidtoolChanged(int newTool)
-
-
-
Field Detail
-
MODE_MULTIPLE_FRAGMENTS
public static final int MODE_MULTIPLE_FRAGMENTS
- See Also:
- Constant Field Values
-
MODE_MARKUSH_STRUCTURE
public static final int MODE_MARKUSH_STRUCTURE
- See Also:
- Constant Field Values
-
MODE_REACTION
public static final int MODE_REACTION
- See Also:
- Constant Field Values
-
MODE_DRAWING_OBJECTS
public static final int MODE_DRAWING_OBJECTS
- See Also:
- Constant Field Values
-
UPDATE_NONE
protected static final int UPDATE_NONE
- See Also:
- Constant Field Values
-
UPDATE_REDRAW
protected static final int UPDATE_REDRAW
- See Also:
- Constant Field Values
-
UPDATE_CHECK_VIEW
protected static final int UPDATE_CHECK_VIEW
- See Also:
- Constant Field Values
-
UPDATE_CHECK_COORDS
protected static final int UPDATE_CHECK_COORDS
- See Also:
- Constant Field Values
-
UPDATE_SCALE_COORDS
protected static final int UPDATE_SCALE_COORDS
- See Also:
- Constant Field Values
-
UPDATE_SCALE_COORDS_USE_FRAGMENTS
protected static final int UPDATE_SCALE_COORDS_USE_FRAGMENTS
- See Also:
- Constant Field Values
-
UPDATE_INVENT_COORDS
protected static final int UPDATE_INVENT_COORDS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GenericDrawArea
public GenericDrawArea(StereoMolecule mol, int mode, GenericDialogHelper helper, GenericCanvas canvas)
- Parameters:
mol- an empty or valid stereo moleculemode- 0 or a meaningful combination of the mode flags, e.g. MODE_REACTION | MODE_DRAWING_OBJECTS
-
-
Method Detail
-
setClipboardHandler
public void setClipboardHandler(IClipboardHandler h)
Call this after initialization to get clipboard support- Parameters:
h-
-
setReactionMapper
public static void setReactionMapper(IReactionMapper mapper)
-
paintContent
public void paintContent(GenericDrawContext context)
-
lassoColor
public static java.awt.Color lassoColor()
-
selectionColor
public static java.awt.Color selectionColor()
-
mapToolColor
public static java.awt.Color mapToolColor()
-
chainHiliteColor
public static java.awt.Color chainHiliteColor()
-
addDrawAreaListener
public void addDrawAreaListener(DrawAreaListener l)
-
buttonPressed
protected void buttonPressed(int button)
-
clearAll
public void clearAll()
-
toolChanged
public void toolChanged(int newTool)
-
dialogEventHappened
public void dialogEventHappened(DialogEvent e)
- Specified by:
dialogEventHappenedin interfaceDialogEventConsumer
-
addPastedOrDropped
public boolean addPastedOrDropped(StereoMolecule mol, java.awt.Point p)
-
mouseActionHappened
public void mouseActionHappened(GenericMouseEvent e)
- Specified by:
mouseActionHappenedin interfaceGenericMouseListener
-
showHelpDialog
public void showHelpDialog()
-
keyActionHappened
public void keyActionHappened(GenericKeyEvent e)
- Specified by:
keyActionHappenedin interfaceGenericKeyListener
-
restoreState
protected void restoreState()
-
storeState
public void storeState()
-
moleculeChanged
public void moleculeChanged()
Use this to inform the JDrawArea after changing its molecule from outside.
-
moleculeChanged
public void moleculeChanged(boolean userChange)
Ideally don't use this from outside JDrawArea. Use moleculeChanged() instead.- Parameters:
userChange- is true if the change was done within the editor
-
getMolecule
public StereoMolecule getMolecule()
-
setMolecule
public void setMolecule(StereoMolecule theMolecule)
-
getFragments
public StereoMolecule[] getFragments()
-
setFragments
public void setFragments(StereoMolecule[] fragment)
-
getReaction
public Reaction getReaction()
- Returns:
- mapped reaction with absolute coordinates, but without drawing objects
-
getReactionAndDrawings
public Reaction getReactionAndDrawings()
- Returns:
- mapped reaction with absolute coordinates and drawing objects
-
setReaction
public void setReaction(Reaction rxn)
-
getMarkushStructure
public MarkushStructure getMarkushStructure()
-
setMarkushStructure
public void setMarkushStructure(MarkushStructure markush)
-
getDisplayMode
public int getDisplayMode()
-
setDisplayMode
public void setDisplayMode(int dMode)
-
setAllowQueryFeatures
public void setAllowQueryFeatures(boolean allow)
If set to false then any query features will be removed from the molecule and any functionality that allows to define atom- or bond-query features won't be available. This feature is only relevant if the molecule is a fragment.- Parameters:
allow- if false, then query feature editing is not allowed, even for molecules being a fragment
-
setAtomText
public void setAtomText(java.lang.String[] atomText)
Defines additional atom text to be displayed in top right position of some/all atom label. If the atom is charged, then the atom text follows the charge information. If using atom text make sure to update it accordingly, if atom indexes change due to molecule changes. Atom text is not supported for MODE_REACTION, MODE_MULTIPLE_FRAGMENTS or MODE_MARKUSH_STRUCTURE.- Parameters:
atomText- String[] matching atom indexes (may contain null entries)
-
getDrawingObjects
public DrawingObjectList getDrawingObjects()
-
setDrawingObjects
public void setDrawingObjects(DrawingObjectList drawingObjectList)
-
getMode
public int getMode()
-
getHiliteAtom
public int getHiliteAtom()
-
getHiliteBond
public int getHiliteBond()
-
setHiliteBondSet
public void setHiliteBondSet(int[] bondSet)
-
setReactionMode
public void setReactionMode(boolean rxn)
-
setUpdateMode
protected void setUpdateMode(int mode)
-
isAtomColorSupported
public boolean isAtomColorSupported()
-
setAtomColorSupported
public void setAtomColorSupported(boolean acs)
-
-