fr.esrf.tangoatk.widget.util.jdraw
Class JDAxis

java.lang.Object
  extended by fr.esrf.tangoatk.widget.util.jdraw.JDObject
      extended by fr.esrf.tangoatk.widget.util.jdraw.JDRectangular
          extended by fr.esrf.tangoatk.widget.util.jdraw.JDAxis

public class JDAxis
extends JDRectangular

JDraw Axis graphic object. JDAxis allows to build easily sizeable gauges, it supports Font, Label format, auto labelling, and tick.

Here is an example of few JDAxis:

JDAxis examples


Field Summary
static int AUTO_FORMAT
          Use default compiler format to display double
static int BININT_FORMAT
          Display integer using binary format (%b)
static int DECINT_FORMAT
          Display integer using decimal format (%d)
static int HEXINT_FORMAT
          Display integer using haxadecimal format (%x)
static int HORIZONTAL_AXIS
          Horizontal axis
static int LEFT_LABEL
          Labels are at the left of the axis (Vertical axis only)
static int LINEAR_SCALE
          Linear scale
static int LOG_SCALE
          Logarithmic scale
static int RIGHT_LABEL
          Labels are at the right of the axis (Vertical axis only)
static int SCIENTIFIC_FORMAT
          Display value using exponential representation (x.xxEyy)
static int SCIENTIFICINT_FORMAT
          Display value using exponential representation (xEyy)
static int TIME_FORMAT
          Display number of second as HH:MM:SS
static int VERTICAL_AXIS
          Vertical axis
 
Fields inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDObject
FILL_STYLE_DOT_PATTERN_1, FILL_STYLE_DOT_PATTERN_2, FILL_STYLE_DOT_PATTERN_3, FILL_STYLE_GRADIENT, FILL_STYLE_LARGE_CROSS_HATCH, FILL_STYLE_LARGE_LEFT_HATCH, FILL_STYLE_LARGE_RIGHT_HATCH, FILL_STYLE_NONE, FILL_STYLE_SMALL_CROSS_HATCH, FILL_STYLE_SMALL_LEFT_HATCH, FILL_STYLE_SMALL_RIGHT_HATCH, FILL_STYLE_SOLID, LINE_STYLE_DASH, LINE_STYLE_DASH_DOT, LINE_STYLE_DOT, LINE_STYLE_LONG_DASH, LINE_STYLE_SOLID, VALUE_CHANGE_ON_XDRAG_LEFT, VALUE_CHANGE_ON_XDRAG_RIGHT, VALUE_CHANGE_ON_YDRAG_BOTTOM, VALUE_CHANGE_ON_YDRAG_TOP, VALUE_INC_ON_CLICK, VALUE_INC_ON_PRESSRELEASE
 
Constructor Summary
JDAxis(java.lang.String objectName, int x, int y, int w, int h)
          Consttruc a JDAxis object.
 
Method Summary
 JDObject copy(int x, int y)
          Returns a copy of this object at the specified location.
 java.awt.Font getFont()
          Returns the label font.
 int getFormat()
          Returns the label format of this axis.
 int getLabelPos()
          Returns the current label positionning policy.
 double getMax()
          Returns the max value of this axis.
 double getMin()
          Returns the min value of this axis.
 int getOrientation()
          Returns the orientation of this axis.
 int getScale()
          Returns the scale of this axis.
 int getTickSpacing()
          Returns the current axis spacing (in pixel).
 int getTickWidth()
          Returns the current axis tick width.
 boolean hasShadow()
          Returns true only if this object is shadowed.
 boolean isInverted()
          Determines whether this axis is inverted.
 boolean isTickCentered()
          Determines whether axis ticks are centered.
 void paint(JDrawEditor parent, java.awt.Graphics g)
          Paints this object.
 void setFont(java.awt.Font f)
          Sets the label font of this axis.
 void setForeground(java.awt.Color f)
          Sets the foreground color (usualy line color) of this object.
 void setFormat(int f)
          Sets the label format of this axis.
 void setInverted(boolean i)
          Invert or not this axis.
 void setLabelPos(int pos)
          Sets the label positionning policy.
 void setMax(double m)
          Sets the max value of this axis.
 void setMin(double m)
          Sets the min value of this axis.
 void setOrientation(int o)
          Sets the axis orientation.
 void setScale(int s)
          Sets the scale of this axis.
 void setTickCentered(boolean center)
          Centers or not axis tick.
 void setTickSpacing(int spacing)
          Sets the minimum tick spacing (in pixel).
 void setTickWidth(int width)
          Sets the axis tick width.
 
Methods inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDRectangular
moveSummit, rotate90
 
Methods inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDObject
addExtension, addMouseListener, addValueListener, centerOrigin, clearMouseListener, clearValueListener, getBackground, getBackgroundMapper, getBoundRect, getExtendedParam, getExtendedParam, getExtendedParamDesc, getExtendedParamIndex, getExtendedParamName, getExtendedParamNumber, getFillStyle, getForeground, getForegroundMapper, getHTranslationMapper, getInitValue, getInvertShadowMapper, getLineStyle, getLineWidth, getMaxValue, getMinValue, getName, getObjectsByName, getOrigin, getShadowWidth, getSummit, getSummitNumber, getValue, getValueChangeMode, getVisibilityMapper, getVTranslationMapper, hasBackgroundMapper, hasExtendedParam, hasForegroundMapper, hasHTranslationMapper, hasInverseShadow, hasInvertShadowMapper, hasVisibilityMapper, hasVTranslationMapper, isAntiAliased, isFixedExtendedParam, isInsideObject, isInteractive, isProgrammed, isVisible, moveSummitH, moveSummitV, preRefresh, refresh, removeExtension, removeMouseListener, removeValueListener, restoreTransform, saveTransform, scale, scaleTranslate, setAntiAlias, setBackground, setBackgroundMapper, setExtendedParam, setExtendedParam, setExtensionList, setFillStyle, setForegroundMapper, setGradientFillParam, setHTranslationMapper, setInitValue, setInteractive, setInverseShadow, setInvertShadowMapper, setLineStyle, setLineWidth, setMaxValue, setMinValue, setName, setOrigin, setShadow, setShadowWidth, setValue, setValueChangeMode, setVisibilityMapper, setVisible, setVTranslationMapper, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HORIZONTAL_AXIS

public static final int HORIZONTAL_AXIS
Horizontal axis

See Also:
Constant Field Values

VERTICAL_AXIS

public static final int VERTICAL_AXIS
Vertical axis

See Also:
Constant Field Values

LEFT_LABEL

public static final int LEFT_LABEL
Labels are at the left of the axis (Vertical axis only)

See Also:
Constant Field Values

RIGHT_LABEL

public static final int RIGHT_LABEL
Labels are at the right of the axis (Vertical axis only)

See Also:
Constant Field Values

LINEAR_SCALE

public static final int LINEAR_SCALE
Linear scale

See Also:
Constant Field Values

LOG_SCALE

public static final int LOG_SCALE
Logarithmic scale

See Also:
Constant Field Values

AUTO_FORMAT

public static final int AUTO_FORMAT
Use default compiler format to display double

See Also:
Constant Field Values

SCIENTIFIC_FORMAT

public static final int SCIENTIFIC_FORMAT
Display value using exponential representation (x.xxEyy)

See Also:
Constant Field Values

TIME_FORMAT

public static final int TIME_FORMAT
Display number of second as HH:MM:SS

See Also:
Constant Field Values

DECINT_FORMAT

public static final int DECINT_FORMAT
Display integer using decimal format (%d)

See Also:
Constant Field Values

HEXINT_FORMAT

public static final int HEXINT_FORMAT
Display integer using haxadecimal format (%x)

See Also:
Constant Field Values

BININT_FORMAT

public static final int BININT_FORMAT
Display integer using binary format (%b)

See Also:
Constant Field Values

SCIENTIFICINT_FORMAT

public static final int SCIENTIFICINT_FORMAT
Display value using exponential representation (xEyy)

See Also:
Constant Field Values
Constructor Detail

JDAxis

public JDAxis(java.lang.String objectName,
              int x,
              int y,
              int w,
              int h)
Consttruc a JDAxis object.

Parameters:
objectName - Object name
x - Up left corner x coordinate
y - Up left corner y coordinate
w - Widht (pixel)
h - Height (pixel)
Method Detail

copy

public JDObject copy(int x,
                     int y)
Description copied from class: JDObject
Returns a copy of this object at the specified location.

Specified by:
copy in class JDObject
Parameters:
x - Horizontal position of the copied object (pixel)
y - Vertical Position of the copied object (pixel)
Returns:
The copy of this object.

paint

public void paint(JDrawEditor parent,
                  java.awt.Graphics g)
Description copied from class: JDObject
Paints this object.

Overrides:
paint in class JDRectangular
Parameters:
parent - JdrawEditor parent (Can be null except for JDSwingObject)
g - the specified Graphics window

hasShadow

public boolean hasShadow()
Description copied from class: JDObject
Returns true only if this object is shadowed.

Overrides:
hasShadow in class JDObject

setForeground

public void setForeground(java.awt.Color f)
Description copied from class: JDObject
Sets the foreground color (usualy line color) of this object. This color is also used for base shadow color.

Overrides:
setForeground in class JDObject
Parameters:
f - Foreground color

setFont

public void setFont(java.awt.Font f)
Sets the label font of this axis.

Parameters:
f - Axis label font

getFont

public java.awt.Font getFont()
Returns the label font.

See Also:
setFont(java.awt.Font)

setTickCentered

public void setTickCentered(boolean center)
Centers or not axis tick.

Parameters:
center - True to center tick.
See Also:
setTickWidth(int)

isTickCentered

public boolean isTickCentered()
Determines whether axis ticks are centered.

Returns:
true if tick are centered.
See Also:
setTickCentered(boolean)

setTickWidth

public void setTickWidth(int width)
Sets the axis tick width. Passing a negative value will result in displaying tick on the other side of the axis. If tick are centered , negative and positive value will have the same effects.

Parameters:
width - Tick width
See Also:
setTickCentered(boolean)

getTickWidth

public int getTickWidth()
Returns the current axis tick width.

See Also:
setTickWidth(int)

setTickSpacing

public void setTickSpacing(int spacing)
Sets the minimum tick spacing (in pixel). Allows to control the number of generated labels.

Parameters:
spacing - Minimum tick spacing

getTickSpacing

public int getTickSpacing()
Returns the current axis spacing (in pixel).

See Also:
setTickSpacing(int)

setMax

public void setMax(double m)
Sets the max value of this axis.

Parameters:
m - Max value

setMin

public void setMin(double m)
Sets the min value of this axis.

Parameters:
m - Min value

getMax

public double getMax()
Returns the max value of this axis.

See Also:
setMax(double)

getMin

public double getMin()
Returns the min value of this axis.

See Also:
setMin(double)

setLabelPos

public void setLabelPos(int pos)
Sets the label positionning policy. Works only for vertical axis.

Parameters:
pos - Position
See Also:
LEFT_LABEL, RIGHT_LABEL

getLabelPos

public int getLabelPos()
Returns the current label positionning policy.

See Also:
setLabelPos(int)

setOrientation

public void setOrientation(int o)
Sets the axis orientation.

Parameters:
o - Orientation value
See Also:
HORIZONTAL_AXIS, VERTICAL_AXIS

getOrientation

public int getOrientation()
Returns the orientation of this axis.

See Also:
setOrientation(int)

setScale

public void setScale(int s)
Sets the scale of this axis.

Parameters:
s - Scale value
See Also:
LINEAR_SCALE, LOG_SCALE

getScale

public int getScale()
Returns the scale of this axis.

See Also:
setScale(int)

setFormat

public void setFormat(int f)
Sets the label format of this axis.

Parameters:
f - Format value
See Also:
AUTO_FORMAT, SCIENTIFIC_FORMAT, TIME_FORMAT, DECINT_FORMAT, HEXINT_FORMAT, BININT_FORMAT, SCIENTIFICINT_FORMAT

getFormat

public int getFormat()
Returns the label format of this axis.

See Also:
setFormat(int)

setInverted

public void setInverted(boolean i)
Invert or not this axis. When enabled , label are going in the opposite side of the screen orientation.

Parameters:
i - True to invert this axis.

isInverted

public boolean isInverted()
Determines whether this axis is inverted.

See Also:
setInverted(boolean)