marf.gui.util
Class ColoredStatusPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by marf.gui.util.SmartSizablePanel
                  extended by marf.gui.util.ColoredStatusPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ColoredStatusPanel
extends SmartSizablePanel

Panel to be used as a status bar with color gradience.

TODO: refactor. $Id: ColoredStatusPanel.java,v 1.11 2007/12/18 03:46:08 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.11 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int GREEN_PERCENTAGE
          From 41% (YELLOW_PERCENTAGE + 1) to 100% inclusively.
protected  int iCurrentStatus
          Should be between lower and upper bounds.
protected  int iLowerBound
          Lower bound.
protected  int iUpperBound
          Upper bound.
static int RED_PERCENTAGE
          From 0% to 10% inclusively.
private static long serialVersionUID
          For serialization versioning.
static int YELLOW_PERCENTAGE
          From 11% (RED_PERCENTAGE + 1) to 40% inclusively.
 
Fields inherited from class marf.gui.util.SmartSizablePanel
iHeight, iWidth, iX, iY
 
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
ColoredStatusPanel()
          Default panel as ColoredStatusPanel(0, 0, 0, 0, 0, 100, 50).
ColoredStatusPanel(int piX, int piY, int piWidth, int piHeight, int piLowerBound, int piUpperBound, int piCurrentStatus)
          Construction.
 
Method Summary
 int getCurrentStatus()
           
 int getLowerBound()
           
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 int getUpperBound()
           
 void paint(java.awt.Graphics poGraphics)
          Draws this panel.
 void setCurrentStatus(int piCurrentStatus)
          Sets current status to a new value and repaints.
 void setLowerBound(int piLowerBound)
          Sets lower bound.
 void setUpperBound(int piUpperBound)
          Sets upper bound.
 
Methods inherited from class marf.gui.util.SmartSizablePanel
getHeight, getWidth, getX, getY, setHeight, setWidth, setX, setY
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, 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

serialVersionUID

private static final long serialVersionUID
For serialization versioning. When adding new members or make other structural changes regenerate this number with the serialver tool that comes with JDK.

Since:
0.3.0.4
See Also:
Constant Field Values

iLowerBound

protected int iLowerBound
Lower bound.


iUpperBound

protected int iUpperBound
Upper bound.


iCurrentStatus

protected int iCurrentStatus
Should be between lower and upper bounds.


RED_PERCENTAGE

public static final int RED_PERCENTAGE
From 0% to 10% inclusively.

See Also:
Constant Field Values

YELLOW_PERCENTAGE

public static final int YELLOW_PERCENTAGE
From 11% (RED_PERCENTAGE + 1) to 40% inclusively.

See Also:
Constant Field Values

GREEN_PERCENTAGE

public static final int GREEN_PERCENTAGE
From 41% (YELLOW_PERCENTAGE + 1) to 100% inclusively.

See Also:
Constant Field Values
Constructor Detail

ColoredStatusPanel

public ColoredStatusPanel(int piX,
                          int piY,
                          int piWidth,
                          int piHeight,
                          int piLowerBound,
                          int piUpperBound,
                          int piCurrentStatus)
Construction.

Parameters:
piX - x position
piY - y position
piWidth - panel width
piHeight - panel height
piLowerBound - lower bound
piUpperBound - upper bound
piCurrentStatus - current status

ColoredStatusPanel

public ColoredStatusPanel()
Default panel as ColoredStatusPanel(0, 0, 0, 0, 0, 100, 50).

See Also:
ColoredStatusPanel(int, int, int, int, int, int, int)
Method Detail

paint

public void paint(java.awt.Graphics poGraphics)
Draws this panel.

Overrides:
paint in class java.awt.Container
Parameters:
poGraphics - underlying graphics subsystem reference
See Also:
Component.paint(java.awt.Graphics)

setLowerBound

public void setLowerBound(int piLowerBound)
Sets lower bound.

Parameters:
piLowerBound - new lower bound

setUpperBound

public void setUpperBound(int piUpperBound)
Sets upper bound.

Parameters:
piUpperBound - new upper bound

setCurrentStatus

public void setCurrentStatus(int piCurrentStatus)
Sets current status to a new value and repaints. If the status values exceed boundaries, the status is aligned with the bounds instead.

Parameters:
piCurrentStatus - possible new current status

getLowerBound

public int getLowerBound()
Returns:
lower bound

getUpperBound

public int getUpperBound()
Returns:
upper bound

getCurrentStatus

public int getCurrentStatus()
Returns:
current status

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string


SourceForge Logo