org.simBio.sim.analyzer.graph
Class Viewer

java.lang.Object
  extended by org.simBio.core.Component
      extended by org.simBio.core.Parameter
          extended by org.simBio.core.Composite
              extended by org.simBio.core.Analyzer
                  extended by org.simBio.sim.analyzer.VisualizeAnalyzer
                      extended by org.simBio.sim.analyzer.graph.Viewer
All Implemented Interfaces:
Node, IViewer

public class Viewer
extends VisualizeAnalyzer
implements IViewer

Graph viewer.

Version:
$Id: Viewer.java,v 1.3 2007/02/07 03:13:03 nsarai Exp $
Author:
Nobuaki Sarai, misaki

Field Summary
protected static Log log
           
 double referenceHeight
           
 double referenceWidth
           
 
Fields inherited from class org.simBio.core.Parameter
value
 
Constructor Summary
Viewer()
           
 
Method Summary
protected  void analyze(double t)
          Carries out a redrawing operation only when necessary.
 void changeScale()
          Carries out the necessary preparation for redrawing, when the display position/display area changes. Currently it entrusts the operation to repaint().
protected  void end()
          called at the end of integration,
計算終了時に呼ばれます。
 java.awt.Container getContainer()
          Gets the container.
 java.lang.String getFileName()
          Gets an XML file name.
 double getWHratio()
           
 boolean isResizing()
          Checks whether or not the screen is being redrawn.
 void paintComponent(java.awt.Graphics graphic)
          Draws a screen of the Viewer.
protected  void prepare()
          親が自分と同じ名前のpublic doubleを持っていれば、自分の値を設定する。
 void prepareRepaint()
          再描画を準備する.
 void printComponent(java.awt.Graphics graphic)
          Carries out drawing for Viewer printing.
protected  void quit()
          Dispose of graphics and OnScreen.
 void repaint()
          再描画パラメータの取り込みと、再描画を行う.
 void setContainer(java.awt.Container container)
          Sets the container.
 void setFileName(java.lang.String string)
          Sets an XML file name.
protected  void setLinks()
          When there are no container, construct OnScreen, and clear.
 void setPrintableRect(java.awt.Rectangle rectangle)
          Sets the printing area intrinsic to the printer. Before printing, please set the printable area information intrinsic to the printer, which can be obtained from javax.print.attribute.standard.MediaPrintableArea.
 void setPrintRect(java.awt.Rectangle rectangle)
          Sets the printing area which was set with a dialog. Before printing, please set the printable area (Imageable) information, which can be obtained from java.awt.print.PageFormat.
 void setRepaintFlag()
          Orders the redrawing of the screen. {@.en The actual redrawing is done the next time the analyze() method of Viewer is called.
 
Methods inherited from class org.simBio.sim.analyzer.VisualizeAnalyzer
doRepaint, getColorParameter, getDouble, getFontParameter, getNodeHierarchically, getNodeRecursive, resetBuffer
 
Methods inherited from class org.simBio.core.Composite
accept, getLink, getNode, getNodesIterator, getNodesSize
 
Methods inherited from class org.simBio.core.Parameter
addValue, getValue, getValueString, setInitializer, setValue, setValueString, setValueToField
 
Methods inherited from class org.simBio.core.Component
addDydt, getIndent, getIndentedShortName, getName, getName, getParent, getRoot, getShortName, getUnits, isNamed, isPrefixed, logIndented
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.simBio.core.Node
addDydt, addValue, getValue, setValue
 

Field Detail

log

protected static Log log

referenceWidth

public double referenceWidth

referenceHeight

public double referenceHeight
Constructor Detail

Viewer

public Viewer()
Method Detail

setContainer

public void setContainer(java.awt.Container container)
Sets the container.

Specified by:
setContainer in interface IViewer
Parameters:
container - The container to set

getContainer

public java.awt.Container getContainer()
Gets the container.

Returns:
The container

setLinks

protected void setLinks()
When there are no container, construct OnScreen, and clear.

Overrides:
setLinks in class Component
See Also:
OnScreen, Component.setLinks()

prepare

protected void prepare()
Description copied from class: Parameter
親が自分と同じ名前のpublic doubleを持っていれば、自分の値を設定する。

Overrides:
prepare in class Parameter
See Also:
Component.prepare()

repaint

public void repaint()
Description copied from class: VisualizeAnalyzer
再描画パラメータの取り込みと、再描画を行う. 表示位置、フォントサイズ等の画面パラメータが変更された際や、 計算終了時等の、画面の再描画を行う際に呼ばれます。
  1. 表示のTopになるViewerでは、Node間の関連があるために、下記の処理が行われます。
    1. 画面パラメータを取り込むために、 配下の全Node の prepareRepaint()が呼ばれます。
    2. 再描画を行うために、配下の全Node の doRepaint() が呼ばれます。
  2. 下位のNodeであるGraph, Axisでは、上位のNode(Viewer)に処理を任せます。

Overrides:
repaint in class VisualizeAnalyzer

prepareRepaint

public void prepareRepaint()
Description copied from class: VisualizeAnalyzer
再描画を準備する. 指定したNodeおよび配下のNodeについて、再描画の準備を行います。 GUIからグラフ領域を更新する際、必ず、doRepaint() メソッドの前に呼び出すこと。
クラス実装上の扱い

Overrides:
prepareRepaint in class VisualizeAnalyzer

paintComponent

public void paintComponent(java.awt.Graphics graphic)
Draws a screen of the Viewer.

Specified by:
paintComponent in interface IViewer
Parameters:
graphic - Graphics drawing object

printComponent

public void printComponent(java.awt.Graphics graphic)
Carries out drawing for Viewer printing.

Specified by:
printComponent in interface IViewer
Parameters:
graphic - Graphics drawing object

end

protected void end()
Description copied from class: Component
called at the end of integration,
計算終了時に呼ばれます。

Overrides:
end in class Component

quit

protected void quit()
Dispose of graphics and OnScreen.

Overrides:
quit in class Component
See Also:
OnScreen, Component.quit()

analyze

protected void analyze(double t)
Carries out a redrawing operation only when necessary.

Specified by:
analyze in class VisualizeAnalyzer
Parameters:
t - time
See Also:
Analyzer.analyze(double)

setRepaintFlag

public void setRepaintFlag()
Orders the redrawing of the screen. The actual redrawing is done the next time the analyze() method of Viewer is called. In other words, by calling analyze() in Graph, Axis, the screen can be renewed in one batch.


getFileName

public java.lang.String getFileName()
Gets an XML file name.

Returns:
XML file name

setFileName

public void setFileName(java.lang.String string)
Sets an XML file name.

Specified by:
setFileName in interface IViewer
Parameters:
string - XML file name

changeScale

public void changeScale()
Carries out the necessary preparation for redrawing, when the display position/display area changes. Currently it entrusts the operation to repaint().


isResizing

public boolean isResizing()
Checks whether or not the screen is being redrawn.

Returns:
if true, then it is redrawing

setPrintRect

public void setPrintRect(java.awt.Rectangle rectangle)
Sets the printing area which was set with a dialog. Before printing, please set the printable area (Imageable) information, which can be obtained from java.awt.print.PageFormat.

Specified by:
setPrintRect in interface IViewer
Parameters:
rectangle - printing area
See Also:
PageFormat

setPrintableRect

public void setPrintableRect(java.awt.Rectangle rectangle)
Sets the printing area intrinsic to the printer. Before printing, please set the printable area information intrinsic to the printer, which can be obtained from javax.print.attribute.standard.MediaPrintableArea.

Specified by:
setPrintableRect in interface IViewer
Parameters:
rectangle - printable area
See Also:
MediaPrintableArea

getWHratio

public double getWHratio()
Specified by:
getWHratio in interface IViewer
Returns:
referenceWidth / target.referenceHeight
See Also:
IViewer.getWHratio()


Copyright © 2002-2008 Cell/Biodinamics simulation project. All Rights Reserved.