com.adventnet.snmp.ui
Class LineGraphBean

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.adventnet.snmp.ui.LineGraphBean
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ResultListener, java.io.Serializable

public class LineGraphBean
extends javax.swing.JPanel
implements ResultListener

LineGraphBean,a bean is used to plot real-time data which supports multi-line graphing. It is used to plot SNMP data, since it implements the ResultListener, that makes it easy to connect to the SNMP data sources in the beans package.To use this component, connect it to a data source like SnmpPoller. For example,

   LineGraphBean lineGraph = new LineGraphBean();
   SnmpPoller poller = new SnmpPoller(); 
	  

   // set poller properties 
   poller.setTargetHost("localhost"); 
   poller.setObjectID("1.3.0"); 
  

   if (poller.getSnmpVersion() == poller.VERSION_3) 
   {
   	poller.setPrincipal(userName);          // Set the user who made this request 
   	poller.setAuthPassword(authPassword);   // Set password for authentication 
   	poller.setPrivPassword(privPassword);   // Set password for privacy 
   	poller.setAuthProtocol(authProtocol);   // one SHA or MD5 
   	poller.create_v3_tables();              // create SnmpEngineEntry and USMUserEntry 
   } 
   else 
   	poller.setCommunity(community); 
   

   poller.setPollInterval(5); 
   

   // set graph properties 
   graph.setTitle("Graphing sysUpTime on localhost"); 
   graph.setLineLabels("sysUpTime.0"); 
   

// attach the graph to the poller poller.addResultListener(graph); poller.setSendTimeoutEvents(true); //incase of Timeout.

The LineGraphBean can also be connected to any data sources for real time plotting data. It also supports logging of data to a text file.

Refer the example lineGraphDemo.java provided in the uiapplications directory.

See Also:
SnmpPoller, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static byte DAY
          constant used to mention the xunits in DAY
static byte HOUR
          constant used to mention the xunits in HOUR
static byte MINUTE
          constant used to mention the xunits in MINUTE
static byte MONTH
          constant used to mention the xunits in MONTH
static byte SECONDS
          constant used to mention the xunits in SECONDS
static byte WEEK
          constant used to mention the xunits in WEEK
static byte YEAR
          constant used to mention the xunits in YEAR
 
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
LineGraphBean()
          Constructs a LineGraphBean with default width and height.
LineGraphBean(int width, int height)
          Constructs a LineGraphBean with user defined width and height.
 
Method Summary
 void addMouseListener(java.awt.event.MouseListener l)
          Adds the specified mouse listener to receive mouse events.
 boolean getAbsoluteCounters()
          To get whether the value plotted by the graph should be the absolute value or the difference between successive counters.
 boolean getAbstime()
          Get whether to show relative or absolute time on the X axis.
 boolean getAutoXlabel()
          Get the status whether the bean is able to set the label for the X axis by bean itself automatically.
 java.awt.Color getBgcolor()
          Get the background color.
 java.awt.Color getFgcolor()
          Get the foreground color.
 java.awt.Color getLcolor()
          Get the primary line color.
 java.lang.String getLfontname()
          Get the labels font name, e.g Helvetica.
 int getLfontsize()
          Get the labels font size.
 java.lang.String getLfontstyle()
          Get the labels font style.
 java.awt.Color getLinecolor()
          Get the first line color.
 java.lang.String getLinecolors()
          Deprecated and Replaced by getLineColors.
 java.awt.Color[] getLineColors()
          Get line colors for multiline
 java.lang.String getLineLabels()
          Returns the labels to be used for each oid - separated by | (pipe) or space separated.
 java.lang.String getLogFileName()
          Returns the current log file name.
 int getPollDuration()
          Returns the poll Duration(in seconds).
 boolean getShowErrorMessage()
          Gets the Error Message status.
 boolean getShowtitle()
          Get whether to show a title at all.
 boolean getShowxlabel()
          Get whether to show the X label.
 boolean getShowylabel()
          Get whether to show the Y label.
 java.lang.String getTfontname()
          Get the title font name, e.g Helvetica.
 int getTfontsize()
          Get the title font size.
 java.lang.String getTfontstyle()
          Get the title font style.
 boolean getTimeavg()
          Deprecated. Use isTimeavg() instead.
 java.lang.String getTitle()
          Get the title for the graph.
 int getXdiffmax()
          Get the maximum range on on the X scale.
 int getXgrid()
          Returns the number of vertical grid lines in the graph.
 java.lang.String getXlabel()
          Get the label for the x axis
 int getXmark()
          Returns the number of value marks on X axis.
 int getXmax()
          Get the maximum value on the X scale.
 int getXmin()
          Get the minimum value on the X scale
 byte getXunits()
          Get the X Units label.
 int getYgrid()
          Returns the number of horizontal grid lines.
 java.lang.String getYlabel()
          Get the label for the y axis
 int getYmark()
          Returns the number of value marks on Y axis.
 long getYmax()
          Get the maximum value on the Y scale.
 java.math.BigInteger getYmaxAsBigInt()
          v2c and v3 only Get the maximum value on the Y scale as BigInteger.
 long getYmin()
          Get the minimum value on the Y scale.
 java.math.BigInteger getYminAsBigInt()
          Get v2c and v3 only the minimum value on the Y scale as BigInteger.
 java.lang.String getYunits()
          Get the Y units label - unsupported at this time.
 boolean isLogEnabled()
          To check whether the flag is set for storing the plotted values in a flat file.
 boolean isTimeavg()
          Get whether to time average the value shown
 java.awt.Dimension minimumSize()
          Returns the minimum size of this component.
 void paintComponent(java.awt.Graphics g)
          To paint the component.
 java.awt.Dimension preferredSize()
          Returns the preferred size of this component.
 void readPollDataFromFile(java.lang.String file)
          This method reads the data from the file given as string argument for this method and polls the data off-line.
 void removeMouseListener(java.awt.event.MouseListener l)
          Removes the specified mouse listener
 void restartGraph()
          Restart the graph for its initial State.
 void setAbsoluteCounters(boolean absoluteCounters)
          set whether counter values should be absolute or difference between successive counters.
 void setAbstime(boolean absTime)
          Set whether to show relative or absolute time on the X axis
 void setAutoXlabel(boolean autoset)
          set whether the unit value of x axis is changed according to the duration of graph time.
 void setBgcolor(java.awt.Color bgColor)
          Set the background color
 void setDataSize(int size)
          This method will set the number of lines to be plotted in the graph.
 void setFgcolor(java.awt.Color fgColor)
          Set the foreground color
 void setFont(java.awt.Font titleFont, java.awt.Font labelFont)
          sets the font for the title and label.
 void setLcolor(java.awt.Color lcolor)
          Set the primary line color.
 void setLfontname(java.lang.String lfontName)
          Set the labels font name, e.g Helvetica.
 void setLfontsize(int lfontSize)
          Set the labels font size.
 void setLfontstyle(java.lang.String lfontStyle)
          Set the labels font style.
 void setLinecolor(java.awt.Color lineColor)
          Set the first line color
 void setLineColors(java.awt.Color[] lineColors)
          Set line colors for multiline.
 void setLinecolors(java.lang.String linecolors)
          Deprecated and Replaced by setLineColors.
 void setLineLabels(java.lang.String lineLabels)
          Set the labels to be used for each oid - separated by |(pipe) or space separated.
 void setLogEnabled(boolean storeValues)
          Set the flag whether or not to store the plotted values in a flat file.
 void setLogFileName(java.lang.String graphFile)
          Set the log File name.
 void setNumericResult(long num)
          Implementation of ResultListener method - plots value incase of single value
 void setPollDuration(int time)
          Set the poll Duration(in seconds), upto which the user wants the LineGraphBean to plot for polled values.
 void setResult(java.math.BigInteger diff)
          v2c and v3 only This updates the graph with the new value.
 void setResult(int lineNum, java.math.BigInteger diff)
          v2c and v3 only This updates the graph with the new value.
 void setResult(int lineNum, long diff)
          This updates the graph with the new value.
 void setResult(long diff)
          This updates the graph with the new value.
 void setResult(ResultEvent e)
          Implementation of ResultListener method,plots values if more than one values
 void setShowErrorMessages(boolean showMessage)
          Enables or Disables error messages dialog.
 void setShowtitle(boolean showTitle)
          Set whether to show a title at all.
 void setShowxlabel(boolean showXLabel)
          Set whether to show the X label
 void setShowylabel(boolean showYLabel)
          Set whether to show the Y label.
 void setStringResult(java.lang.String value)
          Implementation of ResultListener method
 void setTfontname(java.lang.String tfontName)
          Set the title font name, e.g Helvetica.
 void setTfontsize(int tfontSize)
          Set the title font size.
 void setTfontstyle(java.lang.String tfontStyle)
          Set the title font style.
 void setTimeavg(boolean timeAvg)
          Set whether to time average the value shown.
 void setTitle(java.lang.String title)
          Sets the title for the graph.
 void setValues()
          This method sets any component values that need to be set.
 void setXdiffmax(int xDiffMax)
          Set the maximum range on the X scale.
 void setXgrid(int xGrid)
          Set the number of vertical grid lines in the graph.
 void setXlabel(java.lang.String xLabel)
          Set the label for the x axis
 void setXmark(int xMark)
          Set the number of value marks on X axis.
 void setXmax(int xMax)
          Set the maximum value on the X scale
 void setXmin(int xMin)
          Set the minimum value on the X scale
 void setXunits(byte xunits)
          Set the X Units label.
 void setYgrid(int yGrid)
          Set the number of horizontal grid lines.
 void setYlabel(java.lang.String yLabel)
          Set the label for the Y axis.
 void setYmark(int yMark)
          Set the number of value marks on Y axis.
 void setYmax(long yMax)
          Set the maximum value on the Y scale.
 void setYmaxAsBigInt(java.math.BigInteger yBigmax)
          Set v2c and v3 only the maximum value on the Y scale as BigInteger.
 void setYmin(long yMin)
          Set the minimum value on the Y scale.
 void setYminAsBigInt(java.math.BigInteger yBigMin)
          Set v2c and v3 only the minimum value on the Y scale as BigInteger.
 void setYunits(java.lang.String yUnits)
          Set the Y units label - unsupported at this time.
 void updateComponent(java.awt.Graphics g)
          Updates the component.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, paintComponents, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

YEAR

public static final byte YEAR
constant used to mention the xunits in YEAR

See Also:
Constant Field Values

MONTH

public static final byte MONTH
constant used to mention the xunits in MONTH

See Also:
Constant Field Values

DAY

public static final byte DAY
constant used to mention the xunits in DAY

See Also:
Constant Field Values

HOUR

public static final byte HOUR
constant used to mention the xunits in HOUR

See Also:
Constant Field Values

MINUTE

public static final byte MINUTE
constant used to mention the xunits in MINUTE

See Also:
Constant Field Values

SECONDS

public static final byte SECONDS
constant used to mention the xunits in SECONDS

See Also:
Constant Field Values

WEEK

public static final byte WEEK
constant used to mention the xunits in WEEK

See Also:
Constant Field Values
Constructor Detail

LineGraphBean

public LineGraphBean()
Constructs a LineGraphBean with default width and height.

See Also:

LineGraphBean

public LineGraphBean(int width,
                     int height)
Constructs a LineGraphBean with user defined width and height.

See Also:
#LineGraphBean.
Method Detail

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)
Adds the specified mouse listener to receive mouse events.

Overrides:
addMouseListener in class java.awt.Component
Parameters:
l - the mouse listener.
See Also:
removeMouseListener(java.awt.event.MouseListener)

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener l)
Removes the specified mouse listener

Overrides:
removeMouseListener in class java.awt.Component
Parameters:
l - the mouse listener.
See Also:
addMouseListener(java.awt.event.MouseListener)

getAbsoluteCounters

public boolean getAbsoluteCounters()
To get whether the value plotted by the graph should be the absolute value or the difference between successive counters.

Returns:
true if the graph will plot the absolute value of the counters and false if the graph will plot the difference between the successive counter values.

setAbsoluteCounters

public void setAbsoluteCounters(boolean absoluteCounters)
set whether counter values should be absolute or difference between successive counters. This has an impact on the results of the counter data types only. If it is set to true, the graph will plot the absolute value of the counter. If it is set to false, the graph will plot the difference between successive counter values. This will be useful for plotting the counter values.


setTitle

public void setTitle(java.lang.String title)
Sets the title for the graph.

Parameters:
title - the title of the graph.
See Also:
getTitle()

getTitle

public java.lang.String getTitle()
Get the title for the graph.

Returns:
the title set in the graph.
See Also:
setTitle(java.lang.String)

getShowtitle

public boolean getShowtitle()
Get whether to show a title at all. Avoids empty space if set to false. Default value is true.

Returns:
boolean whether to show tilte.
See Also:
#setShowTitle

setShowtitle

public void setShowtitle(boolean showTitle)
Set whether to show a title at all. Avoids empty space if set to false.

Parameters:
showTitle - boolean whether to show title or not.
See Also:
#getShowTitle

getTfontname

public java.lang.String getTfontname()
Get the title font name, e.g Helvetica. Default is Helvetica.

Returns:
fontname.
See Also:
setTfontname(java.lang.String)

setTfontname

public void setTfontname(java.lang.String tfontName)
Set the title font name, e.g Helvetica.

Parameters:
tfontName - fontname.
See Also:
getTfontname()

getTfontstyle

public java.lang.String getTfontstyle()
Get the title font style. Default style is "PLAIN"

Returns:
fontstyle.
See Also:
setTfontstyle(java.lang.String)

setTfontstyle

public void setTfontstyle(java.lang.String tfontStyle)
Set the title font style. The values should be one among the following. "PLAIN","BOLD",ITALIC". If any other values is specified, the style will be set to "PLAIN".

Parameters:
tfontStyle - string which represents the style of the font.
See Also:
getTfontstyle()

getTfontsize

public int getTfontsize()
Get the title font size. Default size is 12.

Returns:
the size of the font
See Also:
setTfontsize(int)

setTfontsize

public void setTfontsize(int tfontSize)
Set the title font size.

Parameters:
tfontSize - font size greater than zero.
See Also:
getTfontsize()

getBgcolor

public java.awt.Color getBgcolor()
Get the background color. Default background color is black.

Returns:
the color of the background.
See Also:
setBgcolor(java.awt.Color)

setBgcolor

public void setBgcolor(java.awt.Color bgColor)
Set the background color

Parameters:
bgColor - color of the background.
See Also:
getBgcolor()

getFgcolor

public java.awt.Color getFgcolor()
Get the foreground color. Default foreground color is yellow.

Returns:
the color of the foreground.
See Also:
setFgcolor(java.awt.Color)

setFgcolor

public void setFgcolor(java.awt.Color fgColor)
Set the foreground color

Parameters:
fgColor - color of the foreground.
See Also:
getFgcolor()

getLinecolor

public java.awt.Color getLinecolor()
Get the first line color. Default color is red.

Returns:
first line color.
See Also:
setLinecolor(java.awt.Color), getLcolor(), setLcolor(java.awt.Color)

setLinecolor

public void setLinecolor(java.awt.Color lineColor)
Set the first line color

Parameters:
lineColor - first line color.
See Also:
getLinecolor(), getLcolor(), setLcolor(java.awt.Color)

getXlabel

public java.lang.String getXlabel()
Get the label for the x axis

Returns:
the label of the x-axis.
See Also:
setXlabel(java.lang.String), setAutoXlabel(boolean), getAutoXlabel(), getShowxlabel()

setXlabel

public void setXlabel(java.lang.String xLabel)
Set the label for the x axis

Parameters:
xLabel - the label of the x-axis.
See Also:
getXlabel(), setAutoXlabel(boolean), getAutoXlabel(), setShowxlabel(boolean)

getAutoXlabel

public boolean getAutoXlabel()
Get the status whether the bean is able to set the label for the X axis by bean itself automatically.

Returns:
autoset boolean.
See Also:
setAutoXlabel(boolean), getShowxlabel()

setAutoXlabel

public void setAutoXlabel(boolean autoset)
set whether the unit value of x axis is changed according to the duration of graph time. For example the duration between the first unit and last unit of the xunits in graph is within the sec,the xunit value will be in seconds only.According to the duration , the xunit value will be in sec, minutes,hour,day,week,month or year.

Parameters:
autoset - boolean whether to set the unit values by the bean itself.
See Also:
getAutoXlabel(), setShowxlabel(boolean)

getYlabel

public java.lang.String getYlabel()
Get the label for the y axis

Returns:
the label of the y-axis.
See Also:
setYlabel(java.lang.String), getShowylabel()

setYlabel

public void setYlabel(java.lang.String yLabel)
Set the label for the Y axis.

Parameters:
yLabel - the label of the y-axis.
See Also:
getYlabel(), setShowylabel(boolean)

getShowxlabel

public boolean getShowxlabel()
Get whether to show the X label.

Returns:
the boolean which sets whether to show x-label or not.
See Also:
getXlabel(), setShowxlabel(boolean)

setShowxlabel

public void setShowxlabel(boolean showXLabel)
Set whether to show the X label

Parameters:
showXLabel - boolean which sets whether to show x-label or not.
See Also:
setXlabel(java.lang.String), getShowxlabel()

getShowylabel

public boolean getShowylabel()
Get whether to show the Y label.

Returns:
boolean which sets whether to show y-label or not.
See Also:
getYlabel(), setShowylabel(boolean)

setShowylabel

public void setShowylabel(boolean showYLabel)
Set whether to show the Y label.

Parameters:
showYLabel - boolean which sets whether to show y-label or not.
See Also:
setYlabel(java.lang.String), getShowylabel()

getXunits

public byte getXunits()
Get the X Units label.

Returns:
byte value of the x-units
See Also:
setXunits(byte), YEAR, MONTH, DAY, HOUR, MINUTE, SECONDS, WEEK

setXunits

public void setXunits(byte xunits)
Set the X Units label.

Parameters:
xunits - byte value of the x-units
See Also:
getXunits(), YEAR, MONTH, DAY, HOUR, MINUTE, SECONDS, WEEK

getYunits

public java.lang.String getYunits()
Get the Y units label - unsupported at this time.


setYunits

public void setYunits(java.lang.String yUnits)
Set the Y units label - unsupported at this time.


getLfontname

public java.lang.String getLfontname()
Get the labels font name, e.g Helvetica. Default is Helvetica.

Returns:
fontname.
See Also:
setLfontname(java.lang.String)

setLfontname

public void setLfontname(java.lang.String lfontName)
Set the labels font name, e.g Helvetica.

Parameters:
lfontName - fontname.
See Also:
getLfontname()

getLfontstyle

public java.lang.String getLfontstyle()
Get the labels font style. Default style is "PLAIN"

Returns:
fontstyle.
See Also:
setLfontstyle(java.lang.String)

setLfontstyle

public void setLfontstyle(java.lang.String lfontStyle)
Set the labels font style. The values should be one among the following. "PLAIN","BOLD",ITALIC". If any other values is specified, the style will be set to "PLAIN".

Parameters:
lfontStyle - fontstyle.
See Also:
getLfontstyle()

getLfontsize

public int getLfontsize()
Get the labels font size. Default is 10.

Returns:
fontsize.
See Also:
setLfontsize(int)

setLfontsize

public void setLfontsize(int lfontSize)
Set the labels font size.

Parameters:
lfontSize - fontsize greater than zero.
See Also:
getLfontsize()

getXmax

public int getXmax()
Get the maximum value on the X scale.

Returns:
max-value of the x-axis.
See Also:
setXmax(int), getXdiffmax()

setXmax

public void setXmax(int xMax)
Set the maximum value on the X scale

Parameters:
xMax - the int value for the X-axis maximum
See Also:
getXmax(), setXdiffmax(int)

getXmin

public int getXmin()
Get the minimum value on the X scale

Returns:
min value of the x-axis.
See Also:
setXmin(int)

setXmin

public void setXmin(int xMin)
Set the minimum value on the X scale

Parameters:
xMin - the int value for the X-axis minimum
See Also:
getXmin()

getAbstime

public boolean getAbstime()
Get whether to show relative or absolute time on the X axis. Default will be true the time will be shown in absolute time.

Returns:
boolean value whether the time is shown is absolute or relative
See Also:
setAbstime(boolean)

setAbstime

public void setAbstime(boolean absTime)
Set whether to show relative or absolute time on the X axis

Parameters:
absTime - boolean whether to show the time in absolute or relative
See Also:
getAbstime()

getXdiffmax

public int getXdiffmax()
Get the maximum range on on the X scale. Prevents compression of the graph if set to non-zero. If set to zero shows all values from the start compressing the graph.

Returns:
value of the x-axis diffmax
See Also:
setXdiffmax(int), getXmax()

setXdiffmax

public void setXdiffmax(int xDiffMax)
Set the maximum range on the X scale. Prevents compression of the graph if set to non-zero. If set to zero shows all values from the start compressing the graph. If the x-max value and xDiffMax value are different,then the x-max value will be changed to xDiffMax. If the setPollDuration is set(scrollbar enabled), then the XdiffMax value will be set equal to Xmax.

Parameters:
xDiffMax - value of the x-axis diffmax.
See Also:
getXdiffmax(), setXmax(int), setPollDuration(int)

getYmax

public long getYmax()
Get the maximum value on the Y scale.

Returns:
max value of the y-axis.
See Also:
setYmax(long)

setYmax

public void setYmax(long yMax)
Set the maximum value on the Y scale. If the polled value exceeds this limit, then the y max value will be automatically increased.

Parameters:
yMax - max value of the Y-axis.
See Also:
getYmax()

getYmaxAsBigInt

public java.math.BigInteger getYmaxAsBigInt()
v2c and v3 only Get the maximum value on the Y scale as BigInteger. Used mainly for Counter64 data type.

Returns:
max value of the y-axis as BigInteger.
See Also:
setYmaxAsBigInt(java.math.BigInteger), setYmax(long)

setYmaxAsBigInt

public void setYmaxAsBigInt(java.math.BigInteger yBigmax)
Set v2c and v3 only the maximum value on the Y scale as BigInteger. Used mainly for Counter64 data type. If the polled value exceeds this limit, then the y max value will be automatically increased.

See Also:
getYmaxAsBigInt(), getYmax()

getYmin

public long getYmin()
Get the minimum value on the Y scale.

Returns:
min value of the y-axis.
See Also:
setYmin(long)

setYmin

public void setYmin(long yMin)
Set the minimum value on the Y scale.

Parameters:
yMin - the minimum value of the y-axis.
See Also:
getYmin()

getYminAsBigInt

public java.math.BigInteger getYminAsBigInt()
Get v2c and v3 only the minimum value on the Y scale as BigInteger. Used mainly for Counter64 data type.

Returns:
min value of the y-axis as BigInteger.
See Also:
setYminAsBigInt(java.math.BigInteger), setYmin(long)

setYminAsBigInt

public void setYminAsBigInt(java.math.BigInteger yBigMin)
Set v2c and v3 only the minimum value on the Y scale as BigInteger. Used mainly for Counter64 data type.

Parameters:
yBigMin - the minimum value of the y-axis.
See Also:
getYminAsBigInt(), getYmin()

getTimeavg

public boolean getTimeavg()
Deprecated. Use isTimeavg() instead.

Get whether to time average the value shown.


isTimeavg

public boolean isTimeavg()
Get whether to time average the value shown

Returns:
boolean value of time average.
See Also:
setTimeavg(boolean)

setTimeavg

public void setTimeavg(boolean timeAvg)
Set whether to time average the value shown. The average of the values with respect to time(polling interval) will be plotted.

Parameters:
timeAvg - boolean value whether to plot the average over time.
See Also:
isTimeavg()

getXgrid

public int getXgrid()
Returns the number of vertical grid lines in the graph. Default will be 5 grids.

Returns:
number of x-grids.
See Also:
setXgrid(int)

setXgrid

public void setXgrid(int xGrid)
Set the number of vertical grid lines in the graph.

Parameters:
xGrid - number of vertical grids.
See Also:
getXgrid()

getYgrid

public int getYgrid()
Returns the number of horizontal grid lines. Default will be 5 grids.

Returns:
number of y-grids
See Also:
#setYgrids

setYgrid

public void setYgrid(int yGrid)
Set the number of horizontal grid lines.

Parameters:
yGrid - number of horizontal grid lines.
See Also:
#getYgrids

getXmark

public int getXmark()
Returns the number of value marks on X axis.

Returns:
number of markings in the x-axis.
See Also:
setXmark(int)

setXmark

public void setXmark(int xMark)
Set the number of value marks on X axis.

Parameters:
xMark - the number of x-markings.
See Also:
getXmark()

getYmark

public int getYmark()
Returns the number of value marks on Y axis.

Returns:
number of markings in the y-axis.
See Also:
setYmark(int)

setYmark

public void setYmark(int yMark)
Set the number of value marks on Y axis.

Parameters:
yMark - the number of y-markings
See Also:
getYmark()

setDataSize

public void setDataSize(int size)
This method will set the number of lines to be plotted in the graph. When the user wants to use setResult(int i, long l) method instead of setResult(ResultEvent e), then this size should be set first before using the setResult(int i, long l).

Parameters:
size - the size of the data or the no of lines.
See Also:
, setResult(int lineNum, long diff)

getLineLabels

public java.lang.String getLineLabels()
Returns the labels to be used for each oid - separated by | (pipe) or space separated.

Returns:
the string separated by ("|") or space separated incase of multiple lineLabels.
See Also:
setLineLabels(java.lang.String)

setLineLabels

public void setLineLabels(java.lang.String lineLabels)
Set the labels to be used for each oid - separated by |(pipe) or space separated.

Parameters:
lineLabels - the string representing the lineLabels for each oid separated by (|) or space separated
See Also:
getLineLabels()

getLcolor

public java.awt.Color getLcolor()
Get the primary line color. Default color is red.

Returns:
the first line color.
See Also:
setLcolor(java.awt.Color), getLinecolor(), setLinecolor(java.awt.Color)

setLcolor

public void setLcolor(java.awt.Color lcolor)
Set the primary line color.

Parameters:
lcolor - the color of the first line.
See Also:
getLcolor(), getLinecolor(), setLinecolor(java.awt.Color)

getLineColors

public java.awt.Color[] getLineColors()
Get line colors for multiline

Returns:
color array for the multiline graph.
See Also:
setLineColors(java.awt.Color[])

getLinecolors

public java.lang.String getLinecolors()
Deprecated and Replaced by getLineColors. not fully implemented


setLineColors

public void setLineColors(java.awt.Color[] lineColors)
Set line colors for multiline. Incase of of multi-line graph, the colors can be specified in the color array and the colors will be selected in a cyclic manner from the color array if the lines exceed the color array size.

Parameters:
lineColors - the color array specifying the color for the lines to be plotted.
See Also:
getLineColors()

setLinecolors

public void setLinecolors(java.lang.String linecolors)
Deprecated and Replaced by setLineColors. not fully implemented.


setStringResult

public void setStringResult(java.lang.String value)
Implementation of ResultListener method

Specified by:
setStringResult in interface ResultListener
Parameters:
value - the string value polled.

setNumericResult

public void setNumericResult(long num)
Implementation of ResultListener method - plots value incase of single value

Specified by:
setNumericResult in interface ResultListener
Parameters:
num - value to update in the graph.

setResult

public void setResult(ResultEvent e)
Implementation of ResultListener method,plots values if more than one values

Specified by:
setResult in interface ResultListener
Parameters:
e - ResultEvent.

restartGraph

public void restartGraph()
Restart the graph for its initial State.


setValues

public void setValues()
This method sets any component values that need to be set. This method should be called before polling.


setResult

public void setResult(long diff)
This updates the graph with the new value. Used for graph with a single oid.

Parameters:
diff - the long value to update.
See Also:
setResult(int lineNum, long diff), setResult(int lineNum, BigInteger diff)

setResult

public void setResult(java.math.BigInteger diff)
v2c and v3 only This updates the graph with the new value. Used for graph with a single oid in case of Counter64 data type.

Parameters:
diff - the BigInteger value to update.
See Also:
setResult(int lineNum, long diff), setResult(int lineNum, BigInteger diff)

setFont

public void setFont(java.awt.Font titleFont,
                    java.awt.Font labelFont)
sets the font for the title and label.

Parameters:
titleFont - font for the title.
labelFont - font for the label.
See Also:
setTfontname(java.lang.String), setTfontstyle(java.lang.String), setTfontsize(int), setLfontname(java.lang.String), setLfontstyle(java.lang.String), setLfontsize(int)

preferredSize

public java.awt.Dimension preferredSize()
Returns the preferred size of this component.

Overrides:
preferredSize in class java.awt.Container
Returns:
preferred Dimension of the LineGraph
See Also:
minimumSize()

minimumSize

public java.awt.Dimension minimumSize()
Returns the minimum size of this component.

Overrides:
minimumSize in class java.awt.Container
Returns:
minimum Dimension of the LineGraph.
See Also:
preferredSize()

setResult

public void setResult(int lineNum,
                      long diff)
This updates the graph with the new value. Used for graph with more than one OID's

Parameters:
lineNum - the specified line to plot
diff - the long value for the specified line.
See Also:
setDataSize(int)

setResult

public void setResult(int lineNum,
                      java.math.BigInteger diff)
v2c and v3 only This updates the graph with the new value. Used for graph with more than one OID's for Counter64 data type.

Parameters:
lineNum - the specified line to plot
diff - the BigInteger value for the specified line.
See Also:
setDataSize(int)

paintComponent

public void paintComponent(java.awt.Graphics g)
To paint the component.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - graphics object.
See Also:
updateComponent(java.awt.Graphics)

updateComponent

public void updateComponent(java.awt.Graphics g)
Updates the component.

Parameters:
g - graphics object.
See Also:
paintComponent(java.awt.Graphics)

getPollDuration

public int getPollDuration()
Returns the poll Duration(in seconds). Default value is 3600 seconds.

Returns:
maximum poll duration.

setPollDuration

public void setPollDuration(int time)
Set the poll Duration(in seconds), upto which the user wants the LineGraphBean to plot for polled values. This will enable a scroll bar and the previous values can be scrolled back and viewed. Setting the time to zero will reset to the default mode.i.e only the present values can be viewed.

Parameters:
time - the maximum poll duration.
See Also:
getPollDuration()

setLogEnabled

public void setLogEnabled(boolean storeValues)
Set the flag whether or not to store the plotted values in a flat file. Setting this boolean to true will start logging the values in the default file untitled.txt.If the logging of values should be done on a different file,first then specify the file name using the setLogFileName method and then set this boolean to true.

Parameters:
storeValues - boolean whether to log the values or not.
See Also:
isLogEnabled(), setLogFileName(java.lang.String)

isLogEnabled

public boolean isLogEnabled()
To check whether the flag is set for storing the plotted values in a flat file.

Returns:
boolean whether to log the results.
See Also:
setLogEnabled(boolean), setLogFileName(java.lang.String)

getLogFileName

public java.lang.String getLogFileName()
Returns the current log file name. The default log file will be untitled1.txt.

Returns:
the file name as string
See Also:
isLogEnabled(), setLogFileName(java.lang.String)

setLogFileName

public void setLogFileName(java.lang.String graphFile)
Set the log File name. setLogEnabled should be set to true.

See Also:
setLogEnabled(boolean), getLogFileName()

readPollDataFromFile

public void readPollDataFromFile(java.lang.String file)
This method reads the data from the file given as string argument for this method and polls the data off-line. Data should be stored in the format:


  Time1 oid1 val1 oid2 val2 oid3 val3 .....
  Time2 oid1 val1 oid2 val2 oid3 val3...


setShowErrorMessages

public void setShowErrorMessages(boolean showMessage)
Enables or Disables error messages dialog. When showMessage is true (default) the Error Message dialog pops up, whenever an error occurs. When showMessage is false, the Error Message is disabled.


getShowErrorMessage

public boolean getShowErrorMessage()
Gets the Error Message status.



Copyright (c)ZOHO Corp. 1996-2012