edu.mssm.crover.domain2d.rbdg
Class CustomizedDiagramImpl4_0

java.lang.Object
  |
  +--edu.mssm.crover.domain2d.rbdg.CustomizedDiagramImpl4_0

public class CustomizedDiagramImpl4_0
extends java.lang.Object

Encapsulates all necessary diagram components for storage. Contains functionality to rebuild or repaint the diagram. Due to the transfer mechanism to support different versions of the interface/implementation, this class must NOT use private fiels or methods. The higher level of restriction is protected (everything should be available to a subclass). NB. The ServletCentral instance can be not available in a context where the CustomizedDiagram is deserialized outside of the servlet engine.


Field Summary
protected  ColorAnnotationsColorScheme cacs
           
protected  ResidueColorScheme defaultColorScheme
           
protected  Diagram diagram
           
protected  boolean[] elipsOK
           
protected  java.awt.Image image
           
protected  double image_scale_factor
           
protected  boolean image_time_adjusted_in_advance
           
protected  long last_image_time
           
protected  boolean need_rebuild_image
           
protected  boolean need_repaint_image
           
protected  ServletCentral sc
           
protected  AnnotatedBioSequence sequence
           
 
Constructor Summary
CustomizedDiagramImpl4_0()
          Default constructor.
CustomizedDiagramImpl4_0(AnnotatedBioSequence sequence)
          Constructor from a sequence.
 
Method Summary
protected  Elipses adjustLoopParameters(FreeLoop fl, Domain2D_Annotation.LayoutInfo li, Elipses el)
           
protected  Elipses calculateElipses(int loop_start, int loop_end)
           
 void dispose()
          Dispose of the ressources used by this CustomizedDiagram.
 void flush()
          Flush the ressources used by this CustomizedDiagram.
static void fullGC()
          Performes full Garbage collection.
 ColorAnnotationsColorScheme getColorAnnotationsColorScheme()
          Returns ColorAnnotationsCollorScheme that encapsulates the color scheme for residue glyphs.
 ResidueColorScheme getDefaultColorScheme()
          Returns the current default ResidueColorScheme.
 int getDefaultResidueShape()
           
 Diagram getDiagram()
          Returns Diagram representation of the sequence diagram.
 boolean getElipses(int residue)
          Returns the elipsable state of the residue.
 java.awt.Image getImage()
          Returns the image rendcered for this customized diagram.
 double getImageScaleFactor()
          Returns the the scale ratio for the image.
 long getImageTime()
          Returns time the last image has been rebuild or repainted.
 int getLinkedResidueShape()
           
 AnnotatedBioSequence getSequence()
          Returns the AnnotatedBioSequence set by setAnnotatedBioSequence.
protected  void obtainServletCentral()
           
protected  void rebuildImage()
          Potentially rebuilds an Image using the current settings.
protected  void repaintImage()
           
protected  void repaintLastMinute()
           
protected  void resetAll()
          Resets the state of the all variables.
protected  void resetTransient()
           
protected  void scaleImage()
           
 void setD2DA(Domain2D_Annotation d2da)
           
 void setDefaultColorScheme(ResidueColorScheme colorScheme)
          Sets the default color scheme of residue glyphs.
 void setDefaultResidueShape(int shape)
           
 void setElipses(int residue, boolean elipsesOK)
          Sets the state of the residue to be or not to be able to be included in elipsis.
 void setImageScaleFactor(double scale_factor)
          Sets the scale ratio for the image returned by getImage().
protected  void setImageTime()
           
 void setLinkedResidueShape(int shape)
           
 void setNeedRebuildImage()
          After calling this method the image returned next by getImage() will be rebuilded first.
 void setNeedRepaintImage()
          After calling this method the image returned next by getImage() will be repainted first.
 void setSequence(AnnotatedBioSequence seq)
          Resets AnnotatedBioSequence to seq and resets all other fields to initial empty state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sequence

protected AnnotatedBioSequence sequence

diagram

protected transient Diagram diagram

image

protected transient java.awt.Image image

cacs

protected ColorAnnotationsColorScheme cacs

defaultColorScheme

protected ResidueColorScheme defaultColorScheme

elipsOK

protected boolean[] elipsOK

need_rebuild_image

protected boolean need_rebuild_image

need_repaint_image

protected boolean need_repaint_image

last_image_time

protected long last_image_time

image_time_adjusted_in_advance

protected boolean image_time_adjusted_in_advance

image_scale_factor

protected double image_scale_factor

sc

protected transient ServletCentral sc
Constructor Detail

CustomizedDiagramImpl4_0

public CustomizedDiagramImpl4_0(AnnotatedBioSequence sequence)
Constructor from a sequence. Creates a CustomizedDiagram initialized with a sequence.


CustomizedDiagramImpl4_0

public CustomizedDiagramImpl4_0()
Default constructor. Creates an empty CustomizedDiagram - no annotated sequence, nothing.

Method Detail

setSequence

public void setSequence(AnnotatedBioSequence seq)
Resets AnnotatedBioSequence to seq and resets all other fields to initial empty state.


setD2DA

public void setD2DA(Domain2D_Annotation d2da)

getSequence

public AnnotatedBioSequence getSequence()
Returns the AnnotatedBioSequence set by setAnnotatedBioSequence.

See Also:
setAnnotatedBioSequence

getColorAnnotationsColorScheme

public ColorAnnotationsColorScheme getColorAnnotationsColorScheme()
Returns ColorAnnotationsCollorScheme that encapsulates the color scheme for residue glyphs.


setDefaultColorScheme

public void setDefaultColorScheme(ResidueColorScheme colorScheme)
Sets the default color scheme of residue glyphs. When no other color is specified for a particular residue glyph, it defaults to color set by this ResidueColorScheme.


getDefaultColorScheme

public ResidueColorScheme getDefaultColorScheme()
Returns the current default ResidueColorScheme.

See Also:
setDefaultColorScheme

getImageScaleFactor

public double getImageScaleFactor()
Returns the the scale ratio for the image.

See Also:
setImageScaleFactor

setImageScaleFactor

public void setImageScaleFactor(double scale_factor)
Sets the scale ratio for the image returned by getImage(). Accepted values are double between 0 and 1.

See Also:
getImage

setNeedRebuildImage

public void setNeedRebuildImage()
After calling this method the image returned next by getImage() will be rebuilded first. Is called when the layout of the residue glyphs changes.


setNeedRepaintImage

public void setNeedRepaintImage()
After calling this method the image returned next by getImage() will be repainted first. Is being used when the layout of the residue glyphs does not change, but the colors do.


getImage

public java.awt.Image getImage()
Returns the image rendcered for this customized diagram. The rendering occurs now unless it was done before and the customized diagram has not been signaled that a change occured (it can detect some changes by itself, ie elipses, others must be signaled to it explicitely).

See Also:
setNeedRebuildImage()

getDiagram

public Diagram getDiagram()
Returns Diagram representation of the sequence diagram.


getImageTime

public long getImageTime()
Returns time the last image has been rebuild or repainted. If there is an outstanding request for rebuilding or repainting the Image (before the getImage() has been called), generates new time. In that case the rebuilding or repainting performed by next request of getImage() does not change this time.


resetTransient

protected void resetTransient()

obtainServletCentral

protected void obtainServletCentral()

resetAll

protected void resetAll()
Resets the state of the all variables. Called by the constructor to factorize operations.

See Also:
#resetTransient.

rebuildImage

protected void rebuildImage()
Potentially rebuilds an Image using the current settings.


setLinkedResidueShape

public void setLinkedResidueShape(int shape)

setDefaultResidueShape

public void setDefaultResidueShape(int shape)

getLinkedResidueShape

public int getLinkedResidueShape()

getDefaultResidueShape

public int getDefaultResidueShape()

repaintImage

protected void repaintImage()

repaintLastMinute

protected void repaintLastMinute()

scaleImage

protected void scaleImage()

setImageTime

protected void setImageTime()

calculateElipses

protected Elipses calculateElipses(int loop_start,
                                   int loop_end)

adjustLoopParameters

protected Elipses adjustLoopParameters(FreeLoop fl,
                                       Domain2D_Annotation.LayoutInfo li,
                                       Elipses el)

setElipses

public void setElipses(int residue,
                       boolean elipsesOK)
Sets the state of the residue to be or not to be able to be included in elipsis.


getElipses

public boolean getElipses(int residue)
Returns the elipsable state of the residue.

See Also:
setElipses

fullGC

public static void fullGC()
Performes full Garbage collection.


flush

public void flush()
Flush the ressources used by this CustomizedDiagram. Any information that can be restored at the expense of more computation is disposed off. The customized diagram is still functional.


dispose

public void dispose()
Dispose of the ressources used by this CustomizedDiagram. After this method has been called, the CustomizedDiagram made every effort to release ressources and is not functional anymore. The sequence, image and diagram are destroyed.



Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.