DESY ACOP Beans Home

com.cosylab.gui.components
Class DialKnob.Renderer

java.lang.Object
  extended by com.cosylab.gui.components.DialKnob.Renderer
All Implemented Interfaces:
TickParameters
Enclosing class:
DialKnob

protected class DialKnob.Renderer
extends java.lang.Object
implements TickParameters

Utility class that rendering of the component

Author:
Nejc Kosnik

Constructor Summary
protected DialKnob.Renderer()
           
 
Method Summary
 void checkValue()
           
 void clearBuffer()
          Clears all buffered image resources, so they all have to be created during the next repaint.
 void clearScale()
          Clears scale image, so it has to be reconstructed on the next repaint.
 java.lang.String formatNumber(double x)
          Formats the input value to a specific print format.
 void initialize(java.awt.Graphics2D g2d)
          Gathers vital information about this component such as width, height, font metrics and where to place the knob.
 int measureTick(double position, java.lang.String text)
          Returns size of tick label in pixels.
 void paintKnob(java.awt.Graphics2D g2d)
          Paints the Round shape representing the dial knob.
 void paintMarker(java.awt.Graphics2D g2d)
          Paints the marker of the DialKnob denoting the value set by the user.
 void paintTicks(java.awt.Graphics2D g2d)
          Paints the ticks of the DialKnob.
 void paintTitleLabel(java.awt.Graphics2D g2d)
          Paints the title title on the top of the dial knob.
 void paintValueLabel(java.awt.Graphics2D g2d)
          Paints the value title in the middle of the dial knob.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialKnob.Renderer

protected DialKnob.Renderer()
Method Detail

checkValue

public void checkValue()

clearBuffer

public void clearBuffer()
Clears all buffered image resources, so they all have to be created during the next repaint.


clearScale

public void clearScale()
Clears scale image, so it has to be reconstructed on the next repaint. Typically called when scale range changes or when component is resized.


initialize

public void initialize(java.awt.Graphics2D g2d)
Gathers vital information about this component such as width, height, font metrics and where to place the knob. Has to be called before any painting methods to ensure proper rendering.

Parameters:
g2d - graphics representing this component

measureTick

public int measureTick(double position,
                       java.lang.String text)
Description copied from interface: TickParameters
Returns size of tick label in pixels. Size is determined as distance between maximum extent of the label along the tick axis.

Specified by:
measureTick in interface TickParameters
Parameters:
position - relative position of the tick on 0..1.
text - label to display, may be empty string or null.
Returns:
size of tick in pixels.

paintKnob

public void paintKnob(java.awt.Graphics2D g2d)
Paints the Round shape representing the dial knob.

Parameters:
g2d - graphics representing this component

paintMarker

public void paintMarker(java.awt.Graphics2D g2d)
Paints the marker of the DialKnob denoting the value set by the user.

Parameters:
g2d - graphics representing this component

paintTicks

public void paintTicks(java.awt.Graphics2D g2d)
Paints the ticks of the DialKnob.

Parameters:
g2d - graphics representing this component

paintTitleLabel

public void paintTitleLabel(java.awt.Graphics2D g2d)
Paints the title title on the top of the dial knob.

Parameters:
g2d - graphics representing this component

paintValueLabel

public void paintValueLabel(java.awt.Graphics2D g2d)
Paints the value title in the middle of the dial knob.

Parameters:
g2d - graphics representing this component

formatNumber

public java.lang.String formatNumber(double x)
Description copied from interface: TickParameters
Formats the input value to a specific print format. If return value is null use internal format specified by the caller of this method.

Specified by:
formatNumber in interface TickParameters
Parameters:
x - double to be formatted
Returns:
formatted value


Copyright © 2010. All Rights Reserved.