edu.sdsc.mbt.viewables
Class StructureStyles

java.lang.Object
  extended byedu.sdsc.mbt.viewables.StructureStyles
All Implemented Interfaces:
java.io.Serializable, StructureComponentEventListener

public class StructureStyles
extends java.lang.Object
implements StructureComponentEventListener, java.io.Serializable

Stores and retrieves styles associated with viewable objects of a Structure (typically one StructureStyle object is assocated with each Structure by a StructureDocument class).

Note that the StructureStyles class only specifies the STYLES that should be used to draw visible representations of objects. It does NOT specify WHAT should be drawn or HOW it should be drawn (these choices are left up to each Viewer). Also, while the set of style attributes maintained by this and subsidiary classes can provide style information for ALL objects that COULD be displayed by a Viewer, it does NOT mean that a given view MUST display a representation of ALL objects. That is, this infrastructure simply provides viewable attributes in case a Viewer chooses to create a visible representation of certain data.

Author:
John L. Moreland and Oleksandr V. Buzko
See Also:

, Serialized Form


Field Summary
static int ATTRIBUTE_QUALITY
           
static int ATTRIBUTE_RIBBON_VISIBILITY
           
static int ATTRIBUTE_SELECTION
           
static int ATTRIBUTE_STYLE
           
static int ATTRIBUTE_VISIBILITY
           
static int FLAG_ALL
           
static int FLAG_NONE
           
static int FLAG_SOME
           
static int PROPERTY_COLOR
           
static int PROPERTY_RADIUS
           
static int PROPERTY_RENDERING
           
static int PROPERTY_RIBBON_COLOR
           
static int PROPERTY_RIBBON_VISIBILITY
           
 float ribbonDiameter
           
 java.util.Vector selectedAtoms
           
 java.util.Vector selectedResidues
           
 
Constructor Summary
StructureStyles(StructureMap structureMap)
          Primary constructor.
 
Method Summary
 void addStructureComponent(StructureComponent structureComponent, short inputStyle, short inputQuality, boolean batch)
           
 void addStructureComponentEventListener(StructureComponentEventListener structureComponentEventListener)
           
 void addStructureStylesEventListener(StructureStylesEventListener structureStylesEventListener)
          Please complete the missing tags for main
 void addStyles(StructureStyles s)
          This method imports styles from a different StructureStyles object
 void clearRibbon(Chain chain)
           
 void deleteStructureComponent(StructureComponent structureComponent, boolean fire, boolean batch)
          TODO temporarily use StructureStyles as a handler of component events.
 void fireGeometryChangeEvent(Residue r)
           
 AtomColor getAtomColor(StructureComponent structureComponent)
           
 java.util.HashMap getAtomColorStyleReference()
           
 java.util.HashMap getAtomColorStyles()
           
 AtomRadius getAtomRadius(StructureComponent structureComponent)
          Set the style for the given structure component and then fire an event to all listeners.
 java.util.HashMap getAtomRadiusStyleReference()
           
 java.util.HashMap getAtomRadiusStyles()
           
 BondColor getBondColor(StructureComponent structureComponent)
           
 java.util.HashMap getBondColorStyleReference()
           
 java.util.HashMap getBondColorStyles()
           
 BondRadius getBondRadius(StructureComponent structureComponent)
           
 java.util.HashMap getBondRadiusStyleReference()
           
 java.util.HashMap getBondRadiusStyles()
           
 ResidueColor getResidueColor(StructureComponent structureComponent)
           
 java.util.HashMap getResidueColorStyleReference()
           
 java.util.HashMap getResidueColorStyles()
           
 void getRibbonColor(Residue residue, float[] color)
           
 RibbonColor getRibbonColor(StructureComponent structureComponent)
           
 java.util.HashMap getRibbonColorStyleReference()
           
 java.util.HashMap getRibbonColorStyles()
           
 float getRibbonDiameter(Chain chain)
           
 float getRibbonQuality(Chain chain)
           
 int getRibbonType(Chain chain)
           
 java.util.Hashtable getSelection()
           
 int getSelectionFlag()
           
 StructureMap getStructureMap()
          Return a reference to our StructureMap object.
 java.util.HashMap getStyleReference()
           
 void hideAll(boolean batch)
          Set the visibility state for the entire structure to false and then fire an event to all listeners.
 void invertSelection()
           
 boolean isRibbonVisible(Chain chain)
           
 boolean isSelected(StructureComponent structureComponent)
          Get the selection state for the given structure component.
 void processStructureComponentEvent(StructureComponentEvent sce)
          Please complete the missing tags for main
 void processStructureStylesEvent(StructureStylesEvent structureStylesEvent)
          Informs all registered listeners that a style has changed.
 void registerStructureComponentRemoval(StructureComponent structureComponent)
           
 void removeRibbonDiameter(Chain chain)
           
 void removeRibbonQuality(Chain chain)
           
 void removeRibbonType(Chain chain)
           
 void removeStructureComponentEventListener(StructureComponentEventListener structureComponentEventListener)
           
 void removeStructureStylesEventListener(StructureStylesEventListener structureStylesEventListener)
          Please complete the missing tags for main
 void replaceStructureComponent(StructureComponent structureComponent, java.lang.String replacement)
           
 void selectAll()
          Set the selection state for the entire structure to true and then fire an event to all listeners.
 void selectNone(boolean batch, boolean aux)
          Set the selection state for the entire structure to false and then fire an event to all listeners.
 void setAtomColor(StructureComponent structureComponent, AtomColor atomColor, boolean fire, boolean batch)
           
 void setAtomRadius(StructureComponent structureComponent, AtomRadius atomRadius)
           
 void setBondColor(StructureComponent structureComponent, BondColor bondColor)
           
 void setBondRadius(StructureComponent structureComponent, BondRadius bondRadius)
           
 void setRenderingStyle(java.util.Enumeration atoms, short style, short quality, boolean batch, boolean forceVisibility)
           
 void setRenderingStyle(short style, short quality)
          Applies the requested rendering style to the entire structure
 void setRenderingStyle(StructureComponent structureComponent, short style, short quality, boolean batch)
          Set the style for the given structure component and then fire an event to all listeners.
 void setResidueColor(StructureComponent structureComponent, ResidueColor residueColor, boolean fire, boolean batch)
          Flag "batch" indicates that the event being fired from this method should contain this flag: the viewers will then refrain from repainting after every residue until further update notice
 void setRibbonColor(StructureComponent structureComponent, ResidueColor residueColor, boolean fire, boolean batch)
           
 void setRibbonColor(StructureComponent structureComponent, RibbonColor ribbonColor, boolean fire, boolean batch)
           
 void setRibbonDiameter(Chain chain, float diameter)
           
 void setRibbonQuality(Chain chain, float q)
           
 void setRibbonType(Chain chain, int type)
           
 void setRibbonVisible(Chain chain, boolean visible, boolean fire, boolean batch)
           
 void setSelected(StructureComponent structureComponent, boolean newState, boolean fire, boolean batch)
          Set the selection state for the given structure component and then fire an event to all listeners.
 void setSelectedChains(java.util.Vector chains)
           
 void setStructureColor(ResidueColor residueColor, AtomColor atomColor)
          This method sets all bookkeeping values for colors for atoms and residues in the given structure and fires one structure-wide event to the viewers.
 void setVisible(StructureComponent structureComponent, boolean newState, boolean fire, boolean batch)
          Set the visibility state for the given structure component and then fire an event to all listeners.
 void showAll(boolean batch)
          Set the visibility state for the entire structure to true and then fire an event to all listeners.
 void updateChain(Chain chain, boolean fire)
          This method determines whether the chain has any ribbon and whether its residues are selected.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_STYLE

public static final int ATTRIBUTE_STYLE
See Also:
Constant Field Values

ATTRIBUTE_VISIBILITY

public static final int ATTRIBUTE_VISIBILITY
See Also:
Constant Field Values

ATTRIBUTE_RIBBON_VISIBILITY

public static final int ATTRIBUTE_RIBBON_VISIBILITY
See Also:
Constant Field Values

ATTRIBUTE_SELECTION

public static final int ATTRIBUTE_SELECTION
See Also:
Constant Field Values

ATTRIBUTE_QUALITY

public static final int ATTRIBUTE_QUALITY
See Also:
Constant Field Values

PROPERTY_COLOR

public static final int PROPERTY_COLOR
See Also:
Constant Field Values

PROPERTY_RADIUS

public static final int PROPERTY_RADIUS
See Also:
Constant Field Values

PROPERTY_RENDERING

public static final int PROPERTY_RENDERING
See Also:
Constant Field Values

PROPERTY_RIBBON_COLOR

public static final int PROPERTY_RIBBON_COLOR
See Also:
Constant Field Values

PROPERTY_RIBBON_VISIBILITY

public static final int PROPERTY_RIBBON_VISIBILITY
See Also:
Constant Field Values

FLAG_NONE

public static final int FLAG_NONE
See Also:
Constant Field Values

FLAG_SOME

public static final int FLAG_SOME
See Also:
Constant Field Values

FLAG_ALL

public static final int FLAG_ALL
See Also:
Constant Field Values

ribbonDiameter

public float ribbonDiameter

selectedAtoms

public java.util.Vector selectedAtoms

selectedResidues

public java.util.Vector selectedResidues
Constructor Detail

StructureStyles

public StructureStyles(StructureMap structureMap)
Primary constructor.

Method Detail

getStructureMap

public StructureMap getStructureMap()
Return a reference to our StructureMap object.


setRenderingStyle

public void setRenderingStyle(StructureComponent structureComponent,
                              short style,
                              short quality,
                              boolean batch)
Set the style for the given structure component and then fire an event to all listeners. It accepts an integer value instead of an object to avoid object creation overhead for each method call. instead, it compares the int value to the existing values in the hash and reuses the objects that have already been created

Returns:
Throws:

setRenderingStyle

public void setRenderingStyle(short style,
                              short quality)
Applies the requested rendering style to the entire structure

Parameters:
style -

setRenderingStyle

public void setRenderingStyle(java.util.Enumeration atoms,
                              short style,
                              short quality,
                              boolean batch,
                              boolean forceVisibility)

getAtomRadius

public AtomRadius getAtomRadius(StructureComponent structureComponent)
Set the style for the given structure component and then fire an event to all listeners.

Returns:
Throws:

setAtomRadius

public void setAtomRadius(StructureComponent structureComponent,
                          AtomRadius atomRadius)

getBondRadius

public BondRadius getBondRadius(StructureComponent structureComponent)

setBondRadius

public void setBondRadius(StructureComponent structureComponent,
                          BondRadius bondRadius)

getAtomColor

public AtomColor getAtomColor(StructureComponent structureComponent)

setAtomColor

public void setAtomColor(StructureComponent structureComponent,
                         AtomColor atomColor,
                         boolean fire,
                         boolean batch)

setStructureColor

public void setStructureColor(ResidueColor residueColor,
                              AtomColor atomColor)
This method sets all bookkeeping values for colors for atoms and residues in the given structure and fires one structure-wide event to the viewers. The structure viewer then runs through all atoms and reads the newly set values, and the sequence viewer checks all residue color values.

Parameters:
residueColor -
atomColor -

getBondColor

public BondColor getBondColor(StructureComponent structureComponent)

setBondColor

public void setBondColor(StructureComponent structureComponent,
                         BondColor bondColor)

getResidueColor

public ResidueColor getResidueColor(StructureComponent structureComponent)

setResidueColor

public void setResidueColor(StructureComponent structureComponent,
                            ResidueColor residueColor,
                            boolean fire,
                            boolean batch)
Flag "batch" indicates that the event being fired from this method should contain this flag: the viewers will then refrain from repainting after every residue until further update notice

Parameters:
structureComponent -
residueColor -
fire -

getRibbonColor

public RibbonColor getRibbonColor(StructureComponent structureComponent)

setRibbonColor

public void setRibbonColor(StructureComponent structureComponent,
                           RibbonColor ribbonColor,
                           boolean fire,
                           boolean batch)

setRibbonColor

public void setRibbonColor(StructureComponent structureComponent,
                           ResidueColor residueColor,
                           boolean fire,
                           boolean batch)

getRibbonColor

public void getRibbonColor(Residue residue,
                           float[] color)
                    throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

updateChain

public void updateChain(Chain chain,
                        boolean fire)
This method determines whether the chain has any ribbon and whether its residues are selected. This is used to keep track of which ribbons are selected and which are not

Parameters:
chain -

setVisible

public void setVisible(StructureComponent structureComponent,
                       boolean newState,
                       boolean fire,
                       boolean batch)
Set the visibility state for the given structure component and then fire an event to all listeners.

Returns:
Throws:

setRibbonVisible

public void setRibbonVisible(Chain chain,
                             boolean visible,
                             boolean fire,
                             boolean batch)

isRibbonVisible

public boolean isRibbonVisible(Chain chain)

getRibbonType

public int getRibbonType(Chain chain)

setRibbonType

public void setRibbonType(Chain chain,
                          int type)

removeRibbonType

public void removeRibbonType(Chain chain)

getRibbonDiameter

public float getRibbonDiameter(Chain chain)

setRibbonDiameter

public void setRibbonDiameter(Chain chain,
                              float diameter)

removeRibbonDiameter

public void removeRibbonDiameter(Chain chain)

clearRibbon

public void clearRibbon(Chain chain)

getRibbonQuality

public float getRibbonQuality(Chain chain)

setRibbonQuality

public void setRibbonQuality(Chain chain,
                             float q)

removeRibbonQuality

public void removeRibbonQuality(Chain chain)

showAll

public void showAll(boolean batch)
Set the visibility state for the entire structure to true and then fire an event to all listeners.

Returns:
Throws:

hideAll

public void hideAll(boolean batch)
Set the visibility state for the entire structure to false and then fire an event to all listeners.

Returns:
Throws:

setSelected

public void setSelected(StructureComponent structureComponent,
                        boolean newState,
                        boolean fire,
                        boolean batch)
Set the selection state for the given structure component and then fire an event to all listeners.

Parameters:
newState - The new selection state for the object.
Returns:
NONE.
Throws:
java.lang.NullPointerException - if StructureComponent is null.

isSelected

public boolean isSelected(StructureComponent structureComponent)
Get the selection state for the given structure component. If the component is null, then the test refers to the entire Structure (that is, NONE of or ALL the components are selected).

Returns:
Throws:

selectAll

public void selectAll()
Set the selection state for the entire structure to true and then fire an event to all listeners.

Returns:
Throws:

selectNone

public void selectNone(boolean batch,
                       boolean aux)
Set the selection state for the entire structure to false and then fire an event to all listeners. aux flag is designed for communication between sequence and structure viewers. if true, it instructs the structure viewer to include selected chains in the selectNone procedure as well.

Returns:
Throws:

getSelectionFlag

public int getSelectionFlag()

processStructureStylesEvent

public void processStructureStylesEvent(StructureStylesEvent structureStylesEvent)
Informs all registered listeners that a style has changed. Called explictly when setStyle is called, or, implictly when any individual style changes state.

Returns:
Throws:

addStructureStylesEventListener

public void addStructureStylesEventListener(StructureStylesEventListener structureStylesEventListener)
Please complete the missing tags for main

Returns:
Throws:

addStructureComponentEventListener

public void addStructureComponentEventListener(StructureComponentEventListener structureComponentEventListener)

removeStructureStylesEventListener

public void removeStructureStylesEventListener(StructureStylesEventListener structureStylesEventListener)
Please complete the missing tags for main

Returns:
Throws:

removeStructureComponentEventListener

public void removeStructureComponentEventListener(StructureComponentEventListener structureComponentEventListener)

registerStructureComponentRemoval

public void registerStructureComponentRemoval(StructureComponent structureComponent)

deleteStructureComponent

public void deleteStructureComponent(StructureComponent structureComponent,
                                     boolean fire,
                                     boolean batch)
TODO temporarily use StructureStyles as a handler of component events.


fireGeometryChangeEvent

public void fireGeometryChangeEvent(Residue r)

replaceStructureComponent

public void replaceStructureComponent(StructureComponent structureComponent,
                                      java.lang.String replacement)

addStructureComponent

public void addStructureComponent(StructureComponent structureComponent,
                                  short inputStyle,
                                  short inputQuality,
                                  boolean batch)

processStructureComponentEvent

public void processStructureComponentEvent(StructureComponentEvent sce)
Please complete the missing tags for main

Specified by:
processStructureComponentEvent in interface StructureComponentEventListener
Returns:
Throws:

invertSelection

public void invertSelection()

addStyles

public void addStyles(StructureStyles s)
This method imports styles from a different StructureStyles object


getAtomColorStyleReference

public final java.util.HashMap getAtomColorStyleReference()
Returns:
Returns the atomColorStyleReference.

getAtomColorStyles

public final java.util.HashMap getAtomColorStyles()
Returns:
Returns the atomColorStyles.

getAtomRadiusStyleReference

public final java.util.HashMap getAtomRadiusStyleReference()
Returns:
Returns the atomRadiusStyleReference.

getAtomRadiusStyles

public final java.util.HashMap getAtomRadiusStyles()
Returns:
Returns the atomRadiusStyles.

getBondColorStyleReference

public final java.util.HashMap getBondColorStyleReference()
Returns:
Returns the bondColorStyleReference.

getBondColorStyles

public final java.util.HashMap getBondColorStyles()
Returns:
Returns the bondColorStyles.

getBondRadiusStyleReference

public final java.util.HashMap getBondRadiusStyleReference()
Returns:
Returns the bondRadiusStyleReference.

getBondRadiusStyles

public final java.util.HashMap getBondRadiusStyles()
Returns:
Returns the bondRadiusStyles.

getResidueColorStyleReference

public final java.util.HashMap getResidueColorStyleReference()
Returns:
Returns the residueColorStyleReference.

getResidueColorStyles

public final java.util.HashMap getResidueColorStyles()
Returns:
Returns the residueColorStyles.

getRibbonColorStyleReference

public final java.util.HashMap getRibbonColorStyleReference()
Returns:
Returns the ribbonColorStyleReference.

getRibbonColorStyles

public final java.util.HashMap getRibbonColorStyles()
Returns:
Returns the ribbonColorStyles.

getSelection

public final java.util.Hashtable getSelection()
Returns:
Returns the selection.

getStyleReference

public final java.util.HashMap getStyleReference()
Returns:
Returns the styleReference.

setSelectedChains

public void setSelectedChains(java.util.Vector chains)