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 int
MODE_DRAWING_OBJECTS
static int
MODE_MARKUSH_STRUCTURE
static int
MODE_MULTIPLE_FRAGMENTS
static int
MODE_REACTION
protected static int
UPDATE_CHECK_COORDS
protected static int
UPDATE_CHECK_VIEW
protected static int
UPDATE_INVENT_COORDS
protected static int
UPDATE_NONE
protected static int
UPDATE_REDRAW
protected static int
UPDATE_SCALE_COORDS
protected static int
UPDATE_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 void
addDrawAreaListener(DrawAreaListener l)
boolean
addPastedOrDropped(StereoMolecule mol, java.awt.Point p)
protected void
buttonPressed(int button)
static java.awt.Color
chainHiliteColor()
void
clearAll()
void
dialogEventHappened(DialogEvent e)
int
getDisplayMode()
DrawingObjectList
getDrawingObjects()
StereoMolecule[]
getFragments()
int
getHiliteAtom()
int
getHiliteBond()
MarkushStructure
getMarkushStructure()
int
getMode()
StereoMolecule
getMolecule()
Reaction
getReaction()
Reaction
getReactionAndDrawings()
boolean
isAtomColorSupported()
void
keyActionHappened(GenericKeyEvent e)
static java.awt.Color
lassoColor()
static java.awt.Color
mapToolColor()
void
moleculeChanged()
Use this to inform the JDrawArea after changing its molecule from outside.void
moleculeChanged(boolean userChange)
Ideally don't use this from outside JDrawArea.void
mouseActionHappened(GenericMouseEvent e)
void
paintContent(GenericDrawContext context)
protected void
restoreState()
static java.awt.Color
selectionColor()
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.void
setAtomColorSupported(boolean acs)
void
setAtomText(java.lang.String[] atomText)
Defines additional atom text to be displayed in top right position of some/all atom label.void
setClipboardHandler(IClipboardHandler h)
Call this after initialization to get clipboard supportvoid
setDisplayMode(int dMode)
void
setDrawingObjects(DrawingObjectList drawingObjectList)
void
setFragments(StereoMolecule[] fragment)
void
setHiliteBondSet(int[] bondSet)
void
setMarkushStructure(MarkushStructure markush)
void
setMolecule(StereoMolecule theMolecule)
void
setReaction(Reaction rxn)
static void
setReactionMapper(IReactionMapper mapper)
void
setReactionMode(boolean rxn)
protected void
setUpdateMode(int mode)
void
showHelpDialog()
void
storeState()
void
toolChanged(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:
dialogEventHappened
in interfaceDialogEventConsumer
-
addPastedOrDropped
public boolean addPastedOrDropped(StereoMolecule mol, java.awt.Point p)
-
mouseActionHappened
public void mouseActionHappened(GenericMouseEvent e)
- Specified by:
mouseActionHappened
in interfaceGenericMouseListener
-
showHelpDialog
public void showHelpDialog()
-
keyActionHappened
public void keyActionHappened(GenericKeyEvent e)
- Specified by:
keyActionHappened
in 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)
-
-