JLogView_.widgets
Class LGAxis

java.lang.Object
  extended by JLogView_.widgets.LGAxis

public class LGAxis
extends java.lang.Object

LGAxis is a widget represeting one axis. It can either be a vertical or an horizontal axis depending on the constructor.


Constructor Summary
LGAxis(boolean vertical)
          This is the constructor to be used, do no try a constructor without parameters as it would lead to loads of uninitialized varaibles
 
Method Summary
 void draw(java.awt.Graphics2D g, int w, int h)
          This is the drawing methods, we use Graphics2D here for the antialiasing option and also for drawing the label vertically for a vertical axis.
 int getAxisSize()
          This methods returns the size of the the axis in pixels, i.e the width is the axis is a vertical axis and the height if it is a horizontal axis.
 float getMax()
          This is methods returns the current (as oppposed to original) maximum value of this axis.
 float getMin()
          This is methods returns the current (as oppposed to original) minimum value of this axis.
 boolean isResolutionAxis()
          This methods inquires if the object is to treated as a resolution axis.
 void resetAxisRange()
          This resets the display values (current values) to the original values.
 void setLabel(javax.swing.JLabel lab)
          This sets the label to be used as the Axis display label
 void setMax(float newmax)
          This is methods sets the current (as oppposed to original) maximum value of this axis.
 void setMin(float newmin)
          This is methods sets the current (as oppposed to original) minimum value of this axis.
 void setOriginalMax(float newmax)
          This is methods sets the original maximum value of this axis.
 void setOriginalMin(float newmin)
          This is methods sets the original minimum value of this axis.
 void setOtherAxisSize(int size)
          This methods tells the object what is the size of the other axis in pixels, the only size are intersted in is the width if the axis is vertical and the height if the axis is horizontal, the other dimension does not affect the drawing of the axis.
 void setResolutionAxis(boolean res)
          This methods tells the object if it is to be treated as a resolution axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LGAxis

public LGAxis(boolean vertical)
This is the constructor to be used, do no try a constructor without parameters as it would lead to loads of uninitialized varaibles

Parameters:
vertical - a boolean to tell whether to treat this axis as a vertical axis or not
Method Detail

setResolutionAxis

public void setResolutionAxis(boolean res)
This methods tells the object if it is to be treated as a resolution axis. A resolution converts its value for the display i.e. if the axis value range is [a,b] the value displayed will be [1/sqrt(a),1/sqrt(b)]

Parameters:
res - a boolean to tell whether to treat this axis as a resolution axis or not

isResolutionAxis

public boolean isResolutionAxis()
This methods inquires if the object is to treated as a resolution axis. A resolution converts its value for the display i.e. if the axis value range is [a,b] the value displayed will be [1/sqrt(a),1/sqrt(b)]

Returns:
true if it is a resolution axis false otherwise

setLabel

public void setLabel(javax.swing.JLabel lab)
This sets the label to be used as the Axis display label

Parameters:
lab - a JLabel object containing the text, font and colour of the label
See Also:
JLabel

setOtherAxisSize

public void setOtherAxisSize(int size)
This methods tells the object what is the size of the other axis in pixels, the only size are intersted in is the width if the axis is vertical and the height if the axis is horizontal, the other dimension does not affect the drawing of the axis.

Parameters:
size - the size in pixels of the other axis

getAxisSize

public int getAxisSize()
This methods returns the size of the the axis in pixels, i.e the width is the axis is a vertical axis and the height if it is a horizontal axis.

Returns:
the size of the axis in pixels

draw

public void draw(java.awt.Graphics2D g,
                 int w,
                 int h)
This is the drawing methods, we use Graphics2D here for the antialiasing option and also for drawing the label vertically for a vertical axis. It requires the height and width of the canvas on which we are drawing the axis.

Parameters:
g - the graphic context on which to draw this axis
w - the overall width of the canvas
h - the overall height of the canvas

getMax

public float getMax()
This is methods returns the current (as oppposed to original) maximum value of this axis.

Returns:
the maximum value as a float

getMin

public float getMin()
This is methods returns the current (as oppposed to original) minimum value of this axis.

Returns:
the minimum value as a float

setMax

public void setMax(float newmax)
This is methods sets the current (as oppposed to original) maximum value of this axis.

Parameters:
newmax - the new maximum value as a float

setMin

public void setMin(float newmin)
This is methods sets the current (as oppposed to original) minimum value of this axis.

Parameters:
newmin - the new minimum value as a float

setOriginalMax

public void setOriginalMax(float newmax)
This is methods sets the original maximum value of this axis. The difference between original values and current values is better understood when we think of zooming ability. The original value is the base we need to be able to return to when we finished to zoom. The current values are the one displayed at any particular moment

Parameters:
newmax - the new maximum value as a float

setOriginalMin

public void setOriginalMin(float newmin)
This is methods sets the original minimum value of this axis. The difference between original values and current values is better understood when we think of zooming ability. The original value is the base we need to be able to return to when we finished to zoom. The current values are the one displayed at any particular moment

Parameters:
newmin - the new minimum value as a float

resetAxisRange

public void resetAxisRange()
This resets the display values (current values) to the original values.