Package org.openscience.cdk.renderer
Class RendererModel
- java.lang.Object
-
- org.openscience.cdk.renderer.RendererModel
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class RendererModel extends Object implements Serializable, Cloneable
Model forIRenderer
that contains settings for drawing objects.- Author:
- maclean
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- render
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RendererModel.ColorHash
The color hash is used to color substructures.static class
RendererModel.ExternalHighlightColor
The color used to highlight external selections.static class
RendererModel.MarkedOutput
If format supports it (e.g.static class
RendererModel.Padding
Padding between molecules in a grid or row.static class
RendererModel.SelectionColor
Color of a selection.static class
RendererModel.TitleColor
Color of title text.static class
RendererModel.TitleFontScale
Size of title font relative compared to atom symbols
-
Constructor Summary
Constructors Constructor Description RendererModel()
Construct a renderer model with no parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCDKChangeListener(ICDKChangeListener listener)
Adds a change listener to the list of listeners.void
fireChange()
Notifies registered listeners of certain changes that have occurred in this model.<T extends IGeneratorParameter<S>,S>
Sget(Class<T> paramType)
Returns theIGeneratorParameter
for the activeIRenderer
.IAtomContainer
getClipboardContent()
Returns the atoms and bonds on the Renderer2D clipboard.<T extends IGeneratorParameter<S>,S>
SgetDefault(Class<T> param)
Returns the default value for theIGeneratorParameter
for the activeIRenderer
.IAtomContainer
getExternalSelectedPart()
Get externally selected atoms.IAtom
getHighlightedAtom()
Returns the atom currently highlighted.IBond
getHighlightedBond()
Returns the Bond currently highlighted.Map<IAtom,IAtom>
getMerge()
This is the central facility for handling "merges" of atoms.boolean
getNotification()
Determines if the model sends around change notifications.<T extends IGeneratorParameter<?>>
TgetParameter(Class<T> param)
Returns theIGeneratorParameter
for the activeIRenderer
.List<IGeneratorParameter<?>>
getRenderingParameters()
Returns allIGeneratorParameter
s for the currentRendererModel
.IChemObjectSelection
getSelection()
Returns anIChemObjectSelection
with the currently selectedIChemObject
s.String
getToolTipText(IAtom atom)
Gets the toolTipText for atom certain atom.Map<IAtom,String>
getToolTipTextMap()
Gets the toolTipTextMap.<T extends IGeneratorParameter<?>>
booleanhasParameter(Class<T> param)
Returns true if the passedIGeneratorParameter
s has been registered.void
registerParameters(IGenerator<? extends IChemObject> generator)
Registers rendering parameters fromIGenerator
s with this model.void
removeCDKChangeListener(ICDKChangeListener listener)
Removes a change listener from the list of listeners.<T extends IGeneratorParameter<S>,S,U extends S>
voidset(Class<T> paramType, U value)
Sets theIGeneratorParameter
for the activeIRenderer
.void
setClipboardContent(IAtomContainer content)
Sets the atoms and bonds on the Renderer2D clipboard.void
setExternalSelectedPart(IAtomContainer externalSelectedPart)
Set externally selected atoms.void
setHighlightedAtom(IAtom highlightedAtom)
Sets the atom currently highlighted.void
setHighlightedBond(IBond highlightedBond)
Sets the Bond currently highlighted.void
setNotification(boolean notification)
Dis- or enables sending around change notifications.void
setSelection(IChemObjectSelection selection)
Set the selectedIChemObject
s.void
setToolTipTextMap(Map<IAtom,String> map)
Sets the toolTipTextMap.
-
-
-
Method Detail
-
getRenderingParameters
public List<IGeneratorParameter<?>> getRenderingParameters()
Returns allIGeneratorParameter
s for the currentRendererModel
.- Returns:
- a new List with
IGeneratorParameter
s
-
getParameter
public <T extends IGeneratorParameter<?>> T getParameter(Class<T> param)
Returns theIGeneratorParameter
for the activeIRenderer
. It returns a new instance of it was unregistered.- Parameters:
param
-IGeneratorParameter
to get the value of.- Returns:
- the
IGeneratorParameter
instance with the active value.
-
getDefault
public <T extends IGeneratorParameter<S>,S> S getDefault(Class<T> param)
Returns the default value for theIGeneratorParameter
for the activeIRenderer
.- Parameters:
param
-IGeneratorParameter
to get the value of.- Returns:
- the default value for which the type is defined by the provided
IGeneratorParameter
-typedparam
parameter. - See Also:
get(Class)
-
set
public <T extends IGeneratorParameter<S>,S,U extends S> void set(Class<T> paramType, U value)
Sets theIGeneratorParameter
for the activeIRenderer
.- Type Parameters:
T
-- Parameters:
paramType
-IGeneratorParameter
to set the value of.value
- newIGeneratorParameter
value
-
get
public <T extends IGeneratorParameter<S>,S> S get(Class<T> paramType)
Returns theIGeneratorParameter
for the activeIRenderer
.- Type Parameters:
T
-- Parameters:
paramType
-IGeneratorParameter
to get the value of.- Returns:
- the
IGeneratorParameter
value. - See Also:
getParameter(Class)
-
registerParameters
public void registerParameters(IGenerator<? extends IChemObject> generator)
Registers rendering parameters fromIGenerator
s with this model.- Parameters:
generator
-
-
setSelection
public void setSelection(IChemObjectSelection selection)
Set the selectedIChemObject
s.- Parameters:
selection
- anIChemObjectSelection
with selectedIChemObject
s
-
getSelection
public IChemObjectSelection getSelection()
Returns anIChemObjectSelection
with the currently selectedIChemObject
s.- Returns:
- the current selected
IChemObject
s
-
getMerge
public Map<IAtom,IAtom> getMerge()
This is the central facility for handling "merges" of atoms. A merge occures if during moving atoms an atom is in Range of another atom. These atoms are then put into the merge map as a key-value pair. During the move, the atoms are then marked by a circle and on releasing the mouse they get actually merged, meaning one atom is removed and bonds pointing to this atom are made to point to the atom it has been marged with.- Returns:
- Returns the merge.map
-
getHighlightedAtom
public IAtom getHighlightedAtom()
Returns the atom currently highlighted.- Returns:
- the atom currently highlighted
-
setHighlightedAtom
public void setHighlightedAtom(IAtom highlightedAtom)
Sets the atom currently highlighted.- Parameters:
highlightedAtom
- The atom to be highlighted
-
getHighlightedBond
public IBond getHighlightedBond()
Returns the Bond currently highlighted.- Returns:
- the Bond currently highlighted
-
setHighlightedBond
public void setHighlightedBond(IBond highlightedBond)
Sets the Bond currently highlighted.- Parameters:
highlightedBond
- The Bond to be currently highlighted
-
getClipboardContent
public IAtomContainer getClipboardContent()
Returns the atoms and bonds on the Renderer2D clipboard. If the clipboard is empty it returns null. Primarily used for copy/paste.- Returns:
- an atomcontainer with the atoms and bonds on the clipboard.
-
setClipboardContent
public void setClipboardContent(IAtomContainer content)
Sets the atoms and bonds on the Renderer2D clipboard. Primarily used for copy/paste.- Parameters:
content
- the new content of the clipboard.
-
addCDKChangeListener
public void addCDKChangeListener(ICDKChangeListener listener)
Adds a change listener to the list of listeners.- Parameters:
listener
- The listener added to the list
-
removeCDKChangeListener
public void removeCDKChangeListener(ICDKChangeListener listener)
Removes a change listener from the list of listeners.- Parameters:
listener
- The listener removed from the list
-
fireChange
public void fireChange()
Notifies registered listeners of certain changes that have occurred in this model.
-
getToolTipText
public String getToolTipText(IAtom atom)
Gets the toolTipText for atom certain atom.- Parameters:
atom
- The atom.- Returns:
- The toolTipText value.
-
setToolTipTextMap
public void setToolTipTextMap(Map<IAtom,String> map)
Sets the toolTipTextMap.- Parameters:
map
- A map containing Atoms of the current molecule as keys and Strings to display as values. A line break will be inserted where a \n is in the string.
-
getToolTipTextMap
public Map<IAtom,String> getToolTipTextMap()
Gets the toolTipTextMap.- Returns:
- The toolTipTextValue.
-
getExternalSelectedPart
public IAtomContainer getExternalSelectedPart()
Get externally selected atoms. These are atoms selected externally in e. g. Bioclipse via the ChemObjectTree, painted in externalSelectedPartColor- Returns:
- the selected part
-
setExternalSelectedPart
public void setExternalSelectedPart(IAtomContainer externalSelectedPart)
Set externally selected atoms. These are atoms selected externally in e. g. Bioclipse via the ChemObjectTree, painted in externalSelectedPartColor- Parameters:
externalSelectedPart
- the selected part
-
getNotification
public boolean getNotification()
Determines if the model sends around change notifications.- Returns:
- true, if notifications are sent around upon changes
-
hasParameter
public <T extends IGeneratorParameter<?>> boolean hasParameter(Class<T> param)
Returns true if the passedIGeneratorParameter
s has been registered.- Parameters:
param
- parameter for which it is tested if it is registered- Returns:
- boolean indicating the parameters is registered
-
setNotification
public void setNotification(boolean notification)
Dis- or enables sending around change notifications.- Parameters:
notification
- true if notifications should be sent, false otherwise.
-
-