chemaxon.marvin.space
Class ComponentElement

java.lang.Object
  extended by chemaxon.marvin.space.ComponentElement

public class ComponentElement
extends java.lang.Object

Class to identify parts of GraphicComponents mainly during selection.

Examples:

Since:
Marvin 4.0.2
Version:
MarvinSpace 1.0
Author:
Judit Papp

Constructor Summary
ComponentElement(ComponentElement element)
          Copies the given ComponentElement.
ComponentElement(GraphicComponent component, int atomicElementType, int atomicElementIndex)
          Creates a new instance of ComponentElement of a simple (not structured) GraphicComponent.
ComponentElement(GraphicComponent component, int atomicElementType, java.lang.Integer atomicElementIndexObject)
          Creates a new instance of ComponentElement.
ComponentElement(GraphicComponent component, int componentPartId, int atomicElementType, int atomicElementIndex)
          Creates a new instance of ComponentElement of a complex (structured) GraphicComponent.
ComponentElement(GraphicComponent component, int componentPartId, int atomicElementType, java.lang.Integer atomicElementIndexObject)
          Creates a new instance of ComponentElement.
 
Method Summary
 java.awt.Color getColor()
          Returns the color that is assigned to the ComponentElement.
 GraphicComponent getComponent()
          Returns the component which contains this ComponentElement.
 int getComponentPartId()
          In case of complex components the componentPartId identifies a part of the component.
 void getCoordinates(float[] c)
          Returns the world coordinates of the ComponentElement.
 java.lang.String getDescription()
          Returns the brief description of the ComponentElement, for example type of the atom.
 int getElementIndex()
          Returns the internal index of the ComponentElement in the GraphicComponent.
 int getElementType()
          Returns the type of the ComponentElement.
 boolean isComponentPart()
          Returns true if the if the component is a structured component.
 boolean isVisible()
          Returns true if the ComponentElement is visible in the component.
 void setColor(java.awt.Color c)
          Assignes a color to the CompnentElement.
 void setCoordinates(float[] c)
          Sets the coordinates of the ComponentElement.
 void setDescription(java.lang.String d)
          Sets a brief description to the ComponentElement that will be returned by {#getDescription()}.
 java.lang.String toString()
          Returs the indices of the CompnentElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentElement

public ComponentElement(GraphicComponent component,
                        int atomicElementType,
                        int atomicElementIndex)
Creates a new instance of ComponentElement of a simple (not structured) GraphicComponent.

Parameters:
component - the GraphicComponent whose element is this ComponentElement of
atomicElementType - identifies the type of the ComponentElement, which can be anything the GraphicComponent can identify
atomicElementIndex - the internal index of the atomic element of the component having given type

ComponentElement

public ComponentElement(GraphicComponent component,
                        int atomicElementType,
                        java.lang.Integer atomicElementIndexObject)
Creates a new instance of ComponentElement.

Parameters:
component - the GraphicComponent whose element is this ComponentElement of
atomicElementType - identifies the type of the ComponentElement, which can be anything the GraphicComponent can identify
atomicElementIndexObject - the internal index of the atomic element as an object

ComponentElement

public ComponentElement(GraphicComponent component,
                        int componentPartId,
                        int atomicElementType,
                        int atomicElementIndex)
Creates a new instance of ComponentElement of a complex (structured) GraphicComponent.

Parameters:
component - the GraphicComponent whose element is this ComponentElement of
componentPartId - identifies the specific part of the complex GraphicComponent
atomicElementType - identifies the type of the ComponentElement, which can be anything the GraphicComponent can identify
atomicElementIndex - the internal index of the atomic element of the component having given type

ComponentElement

public ComponentElement(GraphicComponent component,
                        int componentPartId,
                        int atomicElementType,
                        java.lang.Integer atomicElementIndexObject)
Creates a new instance of ComponentElement.

Parameters:
component - the GraphicComponent whose element is this ComponentElement of
componentPartId - identifies the specific part of the complex GraphicComponent
atomicElementType - identifies the type of the ComponentElement, which can be anything the GraphicComponent can identify
atomicElementIndexObject - the internal index of the atomic element as an object

ComponentElement

public ComponentElement(ComponentElement element)
Copies the given ComponentElement.

Parameters:
element - to copy
Method Detail

isComponentPart

public boolean isComponentPart()
Returns true if the if the component is a structured component.

Returns:
is the component a part of a structured component

getComponentPartId

public int getComponentPartId()
In case of complex components the componentPartId identifies a part of the component.

Returns:
id of the part of a structured component

getElementType

public int getElementType()
Returns the type of the ComponentElement.

Returns:
identifier of an element type

getElementIndex

public int getElementIndex()
Returns the internal index of the ComponentElement in the GraphicComponent.

Returns:
internal index of the component

getCoordinates

public void getCoordinates(float[] c)
Returns the world coordinates of the ComponentElement.

Parameters:
c - allocated array where the coordinates will be put

setCoordinates

public void setCoordinates(float[] c)
Sets the coordinates of the ComponentElement. Note, that usually it is unnecessary to set the coordinates this way, because they will be got by GraphicComponent.getCoordinates(ComponentElement, float[]). Setting the coordinates explicitly prevents the calling of the above method.

Parameters:
c -

getDescription

public java.lang.String getDescription()
Returns the brief description of the ComponentElement, for example type of the atom.

Returns:
description of the component

setDescription

public void setDescription(java.lang.String d)
Sets a brief description to the ComponentElement that will be returned by {#getDescription()}.

Parameters:
d - description String or null to get the description given by the component

isVisible

public boolean isVisible()
Returns true if the ComponentElement is visible in the component.

Returns:
is the component visible or not

getComponent

public GraphicComponent getComponent()
Returns the component which contains this ComponentElement.

Returns:
the component

getColor

public java.awt.Color getColor()
Returns the color that is assigned to the ComponentElement. E.g. residue color of a residue label, cpk color of an atom, constant color of a component.


setColor

public void setColor(java.awt.Color c)
Assignes a color to the CompnentElement.

Parameters:
c -

toString

public java.lang.String toString()
Returs the indices of the CompnentElement.

Overrides:
toString in class java.lang.Object
Returns:
ComponentElement as String