DESY ACOP Beans Home

com.cosylab.gui.components.gauger
Interface ActiveElement

All Known Implementing Classes:
Needle, ThinNeedle

public interface ActiveElement

Interface specifies a graphical element, that needs is relatively small in size and needs to be drawn very often over the prerendered scale. The methods specified are sufficied for the Gauger to perform optimized rendering when the location of the element changes.

Version:
$id$
Author:
Ales Pucelj

Method Summary
 java.awt.Rectangle getBounds()
          Returns the extents of this object.
 boolean isChangeSignificant()
          Returns whether the element has changed significantly since it was last redrawn.
 void render(java.awt.Graphics2D g)
          Performs the rendering of the element.
 void setTransform(ScaleTransform transform)
          Notifies the element that the transformation used to draw this scale has changed.
 

Method Detail

getBounds

java.awt.Rectangle getBounds()
Returns the extents of this object. This method must return the bounding box of the element. The area can be larger, but it must not be smaller, or visual appearance of the gauger will be corrupted.

Returns:
Bounding rectangle.

render

void render(java.awt.Graphics2D g)
Performs the rendering of the element. The element should perform the neccesary space transform to obtain the coordinates to draw to.

Parameters:
g - Graphics object to draw to.
transform - transformation defining the scale.

isChangeSignificant

boolean isChangeSignificant()
Returns whether the element has changed significantly since it was last redrawn. If this element has the same position as the last time it was redrawn and its visual appearance has not changed, then this method should return false. If the result is true, the component will be redrawn. This method is used to minimize the number of redraws.

Returns:
True if change is signifficant.

setTransform

void setTransform(ScaleTransform transform)
Notifies the element that the transformation used to draw this scale has changed. The element must recalculate its position and bounds as it will be redrawn.



Copyright © 2010. All Rights Reserved.