SNMP Stack 4_12

uk.co.westhawk.visual
Class Graph

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--uk.co.westhawk.visual.Graph
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class Graph
extends javax.swing.JPanel
implements java.beans.PropertyChangeListener

The class Graph creates decoration labels around an actual (BareGraph) graph.

All the configurations of the BareGraph can be done from this class.

Version:
$Revision: 1.5 $ $Date: 2002/10/22 16:43:38 $
Author:
Birgit Arkesteijn
See Also:
BareGraph, GraphDataSet, Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Graph()
          The default constructor.
Graph(GraphDataSet d)
          The constructor with the data set.
 
Method Summary
protected  void addToGridBag(java.awt.GridBagLayout grid, java.awt.Container cont, java.awt.Component comp, int x, int y, double wx, double wy)
           
protected  void addToGridBag(java.awt.GridBagLayout grid, java.awt.Container cont, java.awt.Component comp, int x, int y, double wx, double wy, int fill)
           
protected  void addToGridBag(java.awt.GridBagLayout grid, java.awt.Container cont, java.awt.Component comp, int x, int y, double wx, double wy, int fill, int anchor)
           
protected  void addToGridBag(java.awt.GridBagLayout grid, java.awt.Container cont, java.awt.Component comp, int x, int y, double wx, double wy, int gw, int gh, int fill, int anchor)
           
 java.awt.Color getAxisColour()
          Returns the colour of the axes of the graph.
 float getAxisPercent()
          Returns the per cent size of the axes in respect to the graph.
 GraphDataSet getDataSet()
          Returns the data set that the graph displays.
 java.awt.Font getFont()
          Returns the font of the labels around the graph.
 java.awt.Color getGraphColour()
          Returns the colour of the line of the graph.
 int getMax()
          Returns the maximum value that is displayed in the graph.
 int getMin()
          Returns the minimum value that is displayed in the graph.
 boolean isAxes()
          Returns the axes mode of the graph.
 boolean isLog()
          Returns the log mode of the graph.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Implements the PropertyChangeListener.
 void setAxes(boolean b)
           Makes the graph draw the axes or not.
 void setAxisColour(java.awt.Color c)
          Sets the colour of the axes of the graph.
 void setAxisPercent(float x)
          Sets the per cent size of the axes in respect to the graph.
 void setDataSet(GraphDataSet d)
          Sets the data set that the graph displays.
 void setFont(java.awt.Font f)
          Sets the font of the labels around the graph.
 void setGraphColour(java.awt.Color c)
          Sets the colour of the line of the graph.
 void setLog(boolean b)
          Makes the graph draw the 10log() of the values or not.
 void setMax(int m)
          Sets the maximum value that is displayed in the graph.
 void setMin(int m)
          Sets the minimum value that is displayed in the graph.
 void setName(java.lang.String n)
          Sets the name (title) of the graph.
 void setUnit(java.lang.String u)
          Sets the units value of the graph.
 void setXRange(java.lang.String x)
          Sets the xrange value of the graph.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Graph

public Graph()
The default constructor. You will need to call setDataSet.
See Also:
setDataSet(uk.co.westhawk.visual.GraphDataSet)

Graph

public Graph(GraphDataSet d)
The constructor with the data set.
Parameters:
d - the data set
Method Detail

setLog

public void setLog(boolean b)
Makes the graph draw the 10log() of the values or not. The default is false.
Parameters:
b - set the 10log() version on or not
See Also:
isLog()

isLog

public boolean isLog()
Returns the log mode of the graph.
Returns:
is the graph drawing the 10log() values or not
See Also:
setLog(boolean)

setAxes

public void setAxes(boolean b)

Makes the graph draw the axes or not. The default is true.

If the axes are off only the line, with above the name, value and units are displayed.

If the axes are on the graph will have the axes, max, min and xrange displayed also.

Parameters:
b - set the axes or not
See Also:
isAxes()

isAxes

public boolean isAxes()
Returns the axes mode of the graph.
Returns:
is the graph drawing the axes or not
See Also:
setAxes(boolean)

getMin

public int getMin()
Returns the minimum value that is displayed in the graph.
Returns:
the minimum
See Also:
setMin(int)

setMin

public void setMin(int m)
Sets the minimum value that is displayed in the graph. If the axes mode is on, this value will be displayed
Parameters:
m - the minimum value
See Also:
getMin(), setAxes(boolean)

getMax

public int getMax()
Returns the maximum value that is displayed in the graph.
Returns:
the maximum value
See Also:
setMax(int)

setMax

public void setMax(int m)
Sets the maximum value that is displayed in the graph. If the axes mode is on, this value will be displayed
Parameters:
m - the maximum
See Also:
getMax(), setAxes(boolean)

setXRange

public void setXRange(java.lang.String x)
Sets the xrange value of the graph. If the axes mode is on, this string will be displayed under the x-axis. The default is Time.
Parameters:
x - the xrange string
See Also:
setAxes(boolean)

setUnit

public void setUnit(java.lang.String u)
Sets the units value of the graph. This string will be displayed above the graph. The default is (b/s).
Parameters:
u - the units string

setName

public void setName(java.lang.String n)
Sets the name (title) of the graph. This string will be displayed above the graph.
Overrides:
setName in class java.awt.Component
Parameters:
n - the name string

setFont

public void setFont(java.awt.Font f)
Sets the font of the labels around the graph.
Overrides:
setFont in class javax.swing.JComponent
Parameters:
f - the font
See Also:
getFont()

getFont

public java.awt.Font getFont()
Returns the font of the labels around the graph.
Overrides:
getFont in class java.awt.Component
Returns:
the font
See Also:
setFont(java.awt.Font)

getAxisColour

public java.awt.Color getAxisColour()
Returns the colour of the axes of the graph.
Returns:
the axes' colour
See Also:
setAxisColour(java.awt.Color)

setAxisColour

public void setAxisColour(java.awt.Color c)
Sets the colour of the axes of the graph. The default is Color.red.
Parameters:
c - the axes' colour
See Also:
getAxisColour()

getGraphColour

public java.awt.Color getGraphColour()
Returns the colour of the line of the graph.
Returns:
the line's colour
See Also:
setGraphColour(java.awt.Color)

setGraphColour

public void setGraphColour(java.awt.Color c)
Sets the colour of the line of the graph. The default is Color.blue.
Parameters:
c - the line's colour
See Also:
getGraphColour()

getAxisPercent

public float getAxisPercent()
Returns the per cent size of the axes in respect to the graph.
Returns:
the size (%) of the axes
See Also:
setAxisPercent(float)

setAxisPercent

public void setAxisPercent(float x)
Sets the per cent size of the axes in respect to the graph. The default is 5.0 %.
Parameters:
c - the size (%) of axes
See Also:
getAxisPercent()

setDataSet

public void setDataSet(GraphDataSet d)
Sets the data set that the graph displays. The last value will be displayed above the graph.
Parameters:
d - the data set.
See Also:
getDataSet()

getDataSet

public GraphDataSet getDataSet()
Returns the data set that the graph displays.
Returns:
the data set.
See Also:
setDataSet(uk.co.westhawk.visual.GraphDataSet)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Implements the PropertyChangeListener. Gets the update of the data.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - the property change event
See Also:
PropertyChangeListener

addToGridBag

protected void addToGridBag(java.awt.GridBagLayout grid,
                            java.awt.Container cont,
                            java.awt.Component comp,
                            int x,
                            int y,
                            double wx,
                            double wy)

addToGridBag

protected void addToGridBag(java.awt.GridBagLayout grid,
                            java.awt.Container cont,
                            java.awt.Component comp,
                            int x,
                            int y,
                            double wx,
                            double wy,
                            int fill)

addToGridBag

protected void addToGridBag(java.awt.GridBagLayout grid,
                            java.awt.Container cont,
                            java.awt.Component comp,
                            int x,
                            int y,
                            double wx,
                            double wy,
                            int fill,
                            int anchor)

addToGridBag

protected void addToGridBag(java.awt.GridBagLayout grid,
                            java.awt.Container cont,
                            java.awt.Component comp,
                            int x,
                            int y,
                            double wx,
                            double wy,
                            int gw,
                            int gh,
                            int fill,
                            int anchor)

SNMP Stack 4_12