edu.mssm.crover.webservices.rbde
Class CustomizedDiagramImpl1_0

java.lang.Object
  |
  +--edu.mssm.crover.webservices.rbde.CustomizedDiagramImpl1_0
All Implemented Interfaces:
CustomizedDiagram, java.io.Serializable
Direct Known Subclasses:
CustomizedDiagramImpl1_1

public class CustomizedDiagramImpl1_0
extends java.lang.Object
implements CustomizedDiagram, java.io.Serializable

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.

See Also:
Serialized Form

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  java.awt.Point Nterm_dir
           
protected  ServletCentral sc
           
protected  AnnotatedBioSequence sequence
           
 
Constructor Summary
CustomizedDiagramImpl1_0()
          Default constructor.
CustomizedDiagramImpl1_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.
 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.
 java.awt.Point getNtermDirection()
          Returns starting direction of the N-terminus.
 AnnotatedBioSequence getSequence()
          Returns the AnnotatedBioSequence set by setAnnotatedBioSequence.
protected  void obtainServletCentral()
           
 void postTransfer(UpgradableObject source)
          Post transfer operation.
protected  void rebuildImage()
          Potentially rebuilds an Image using the current settings.
protected  void repaintImage()
           
protected  void resetAll()
          Resets the state of the all variables.
protected  void resetTransient()
           
protected  void scaleImage()
           
 void setDefaultColorScheme(ResidueColorScheme colorScheme)
          Sets the default color scheme of residue glyphs.
 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 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 setNtermDirectionDown()
          Sets the starting direction of the N-terminus to go downwords.
 void setNtermDirectionUp()
          Sets the starting direction of the N-terminus to go upwords.
 void setSequence(AnnotatedBioSequence seq)
          Resets AnnotatedBioSequence to seq and resets all other fields to initial empty state.
 void transfer(UpgradableObject destination)
          Transfers the content of this CustomizedDiagram to the destination.
 
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

Nterm_dir

protected java.awt.Point Nterm_dir

sc

protected transient ServletCentral sc
Constructor Detail

CustomizedDiagramImpl1_0

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


CustomizedDiagramImpl1_0

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

Method Detail

transfer

public void transfer(UpgradableObject destination)
Transfers the content of this CustomizedDiagram to the destination.


postTransfer

public void postTransfer(UpgradableObject source)
Post transfer operation. Called by the source on the destination to give it an opportunity to initialize the part of its state that is unknown to the source. The destination can use the source reference to obtain any required extra information that was not initialized during #transfer().


setSequence

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

Specified by:
setSequence in interface CustomizedDiagram

getSequence

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

Specified by:
getSequence in interface CustomizedDiagram
See Also:
setAnnotatedBioSequence

setNtermDirectionUp

public void setNtermDirectionUp()
Sets the starting direction of the N-terminus to go upwords.

Specified by:
setNtermDirectionUp in interface CustomizedDiagram

setNtermDirectionDown

public void setNtermDirectionDown()
Sets the starting direction of the N-terminus to go downwords.

Specified by:
setNtermDirectionDown in interface CustomizedDiagram

getNtermDirection

public java.awt.Point getNtermDirection()
Returns starting direction of the N-terminus.

Specified by:
getNtermDirection in interface CustomizedDiagram
See Also:
setNtermDirectionUp, setNtermDirectionDown

getColorAnnotationsColorScheme

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

Specified by:
getColorAnnotationsColorScheme in interface CustomizedDiagram

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.

Specified by:
setDefaultColorScheme in interface CustomizedDiagram

getDefaultColorScheme

public ResidueColorScheme getDefaultColorScheme()
Returns the current default ResidueColorScheme.

Specified by:
getDefaultColorScheme in interface CustomizedDiagram
See Also:
setDefaultColorScheme

getImageScaleFactor

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

Specified by:
getImageScaleFactor in interface CustomizedDiagram
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.

Specified by:
setImageScaleFactor in interface CustomizedDiagram
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.

Specified by:
setNeedRebuildImage in interface CustomizedDiagram

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.

Specified by:
setNeedRepaintImage in interface CustomizedDiagram

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).

Specified by:
getImage in interface CustomizedDiagram
See Also:
setNeedRebuildImage()

getDiagram

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

Specified by:
getDiagram in interface CustomizedDiagram

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.

Specified by:
getImageTime in interface CustomizedDiagram

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.


repaintImage

protected void repaintImage()

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.

Specified by:
setElipses in interface CustomizedDiagram

getElipses

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

Specified by:
getElipses in interface CustomizedDiagram
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.

Specified by:
flush in interface CustomizedDiagram

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.

Specified by:
dispose in interface CustomizedDiagram


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