Class MarkedElement
- java.lang.Object
-
- org.openscience.cdk.renderer.elements.MarkedElement
-
- All Implemented Interfaces:
IRenderingElement
public final class MarkedElement extends Object implements IRenderingElement
A marked element adds meta-data (id and tags) to a CDK rendering element (or group of elements). The id should be unique per depiction. The primary use case it to be able to set the 'id' and 'class' attributes in SVG. To set the mol, atom, or bond id set a String property toID_KEY
. Similarly, theCLASS_KEY
can be used to set the classes.IAtomContainer mol; atom.setProperty(MarkedElement.ID_KEY, "my_atm_id"); atom.setProperty(MarkedElement.CLASS_KEY, "h_donor"); atom.setProperty(MarkedElement.CLASS_KEY, "h_acceptor");
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(IRenderingVisitor visitor)
Converts thisTextElement
into widget specific objects.IRenderingElement
element()
Access the element of which the id and classes apply.List<String>
getClasses()
Access the classes of the element.String
getId()
Access the id of the element.static MarkedElement
markup(IRenderingElement elem, String... classes)
Markup a rendering element with the specified classes.static MarkedElement
markupAtom(IRenderingElement elem, IAtom atom)
Markup a atom with the class 'atom' and optionally the ids/classes from it's properties.static MarkedElement
markupBond(IRenderingElement elem, IBond bond)
Markup a bond with the class 'bond' and optionally the ids/classes from it's properties.static MarkedElement
markupMol(IRenderingElement elem, IAtomContainer mol)
Markup a molecule with the class 'mol' and optionally the ids/classes from it's properties.
-
-
-
Method Detail
-
getId
public String getId()
Access the id of the element.- Returns:
- id, null if none
-
getClasses
public List<String> getClasses()
Access the classes of the element.- Returns:
- id, empty if none
-
accept
public void accept(IRenderingVisitor visitor)
Converts thisTextElement
into widget specific objects.- Specified by:
accept
in interfaceIRenderingElement
- Parameters:
visitor
- Toolkit specific widget factory.
-
element
public IRenderingElement element()
Access the element of which the id and classes apply.- Returns:
- rendering element
-
markup
public static MarkedElement markup(IRenderingElement elem, String... classes)
Markup a rendering element with the specified classes.- Parameters:
elem
- rendering elementclasses
- classes- Returns:
- the marked element
-
markupMol
public static MarkedElement markupMol(IRenderingElement elem, IAtomContainer mol)
Markup a molecule with the class 'mol' and optionally the ids/classes from it's properties.- Parameters:
elem
- rendering elementmol
- molecule- Returns:
- the marked element
-
markupAtom
public static MarkedElement markupAtom(IRenderingElement elem, IAtom atom)
Markup a atom with the class 'atom' and optionally the ids/classes from it's properties.- Parameters:
elem
- rendering elementatom
- atom- Returns:
- the marked element
-
markupBond
public static MarkedElement markupBond(IRenderingElement elem, IBond bond)
Markup a bond with the class 'bond' and optionally the ids/classes from it's properties.- Parameters:
elem
- rendering elementbond
- bond- Returns:
- the marked element
-
-