DESY ACOP Beans Home

com.cosylab.gui.components.gauger
Class ThinNeedle

java.lang.Object
  extended by com.cosylab.gui.components.gauger.ThinNeedle
All Implemented Interfaces:
ActiveElement

public class ThinNeedle
extends java.lang.Object
implements ActiveElement

Component defining and rendering the needle.

Version:
$id$
Author:
Ales Pucelj

Field Summary
protected  ScaleTransform transform
           
 
Constructor Summary
ThinNeedle(Gauger gauger)
          Needle constructor comment.
 
Method Summary
protected  void calculatePolygon()
          Updates the polygon representation of the needle.
 java.awt.Rectangle getBounds()
          Returns bounding rectangle of needle.
 boolean isChangeSignificant()
          Returns true if needle has moved enough to require immediate redraw.
 void render(java.awt.Graphics2D g)
          Renders needle.
 void setPosition(double proportionalPosition)
          Sets position of needle in scale space coordinates.
 void setTransform(ScaleTransform transform)
          Sets transform defining the gauger.
protected  void updatePosition(double x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transform

protected ScaleTransform transform
Constructor Detail

ThinNeedle

public ThinNeedle(Gauger gauger)
Needle constructor comment.

Parameters:
gauger - on which the needle will be rendered.
Method Detail

calculatePolygon

protected void calculatePolygon()
Updates the polygon representation of the needle.


getBounds

public java.awt.Rectangle getBounds()
Returns bounding rectangle of needle.

Specified by:
getBounds in interface ActiveElement
Returns:
Bounding rectangle of needle.

isChangeSignificant

public boolean isChangeSignificant()
Returns true if needle has moved enough to require immediate redraw.

Specified by:
isChangeSignificant in interface ActiveElement
Returns:
True if needle should be redrawn immediatelly.

updatePosition

protected void updatePosition(double x)

setPosition

public void setPosition(double proportionalPosition)
Sets position of needle in scale space coordinates. Value is relative position between 0.0 and 1.0 inclusively.

Parameters:
proportionalPosition - New position of needle.

render

public void render(java.awt.Graphics2D g)
Renders needle.

Specified by:
render in interface ActiveElement
Parameters:
g - Graphics object to draw to.
See Also:
ActiveElement.render(Graphics2D)

setTransform

public void setTransform(ScaleTransform transform)
Sets transform defining the gauger. This transform is used to render the needle at appropriate position and angle.

Specified by:
setTransform in interface ActiveElement
See Also:
ActiveElement.setTransform(ScaleTransform)


Copyright © 2010. All Rights Reserved.