org.opennms.bb.eui.operator.components
Class OperatorBar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.opennms.bb.eui.operator.components.OperatorBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class OperatorBar
extends JComponent

 OperatorBar is the 'bar' component in the real time chart
 The bar knows/stores info. about the level it belongs to in order
 - to send the request and create the next level and
 - to bring up the appropriate right-click popup menu

 The bar paints itself by asking its parent, the chart panel for
 the appropriate size it ought to be

Author:
Sowmya
See Also:
Serialized Form

Inner Class Summary
protected  class OperatorBar.OperatorBarListener
          This is the mouse listener for the bar.
(package private)  class OperatorBar.PopupMenuActionListener
          The PopupMenu listener - depending on what option the user chooses, create the next level panel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent, JComponent.ActionStandin, JComponent.IntVector, JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.AWTTreeLock
 
Field Summary
(package private)  Color backColor
           
static String CATEGORY_LEVEL
           
static String DAILY_LEVEL
           
static String DEVICES_LEVEL
           
static String EVENTS_LEVEL
           
static int HORIZONTAL
           
static String HOURLY_LEVEL
           
(package private)  String ID
           
(package private)  String ID_SEPARATOR
           
(package private)  String LABEL
           
(package private)  double length
           
(package private)  String LEVEL
           
(package private)  OperatorInterfacePanel operatorParent
           
(package private)  int orientation
           
(package private)  JPopupMenu popup
           
static String SERVICES_LEVEL
           
(package private)  double translatedLength
           
static int VERTICAL
           
static String VIEWS_LEVEL
           
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, uiClassID, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, needsPaint, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OperatorBar(OperatorInterfacePanel parentPanel, String level, String id, String label, int orient, double len, Color inpBackColor)
           
 
Method Summary
(package private)  String addRelevantInfo(String nextReqLevel, String curID)
          When the user skips levels, add current date/time info.
protected  JMenu createDaysMenu()
           
protected  JMenu createDevicesMenu()
           
protected  JMenu createEventsMenu()
           
protected  JMenu createHoursMenu()
           
protected  void createNextPanel(String nextLevel, String id, String dataFileName)
          Create the next level panel and set the tabbedpane component
protected  JMenu createServicesMenu()
           
(package private)  String getCurrentDateStr()
          Get current date
(package private)  String getCurrentTimeStr()
          Get current time
 String getID()
          Return id
protected  String getLabel()
          Return label
protected  double getLength()
          Return actual bar size
protected  String getLevel()
          Return level
protected  String getNextLevel()
          next level
 OperatorInterfacePanel getOpParent()
          Get the operator parent panel
protected  double getTranslatedLength()
          Return translated length (length to which the bar should draw itself based on the parent chart size)
 void paintComponent(Graphics g)
          Asks the parent chart panel for the appropriate size and paints itself acordingly Paints the size as well - reduces the font size so the label will fit
protected  void populatePopup(JPopupMenu popup)
          Create the popup menu based on the current level
(package private)  String sendLeftRequestForData()
          Send standard request based on level
(package private)  String sendRequestForData(String nextReqLevel, String qty)
           
(package private)  String sendRequestForData(String nextReqLevel, String qty, String severity)
          Create request for next level, send request and receive response
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, , addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paintWithBuffer, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update, updateUI, writeObject
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, 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, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL

VERTICAL

public static final int VERTICAL

operatorParent

OperatorInterfacePanel operatorParent

LEVEL

String LEVEL

ID

String ID

LABEL

String LABEL

orientation

int orientation

length

double length

translatedLength

double translatedLength

backColor

Color backColor

VIEWS_LEVEL

public static final String VIEWS_LEVEL

CATEGORY_LEVEL

public static final String CATEGORY_LEVEL

DEVICES_LEVEL

public static final String DEVICES_LEVEL

DAILY_LEVEL

public static final String DAILY_LEVEL

HOURLY_LEVEL

public static final String HOURLY_LEVEL

SERVICES_LEVEL

public static final String SERVICES_LEVEL

EVENTS_LEVEL

public static final String EVENTS_LEVEL

popup

JPopupMenu popup

ID_SEPARATOR

final String ID_SEPARATOR
Constructor Detail

OperatorBar

public OperatorBar(OperatorInterfacePanel parentPanel,
                   String level,
                   String id,
                   String label,
                   int orient,
                   double len,
                   Color inpBackColor)
Method Detail

paintComponent

public void paintComponent(Graphics g)
Asks the parent chart panel for the appropriate size and paints
 itself acordingly

 Paints the size as well - reduces the font size so the label will fit
Overrides:
paintComponent in class JComponent

getNextLevel

protected String getNextLevel()
next level

sendLeftRequestForData

String sendLeftRequestForData()
Send standard request based on level

sendRequestForData

String sendRequestForData(String nextReqLevel,
                          String qty)

sendRequestForData

String sendRequestForData(String nextReqLevel,
                          String qty,
                          String severity)
Create request for next level, send request and receive response

createNextPanel

protected void createNextPanel(String nextLevel,
                               String id,
                               String dataFileName)
Create the next level panel and set the tabbedpane component

populatePopup

protected void populatePopup(JPopupMenu popup)
Create the popup menu based on the current level

createDevicesMenu

protected JMenu createDevicesMenu()

createDaysMenu

protected JMenu createDaysMenu()

createHoursMenu

protected JMenu createHoursMenu()

createServicesMenu

protected JMenu createServicesMenu()

createEventsMenu

protected JMenu createEventsMenu()

addRelevantInfo

String addRelevantInfo(String nextReqLevel,
                       String curID)
When the user skips levels, add current date/time info. to the ID The ID has the info. about all levels of the bar separated by the ID_SEPARATOR

getCurrentDateStr

String getCurrentDateStr()
Get current date

getCurrentTimeStr

String getCurrentTimeStr()
Get current time

getLabel

protected String getLabel()
Return label

getID

public String getID()
Return id

getLevel

protected String getLevel()
Return level

getTranslatedLength

protected double getTranslatedLength()
Return translated length (length to which the bar should draw itself based on the parent chart size)

getLength

protected double getLength()
Return actual bar size

getOpParent

public OperatorInterfacePanel getOpParent()
Get the operator parent panel