Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cor.gui.prf
Class JspmPerfHisto  view JspmPerfHisto download JspmPerfHisto.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycor.gui.prf.JspmPerfHisto
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class JspmPerfHisto
extends javax.swing.JPanel
implements java.lang.Runnable

This class generated the the histograms for the Jspm performance management GUI. Each histogram can contains several charts, which are overlayed. Options can be set by using one of the following function: - SetStrAttr: Set a string attribute. String attributes can be: -# FrameLayout: Set the frame layout (shadow or not). -# Title: Set the title of the histogram. -# Legend: Sets the legend string which describes the different charts - SetBoolAttr: Set a boolean attribute. Boolean attrbutes can be one of: -# FixedMinY: Set the YAxis minimum to a certain value. -# FixedMaxY: Set the YAxis maximum to a certain value. -# ShowThres: Set the show threshold flag. -# GridX: Set the X-Grid ON/OFF. -# GridX: Set the Y-Grid ON/OFF. - SetColor: Will set one of the colors. Color attributes can be: -# GraphColor: Sets the graph color. -# TitleColor: Sets the title color. -# LabelColor: Sets the label color. - SetFontAttr: Sets one of the fonts. Valid font attributes are: -# Title: Sets the title font. -# X-Labels: Sets the X label font. -# Y-Labels: Sets the Y label font. -# Legend: Sets the legend font. - SetIntAttr: Sets one of the integer attributes. Valid integer attributes are: -# PXSIZE: Width of the histogram. -# PYSIZE: Height of the histogram. -# XLMARGIN: Left margin of the histogram. -# XRMARGIN: Right Margin of the histogram. -# YTMARGIN: Top Y margin. -# YBMARGIN: Bottom Y margin. -# currentTime: Current time for the real time histogram. - SetDoubleAttr: Sets one of the double attributes. Valid double attributes are: -# ymin: Minimum Y axis. -# ymax: Maximum Y axis. All attributes should be given as they appear here in the list. Several options can be set for the histogram. In detail this are: - logarithmic scale. All labels, grids and values will be transformed to a logarithmic scale. - grid in X and Y in light gray. - fixed minimum Y. In case fixedMinY is switched ON the user has to give the minimum value for the display of the graphs. - fixed maximum Y. In case fixedMaxY is switched ON the user has to give the maximum value for the display of the graphs.

Version:
0.0.2

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
(package private)  int currentTime
          Current time for real time view
private  boolean dataSet
          Data initialization flag
private  boolean fixedMaxY
          Fixed maximum Y axis flag
private  boolean fixedMinY
          Fixed minimum Y axis flag
(package private)  java.lang.String frameLayout
          The frame layout
private  java.awt.Color[] graphColor
          The color table for the charts
private  java.lang.Thread histoThread
          Blinking thread
private  java.awt.Color labelColor
          Label color
private  java.util.Vector legend
          Legend vector
private  java.awt.Font legendFont
          X axis labels font
private  boolean logScale
          Log scale flag
private  int MAX_HISTO
          Maximal number of overlayed histos
private  double[] maxCrit
          Maximum critical thresholds
private  double[] maxWarn
          Maximum warning thresholds
private  double[] minCrit
          Minimum critical thresholds
private  double[] minWarn
          Minimum warning thresholds
private  int nHist
          Number of charts.
private  int[] np
          Number of data points for the different charts.
private  int nt
          Total number of all points in all charts.
private  int nxLabels
          Number of X-axis labels
private  int PXSIZE
          Width of the histogram space
private  int PYSIZE
          Height of the histogram space
private  boolean realTime
          Realtime flag
private  boolean running
          Running flag.
private  boolean showThres
          Show thresholds flag
private  int smallTicks
          Small X ticks.
private  java.lang.String title
          Title
private  java.awt.Color titleColor
          Title color
private  java.awt.Font titleFont
          Title font.
private  double[] xData
          Data points in X
private  boolean XGRID
          X-grid flag
private  java.awt.Font xLabelFont
          X axis labels font
private  java.lang.String[] xLabels
          X-labels
private  int XLMARGIN
          Left margin of the histogram itself
private  int XRMARGIN
          Right margin of the histogram itself
private  double xscale
          Scale in X
private  int YBMARGIN
          Bottom margin.
private  double[] yData
          Y coordinate of all points
private  double ygap
          Gap in Y.
private  boolean YGRID
          Y-grid
private  java.awt.Font yLabelFont
          Y axis labels font
private  double ymax
          Maximum in Y
private  double ymin
          Minimum in Y
private  double yscale
          Scale in X
private  int YTMARGIN
          Top margin
 
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.Container
 
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
JspmPerfHisto()
          Constructor.
 
Method Summary
 void del()
          Deletes the histogram
private  void drawThres(java.awt.Graphics g)
          Draws the thresholds
private  void drawXGrid(java.awt.Graphics g)
          Draws the X-Grid
private  void drawXTicks(java.awt.Graphics g)
          Draws the X-ticks
private  void drawYGrid(java.awt.Graphics g)
          Draws the Y-Grid
private  void drawYTicks(java.awt.Graphics g)
          Draws the Y-ticks
private  double findMaxY(double[] vec)
          Determines the maximum Y-value.
private  double findMinY(double[] vec)
          Calculates the minimum Y-value.
 boolean getFixedMaxY()
          Returns the maximum fixed-Y flag.
 boolean getFixedMinY()
          Returns the minimum fixed-Y flag.
 java.awt.Image getImage()
          Returns a image of the current plot
 java.lang.String getLegend(int index)
          Return the legend.
 boolean getLogScale()
          Return the log scale flag.
 boolean getShowThres()
          Return the show threshold flag.
 java.lang.String getTitle()
          Return the title string.
 boolean getXGrid()
          Return the X-Grid flag.
 int getXSize()
          Return the X-size.
 boolean getYGrid()
          Return the Y-Grid flag.
 double getYmax()
          Return the maximum Y value.
 double getYmin()
          Return the minimum Y value.
 int getYSize()
          Return the Y-size.
 void histUpdate()
          Updates the histogram
(package private)  double log10(double x)
          Calculates the logarithm to base 10.
 void paint(java.awt.Graphics g)
          Paints the graphic, with all values which were set by using setData.
 void run()
          This method will be called by whoever wishes to run your class implementing Runnable.
 void setBoolAttr(java.lang.String attr, boolean value)
          Sets a boolean attribute Valid attributes are: - FixedMinY: Set the YAxis minimum to a certain value.
 void setColor(java.lang.String attr, java.awt.Color col)
          Sets a color attribute Valid attributes are: - GraphColor: Sets the graph color.
 void setData(double[] y, int n)
          Sets the data arrays
 void setDoubleAttr(java.lang.String attr, double value)
          Sets a double attribute.
 void setFont(java.lang.String attr, java.awt.Font font)
          Sets an font attribute Valid attributes are - Title: Sets the title font.
 void setIntAttr(java.lang.String attr, int value)
          Sets an integer attribute.
 void setStrAttr(java.lang.String attr, java.lang.String value)
          Sets an String attribute.
 void setThres(double[] minC, double[] minW, double[] maxW, double[] maxC, int n)
          Sets the thresholds arrays.
 void setXLabels(java.lang.String[] l, int num)
          Sets the X labels
 void start()
          Starts the blinking thread.
 void stop()
          Stops the thread.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, 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, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PXSIZE

private int PXSIZE
Width of the histogram space


PYSIZE

private int PYSIZE
Height of the histogram space


XLMARGIN

private int XLMARGIN
Left margin of the histogram itself


XRMARGIN

private int XRMARGIN
Right margin of the histogram itself


YTMARGIN

private int YTMARGIN
Top margin


YBMARGIN

private int YBMARGIN
Bottom margin.


MAX_HISTO

private int MAX_HISTO
Maximal number of overlayed histos


np

private int[] np
Number of data points for the different charts.


nxLabels

private int nxLabels
Number of X-axis labels


nHist

private int nHist
Number of charts.


nt

private int nt
Total number of all points in all charts.


xData

private double[] xData
Data points in X


yData

private double[] yData
Y coordinate of all points


ymin

private double ymin
Minimum in Y


ymax

private double ymax
Maximum in Y


ygap

private double ygap
Gap in Y.


xscale

private double xscale
Scale in X


yscale

private double yscale
Scale in X


minCrit

private double[] minCrit
Minimum critical thresholds


minWarn

private double[] minWarn
Minimum warning thresholds


maxWarn

private double[] maxWarn
Maximum warning thresholds


maxCrit

private double[] maxCrit
Maximum critical thresholds


fixedMinY

private boolean fixedMinY
Fixed minimum Y axis flag


fixedMaxY

private boolean fixedMaxY
Fixed maximum Y axis flag


XGRID

private boolean XGRID
X-grid flag


YGRID

private boolean YGRID
Y-grid


smallTicks

private int smallTicks
Small X ticks.


dataSet

private boolean dataSet
Data initialization flag


logScale

private boolean logScale
Log scale flag


showThres

private boolean showThres
Show thresholds flag


labelColor

private java.awt.Color labelColor
Label color


titleColor

private java.awt.Color titleColor
Title color


graphColor

private java.awt.Color[] graphColor
The color table for the charts


frameLayout

java.lang.String frameLayout
The frame layout


title

private java.lang.String title
Title


legend

private java.util.Vector legend
Legend vector


xLabels

private java.lang.String[] xLabels
X-labels


currentTime

int currentTime
Current time for real time view


realTime

private boolean realTime
Realtime flag


titleFont

private java.awt.Font titleFont
Title font. Default is Courir, bold, 12.


xLabelFont

private java.awt.Font xLabelFont
X axis labels font


yLabelFont

private java.awt.Font yLabelFont
Y axis labels font


legendFont

private java.awt.Font legendFont
X axis labels font


histoThread

private java.lang.Thread histoThread
Blinking thread


running

private boolean running
Running flag.

Constructor Detail

JspmPerfHisto

public JspmPerfHisto()
Constructor. The following defaults will be set: - PXSIZE: 700 - PYSIZE: 400 - XLMARGIN: 80 - XRMARGIN: 80 - YTMARGIN: 30 - YBMARGIN: 60 - GridX: true - GridY: true - Frame: "Shadow" - TitleColor: black - LabelColor: black

Method Detail

setStrAttr

public void setStrAttr(java.lang.String attr,
                       java.lang.String value)
Sets an String attribute. Valid attributes are: - FrameLayout: Frame type (shadow). - Title: Histogram title. - Legend: Legend attribute.


setBoolAttr

public void setBoolAttr(java.lang.String attr,
                        boolean value)
Sets a boolean attribute Valid attributes are: - FixedMinY: Set the YAxis minimum to a certain value. - FixedMaxY: Set the YAxis maximum to a certain value. - ShowThres: Set the show threshold flag. - GridX: Set the X-Grid ON/OFF. - GridX: Set the Y-Grid ON/OFF. - LogScale: Set the Y-axis linear/logarithmic - RealTime: Sets the realtime flag, which displays a vertical line at the current time.


setColor

public void setColor(java.lang.String attr,
                     java.awt.Color col)
Sets a color attribute Valid attributes are: - GraphColor: Sets the graph color. - TitleColor: Sets the title color. - LabelColor: Sets the label color.


setFont

public void setFont(java.lang.String attr,
                    java.awt.Font font)
Sets an font attribute Valid attributes are - Title: Sets the title font. - X-Labels: Sets the X label font. - Y-Labels: Sets the Y label font. - Legend: Sets the legend font.


setIntAttr

public void setIntAttr(java.lang.String attr,
                       int value)
Sets an integer attribute. Valid attributes are: - PXSIZE: Width of the histogram. - PYSIZE: Height of the histogram. - XLMARGIN: Left margin of the histogram. - XRMARGIN: Right margin of the histogram. - YTMARGIN: Top Y margin. - YBMARGIN: Bottom Y margin.


setDoubleAttr

public void setDoubleAttr(java.lang.String attr,
                          double value)
Sets a double attribute. Valid attribute names are: - ymin: Minimum Y axis. - ymax: Maximum Y axis.


setXLabels

public void setXLabels(java.lang.String[] l,
                       int num)
Sets the X labels


setData

public void setData(double[] y,
                    int n)
Sets the data arrays


log10

double log10(double x)
Calculates the logarithm to base 10.


setThres

public void setThres(double[] minC,
                     double[] minW,
                     double[] maxW,
                     double[] maxC,
                     int n)
Sets the thresholds arrays.


drawXTicks

private void drawXTicks(java.awt.Graphics g)
Draws the X-ticks


drawYTicks

private void drawYTicks(java.awt.Graphics g)
Draws the Y-ticks


drawXGrid

private void drawXGrid(java.awt.Graphics g)
Draws the X-Grid


drawThres

private void drawThres(java.awt.Graphics g)
Draws the thresholds


drawYGrid

private void drawYGrid(java.awt.Graphics g)
Draws the Y-Grid


paint

public void paint(java.awt.Graphics g)
Paints the graphic, with all values which were set by using setData.


findMinY

private double findMinY(double[] vec)
Calculates the minimum Y-value. The minimum will be the next following value which can be divided by 10^x. For instance if the minimum is -1 the minimum value will be -10.


findMaxY

private double findMaxY(double[] vec)
Determines the maximum Y-value. The maximum will be the next following value which can be divided by 10^x. For instance if the maximum is 4000 the maximum value will be 10000.


del

public void del()
Deletes the histogram


histUpdate

public void histUpdate()
Updates the histogram


getTitle

public java.lang.String getTitle()
Return the title string.


getXGrid

public boolean getXGrid()
Return the X-Grid flag.


getYGrid

public boolean getYGrid()
Return the Y-Grid flag.


getXSize

public int getXSize()
Return the X-size.


getYSize

public int getYSize()
Return the Y-size.


getFixedMaxY

public boolean getFixedMaxY()
Returns the maximum fixed-Y flag.


getFixedMinY

public boolean getFixedMinY()
Returns the minimum fixed-Y flag.


getYmin

public double getYmin()
Return the minimum Y value.


getYmax

public double getYmax()
Return the maximum Y value.


getLogScale

public boolean getLogScale()
Return the log scale flag.


getShowThres

public boolean getShowThres()
Return the show threshold flag.


getLegend

public java.lang.String getLegend(int index)
Return the legend.


getImage

public java.awt.Image getImage()
Returns a image of the current plot


run

public void run()
Description copied from interface: java.lang.Runnable
This method will be called by whoever wishes to run your class implementing Runnable. Note that there are no restrictions on what you are allowed to do in the run method, except that you cannot throw a checked exception.

Specified by:
run in interface java.lang.Runnable

start

public void start()
Starts the blinking thread.


stop

public void stop()
Stops the thread.