com.isti.quakewatch.guiutil
Class ConnectionStatusPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.isti.quakewatch.guiutil.ConnectionStatusPanel
All Implemented Interfaces:
ConnStatusInterface, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ConnectionStatusPanel
extends javax.swing.JPanel
implements ConnStatusInterface

Class ConnectionStatusPanel defines a panel for showing the ongoing status of a connection.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static java.awt.Color CLEAR_COLOR
           
static int DEF_MAX_TXTLEN
          Default maximum text length for text in panel.
static java.lang.String DEF_POPUP_TITLESTR
          Default title string for popup dialog.
protected  javax.swing.JButton dialogOkButton
           
protected  IstiDialogPopup dialogPopupObj
           
protected  javax.swing.JTextArea dialogTextArea
           
protected static java.awt.Color[] IDX_CLR_ARR
           
protected  javax.swing.JLabel labelObj
           
protected  int maxTextLength
           
protected  boolean popupModalFlag
           
protected  java.awt.Component popupParentObj
           
protected  boolean popupRequestedFlag
           
protected  java.lang.String popupTextString
           
protected  java.lang.String popupTitleString
           
protected  java.awt.event.WindowListener popupWindowListenerObj
           
protected  java.awt.Component refocusComponentObj
           
static int RMARGIN_PIXELS
          Size of right-side margin, in pixels.
protected  SymbolJLabel symbolObj
           
 
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 com.isti.quakewatch.util.ConnStatusInterface
CLEAR_COLOR_IDX, GREEN_COLOR_IDX, NULL_COLOR_IDX, RED_COLOR_IDX, YELLOW_COLOR_IDX
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ConnectionStatusPanel()
          Creates a panel for showing the ongoing status of a connection.
ConnectionStatusPanel(java.awt.Component popupParentObj)
          Creates a panel for showing the ongoing status of a connection.
 
Method Summary
 void addPopupWindowListener(java.awt.event.WindowListener listenerObj)
          Adds the given window listener to the popup dialog.
 void autoClearPopupDialog()
          Clears any displayed popup dialog if the user has not requested that it be shown.
protected  void doHidePopupDialog()
          Hides the popup dialog.
protected  void doSetData(java.lang.String textStr, java.lang.String popupStr, java.awt.Color symColorObj)
          Sets the message strings for this panel and the popup dialog, as well as the color for the symbol on the panel.
protected  void doSetPopupTextString(java.lang.String str)
          Sets the text to be displayed in the popup shown when this panel is clicked on.
protected  void doSetSymbolColor(java.awt.Color colorObj)
          Sets the color of the symbol to the right of the text.
protected  void doSetText(java.lang.String str)
          Sets the text to be displayed.
protected  void doSetTitleTextString(java.lang.String str)
          Sets the title to be displayed in the popup shown when this panel is clicked on.
protected  void doShowPopupDialog()
          Displays the popup dialog showing extra status information.
 int getMaxTextLength()
          Returns the maximum length allowed for the text in the panel.
 java.awt.Component getPopupParent()
          Returns the parent component to use when displaying the popup dialog, or null for none.
 java.lang.String getPopupTextString()
          Returns the text to be displayed in the popup shown when this panel is clicked on.
 java.lang.String getTitleTextString()
          Returns the title to be displayed in the popup shown when this panel is clicked on.
 void hidePopupDialog()
          Hides the popup dialog.
 boolean isPopupDialogVisible()
          Returns the status of whether or not the popup dialolg is visible.
 void removePopupWindowListener(java.awt.event.WindowListener listenerObj)
          Removes the given window listener from the popup dialog.
 void setData(java.lang.String textStr, java.lang.String popupStr)
          Sets the message strings for this panel and the popup dialog.
 void setData(java.lang.String textStr, java.lang.String popupStr, int symColorIdx)
          Sets the message strings for this panel and the popup dialog, as well as the color for the symbol on the panel.
 void setMaxTextLength(int len)
          Sets the maximum length allowed for the text in the panel.
 void setPopupModal(boolean modalFlag)
          Sets the modal flag for the popup dialog.
 void setPopupParent(java.awt.Component compObj)
          Sets the parent component to use when displaying the popup dialog, or null for none.
 void setPopupTextString(java.lang.String str)
          Sets the text to be displayed in the popup shown when this panel is clicked on.
 void setRefocusComponent(java.lang.Object compObj)
          Sets the component that is to receive focus after the popup dialog is cleared.
 void setSymbolColor(java.awt.Color colorObj)
          Sets the color of the symbol to the right of the text.
 void setText(java.lang.String str)
          Sets the text to be displayed.
 void setTitleTextString(java.lang.String str)
          Sets the title to be displayed in the popup shown when this panel is clicked on.
 void showPopupDialog()
          Displays the popup dialog showing extra status information.
 void userRequestShowPopupDialog()
          Displays the popup dialog showing extra status information in response to a user request.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, 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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEF_MAX_TXTLEN

public static final int DEF_MAX_TXTLEN
Default maximum text length for text in panel.

See Also:
Constant Field Values

RMARGIN_PIXELS

public static final int RMARGIN_PIXELS
Size of right-side margin, in pixels.

See Also:
Constant Field Values

DEF_POPUP_TITLESTR

public static final java.lang.String DEF_POPUP_TITLESTR
Default title string for popup dialog.

See Also:
Constant Field Values

CLEAR_COLOR

protected static final java.awt.Color CLEAR_COLOR

IDX_CLR_ARR

protected static final java.awt.Color[] IDX_CLR_ARR

labelObj

protected final javax.swing.JLabel labelObj

symbolObj

protected final SymbolJLabel symbolObj

popupParentObj

protected java.awt.Component popupParentObj

maxTextLength

protected int maxTextLength

popupTextString

protected java.lang.String popupTextString

popupTitleString

protected java.lang.String popupTitleString

dialogPopupObj

protected IstiDialogPopup dialogPopupObj

dialogTextArea

protected final javax.swing.JTextArea dialogTextArea

dialogOkButton

protected final javax.swing.JButton dialogOkButton

popupModalFlag

protected boolean popupModalFlag

popupWindowListenerObj

protected java.awt.event.WindowListener popupWindowListenerObj

popupRequestedFlag

protected boolean popupRequestedFlag

refocusComponentObj

protected java.awt.Component refocusComponentObj
Constructor Detail

ConnectionStatusPanel

public ConnectionStatusPanel(java.awt.Component popupParentObj)
Creates a panel for showing the ongoing status of a connection. A colored-dot symbol appears to right of a short text message. The panel may be clicked on to display a popup showing a longer status message.

Parameters:
popupParentObj - the parent component to use when displaying the popup dialog, or null for none.

ConnectionStatusPanel

public ConnectionStatusPanel()
Creates a panel for showing the ongoing status of a connection. A colored-dot symbol appears to right of a short text message. The panel may be clicked on to display a popup showing a longer status message.

Method Detail

setPopupParent

public void setPopupParent(java.awt.Component compObj)
Sets the parent component to use when displaying the popup dialog, or null for none.

Parameters:
compObj - the parent component object for the popup dialog.

getPopupParent

public java.awt.Component getPopupParent()
Returns the parent component to use when displaying the popup dialog, or null for none.

Returns:
The parent component object for the popup dialog.

setText

public void setText(java.lang.String str)
Sets the text to be displayed.

Parameters:
str - the text to be displayed.

doSetText

protected void doSetText(java.lang.String str)
Sets the text to be displayed.

Parameters:
str - the text to be displayed.

setSymbolColor

public void setSymbolColor(java.awt.Color colorObj)
Sets the color of the symbol to the right of the text.

Parameters:
colorObj - the color to use, or null for transparent.

doSetSymbolColor

protected void doSetSymbolColor(java.awt.Color colorObj)
Sets the color of the symbol to the right of the text.

Parameters:
colorObj - the color to use, or null for transparent.

setPopupTextString

public void setPopupTextString(java.lang.String str)
Sets the text to be displayed in the popup shown when this panel is clicked on.

Parameters:
str - text to be displayed, or null to disable the popup.

doSetPopupTextString

protected void doSetPopupTextString(java.lang.String str)
Sets the text to be displayed in the popup shown when this panel is clicked on.

Parameters:
str - text to be displayed, or null to disable the popup.

getPopupTextString

public java.lang.String getPopupTextString()
Returns the text to be displayed in the popup shown when this panel is clicked on.

Returns:
The text to be displayed, or null if the popup is disabled.

setData

public void setData(java.lang.String textStr,
                    java.lang.String popupStr,
                    int symColorIdx)
Sets the message strings for this panel and the popup dialog, as well as the color for the symbol on the panel.

Specified by:
setData in interface ConnStatusInterface
Parameters:
textStr - text for panel, or null for no change.
popupStr - text for popup, or null for no change.
symColorIdx - index of color for symbol (one of the '..._COLOR_IDX' values), or 'NULL_COLOR_IDX' for no change.

setData

public void setData(java.lang.String textStr,
                    java.lang.String popupStr)
Sets the message strings for this panel and the popup dialog.

Specified by:
setData in interface ConnStatusInterface
Parameters:
textStr - text for panel, or null for no change.
popupStr - text for popup, or null for no change.

doSetData

protected void doSetData(java.lang.String textStr,
                         java.lang.String popupStr,
                         java.awt.Color symColorObj)
Sets the message strings for this panel and the popup dialog, as well as the color for the symbol on the panel.

Parameters:
textStr - text for panel, or null for no change.
popupStr - text for popup, or null for no change.
symColorObj - color for symbol, or null for no change.

setTitleTextString

public void setTitleTextString(java.lang.String str)
Sets the title to be displayed in the popup shown when this panel is clicked on.

Parameters:
str - title to be displayed, or null for the default title.

doSetTitleTextString

protected void doSetTitleTextString(java.lang.String str)
Sets the title to be displayed in the popup shown when this panel is clicked on.

Parameters:
str - title to be displayed, or null for the default title.

getTitleTextString

public java.lang.String getTitleTextString()
Returns the title to be displayed in the popup shown when this panel is clicked on.

Returns:
The title to be displayed, or null if the default will be displayed.

setMaxTextLength

public void setMaxTextLength(int len)
Sets the maximum length allowed for the text in the panel.

Parameters:
len - the length value.

getMaxTextLength

public int getMaxTextLength()
Returns the maximum length allowed for the text in the panel.

Returns:
The length value.

setPopupModal

public void setPopupModal(boolean modalFlag)
Sets the modal flag for the popup dialog. The popup dialog defaults to non-modal.

Parameters:
modalFlag - true for modal, false for non-modal (allows other windows to run).

addPopupWindowListener

public void addPopupWindowListener(java.awt.event.WindowListener listenerObj)
Adds the given window listener to the popup dialog. Only one listener may be added before the dialog has been displayed.

Parameters:
listenerObj - the window listener to add.

removePopupWindowListener

public void removePopupWindowListener(java.awt.event.WindowListener listenerObj)
Removes the given window listener from the popup dialog.

Parameters:
listenerObj - the window listener to remove.

setRefocusComponent

public void setRefocusComponent(java.lang.Object compObj)
Sets the component that is to receive focus after the popup dialog is cleared.

Specified by:
setRefocusComponent in interface ConnStatusInterface
Parameters:
compObj - the component to receive focus.

showPopupDialog

public void showPopupDialog()
Displays the popup dialog showing extra status information. The dialog is non-modal.

Specified by:
showPopupDialog in interface ConnStatusInterface

doShowPopupDialog

protected void doShowPopupDialog()
Displays the popup dialog showing extra status information. The dialog is non-modal.


userRequestShowPopupDialog

public void userRequestShowPopupDialog()
Displays the popup dialog showing extra status information in response to a user request. The dialog is non-modal.

Specified by:
userRequestShowPopupDialog in interface ConnStatusInterface

hidePopupDialog

public void hidePopupDialog()
Hides the popup dialog.

Specified by:
hidePopupDialog in interface ConnStatusInterface

doHidePopupDialog

protected void doHidePopupDialog()
Hides the popup dialog.


autoClearPopupDialog

public void autoClearPopupDialog()
Clears any displayed popup dialog if the user has not requested that it be shown.

Specified by:
autoClearPopupDialog in interface ConnStatusInterface

isPopupDialogVisible

public boolean isPopupDialogVisible()
Returns the status of whether or not the popup dialolg is visible.

Returns:
true if the popup dialolg is visible, false if not.