Class RendererModel

java.lang.Object
org.openscience.cdk.renderer.RendererModel
All Implemented Interfaces:
Serializable, Cloneable

public class RendererModel extends Object implements Serializable, Cloneable
Model for IRenderer that contains settings for drawing objects.
Author:
maclean
See Also:
Source code:
main
Belongs to CDK module:
render
  • Constructor Details

    • RendererModel

      public RendererModel()
      Construct a renderer model with no parameters. To put parameters into the model, use the registerParameters method.
  • Method Details

    • getRenderingParameters

      public List<IGeneratorParameter<?>> getRenderingParameters()
      Returns all IGeneratorParameters for the current RendererModel.
      Returns:
      a new List with IGeneratorParameters
    • getParameter

      public <T extends IGeneratorParameter<?>> T getParameter(Class<T> param)
      Returns the IGeneratorParameter for the active IRenderer. 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 the IGeneratorParameter for the active IRenderer.
      Parameters:
      param - IGeneratorParameter to get the value of.
      Returns:
      the default value for which the type is defined by the provided IGeneratorParameter-typed param parameter.
      See Also:
    • set

      public <T extends IGeneratorParameter<S>, S, U extends S> void set(Class<T> paramType, U value)
      Sets the IGeneratorParameter for the active IRenderer.
      Type Parameters:
      T -
      Parameters:
      paramType - IGeneratorParameter to set the value of.
      value - new IGeneratorParameter value
    • get

      public <T extends IGeneratorParameter<S>, S> S get(Class<T> paramType)
      Returns the IGeneratorParameter for the active IRenderer.
      Type Parameters:
      T -
      Parameters:
      paramType - IGeneratorParameter to get the value of.
      Returns:
      the IGeneratorParameter value.
      See Also:
    • registerParameters

      public void registerParameters(IGenerator<? extends IChemObject> generator)
      Registers rendering parameters from IGenerators with this model.
      Parameters:
      generator -
    • setSelection

      public void setSelection(IChemObjectSelection selection)
      Set the selected IChemObjects.
      Parameters:
      selection - an IChemObjectSelection with selected IChemObjects
    • getSelection

      public IChemObjectSelection getSelection()
      Returns an IChemObjectSelection with the currently selected IChemObjects.
      Returns:
      the current selected IChemObjects
    • 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 passed IGeneratorParameters 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.