Package adams.gui.core
Class BaseStatusBar
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.core.BaseStatusBar
-
- All Implemented Interfaces:
StatusMessageHandler,ImageObserver,MenuContainer,Serializable,Accessible
public class BaseStatusBar extends BasePanel implements StatusMessageHandler
A bar for displaying status messages (left and right).- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBaseStatusBar.PopupMenuCustomizerInterface for classes that modify the statusbar's popup menu.static interfaceBaseStatusBar.StatusProcessorInterface for classes that process the status string to bring it into a displayable format.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_TITLEthe default title.static StringEMPTY_STATUSthe empty status.protected TimerTaskm_ClearTaskLeftthe current timer for the left message.protected TimerTaskm_ClearTaskRightthe current timer for the right message.protected Dimensionm_DialogSizethe default dimension for displaying the status.protected intm_ExpiryTimeLeftthe expiry time in seconds for clearing the left status automatically.protected intm_ExpiryTimeRightthe expiry time in seconds for clearing the right status automatically.protected JLabelm_LabelStatusLefta label for displaying a status.protected JLabelm_LabelStatusRightthe label for the right status.protected MouseListenerm_MouseListenera mouse listener for displaying the message in a dialog.protected BaseStatusBar.PopupMenuCustomizerm_PopupMenuCustomizerthe popup menu customizer to use.protected Stringm_StatusDialogTitlethe title for the status dialog.protected Stringm_StatusLeftthe current status (left).protected BaseStatusBar.StatusProcessorm_StatusProcessorfor custom processing the status message before displaying it.protected Stringm_StatusRightthe current status (right).protected Timerm_TimerLeftthe timer for the left message.protected Timerm_TimerRightthe timer for the right message.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description BaseStatusBar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMouseListener(MouseListener l)Adds the mouse listener to the status bar (the JLabel, actually).voidclearStatus()Removes any status message currently being displayed (left only).voidclearStatus(boolean left)Removes any status message currently being displayed.protected voiddisplayStatus(boolean left)Displays the status in a dialog.DimensiongetDialogSize()Returns the size for the dialog.intgetExpiryTime(boolean left)Returns the expiry time in seconds.protected BasePopupMenugetPopup(boolean left)Returns the popup menu for the status (left only).BaseStatusBar.PopupMenuCustomizergetPopupMenuCustomizer()Returns the current popup customizer in use.StringgetStatus()Returns the currently displayed status (left).StringgetStatus(boolean left)Returns the currently displayed status.StringgetStatusDialogTitle()Returns the currently set title for the status dialog.BaseStatusBar.StatusProcessorgetStatusProcessor()Returns the code for processing the status message before displaying it.booleanhasStatus()Returns whether a status is currently being displayed (left).booleanhasStatus(boolean left)Returns whether a status is currently being displayed.protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.booleanisMouseListenerActive()Returns whether the mouse listener is active.voidremoveMouseListener(MouseListener l)Removes the mouse listener from the status bar (the JLabel, actually).voidsetDialogSize(Dimension value)Sets the size for the dialog.voidsetExpiryTime(boolean left, int seconds)Sets the expiry time in seconds.voidsetMouseListenerActive(boolean value)Sets whether to turn mouse listener on (left only).voidsetPopupMenuCustomizer(BaseStatusBar.PopupMenuCustomizer value)Sets the popup menu customizer to use.voidsetStatus(boolean left, String msg)Displays a message.voidsetStatus(String msg)Displays a message (left).voidsetStatusDialogTitle(String value)Sets the title to use for the dialog when displaying the status bar in a dialog.voidsetStatusProcessor(BaseStatusBar.StatusProcessor value)Sets the code for processing the status message before displaying it.voidshowStatus(boolean left, String msg)Displays a message.voidshowStatus(String msg)Displays a message (left).-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
EMPTY_STATUS
public static final String EMPTY_STATUS
the empty status.- See Also:
- Constant Field Values
-
DEFAULT_TITLE
public static final String DEFAULT_TITLE
the default title.- See Also:
- Constant Field Values
-
m_LabelStatusLeft
protected JLabel m_LabelStatusLeft
a label for displaying a status.
-
m_MouseListener
protected MouseListener m_MouseListener
a mouse listener for displaying the message in a dialog.
-
m_StatusDialogTitle
protected String m_StatusDialogTitle
the title for the status dialog.
-
m_StatusProcessor
protected BaseStatusBar.StatusProcessor m_StatusProcessor
for custom processing the status message before displaying it.
-
m_PopupMenuCustomizer
protected BaseStatusBar.PopupMenuCustomizer m_PopupMenuCustomizer
the popup menu customizer to use.
-
m_DialogSize
protected Dimension m_DialogSize
the default dimension for displaying the status.
-
m_StatusLeft
protected String m_StatusLeft
the current status (left).
-
m_StatusRight
protected String m_StatusRight
the current status (right).
-
m_LabelStatusRight
protected JLabel m_LabelStatusRight
the label for the right status.
-
m_ExpiryTimeLeft
protected int m_ExpiryTimeLeft
the expiry time in seconds for clearing the left status automatically.
-
m_ExpiryTimeRight
protected int m_ExpiryTimeRight
the expiry time in seconds for clearing the right status automatically.
-
m_TimerLeft
protected Timer m_TimerLeft
the timer for the left message.
-
m_TimerRight
protected Timer m_TimerRight
the timer for the right message.
-
m_ClearTaskLeft
protected TimerTask m_ClearTaskLeft
the current timer for the left message.
-
m_ClearTaskRight
protected TimerTask m_ClearTaskRight
the current timer for the right message.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classBasePanel
-
clearStatus
public void clearStatus()
Removes any status message currently being displayed (left only).
-
clearStatus
public void clearStatus(boolean left)
Removes any status message currently being displayed.- Parameters:
left- whether to clear left or right
-
hasStatus
public boolean hasStatus()
Returns whether a status is currently being displayed (left).- Returns:
- true if a status message is being displayed
-
hasStatus
public boolean hasStatus(boolean left)
Returns whether a status is currently being displayed.- Parameters:
left- whether to query left or right status- Returns:
- true if a status message is being displayed
-
setStatus
public void setStatus(String msg)
Displays a message (left).- Parameters:
msg- the message to display
-
setStatus
public void setStatus(boolean left, String msg)Displays a message.- Parameters:
left- whether to update left or right statusmsg- the message to display
-
getStatus
public String getStatus()
Returns the currently displayed status (left).- Returns:
- the status, null if none displayed
-
getStatus
public String getStatus(boolean left)
Returns the currently displayed status.- Parameters:
left- whether to query left or right status- Returns:
- the status, null if none displayed
-
showStatus
public void showStatus(String msg)
Displays a message (left). Just an alias for setStatus(String).- Specified by:
showStatusin interfaceStatusMessageHandler- Parameters:
msg- the message to display- See Also:
setStatus(String)
-
showStatus
public void showStatus(boolean left, String msg)Displays a message. Just an alias for setStatus(boolean, String)- Parameters:
left- whether to update left or right statusmsg- the message to display- See Also:
setStatus(boolean, String)
-
displayStatus
protected void displayStatus(boolean left)
Displays the status in a dialog.- Parameters:
left- whether to display left or right status
-
addMouseListener
public void addMouseListener(MouseListener l)
Adds the mouse listener to the status bar (the JLabel, actually).- Overrides:
addMouseListenerin classComponent- Parameters:
l- the listener to add
-
removeMouseListener
public void removeMouseListener(MouseListener l)
Removes the mouse listener from the status bar (the JLabel, actually).- Overrides:
removeMouseListenerin classComponent- Parameters:
l- the listener to removes
-
setMouseListenerActive
public void setMouseListenerActive(boolean value)
Sets whether to turn mouse listener on (left only).- Parameters:
value- if true then the mouse listener is active
-
isMouseListenerActive
public boolean isMouseListenerActive()
Returns whether the mouse listener is active.- Returns:
- true if the mouse listener is active
-
getPopup
protected BasePopupMenu getPopup(boolean left)
Returns the popup menu for the status (left only).- Parameters:
left- whether for left or right label- Returns:
- the popup menu
-
setStatusDialogTitle
public void setStatusDialogTitle(String value)
Sets the title to use for the dialog when displaying the status bar in a dialog.- Parameters:
value- the title, use null for default
-
getStatusDialogTitle
public String getStatusDialogTitle()
Returns the currently set title for the status dialog.- Returns:
- the title
-
setStatusProcessor
public void setStatusProcessor(BaseStatusBar.StatusProcessor value)
Sets the code for processing the status message before displaying it.- Parameters:
value- the processor to use, null to turn off
-
getStatusProcessor
public BaseStatusBar.StatusProcessor getStatusProcessor()
Returns the code for processing the status message before displaying it.- Returns:
- the processor in use, null if none set
-
setDialogSize
public void setDialogSize(Dimension value)
Sets the size for the dialog.- Parameters:
value- the size to use
-
getDialogSize
public Dimension getDialogSize()
Returns the size for the dialog.- Returns:
- the size in use
-
setPopupMenuCustomizer
public void setPopupMenuCustomizer(BaseStatusBar.PopupMenuCustomizer value)
Sets the popup menu customizer to use.- Parameters:
value- the customizer, null to unset
-
getPopupMenuCustomizer
public BaseStatusBar.PopupMenuCustomizer getPopupMenuCustomizer()
Returns the current popup customizer in use.- Returns:
- the customizer, null if none set
-
setExpiryTime
public void setExpiryTime(boolean left, int seconds)Sets the expiry time in seconds.- Parameters:
left- whether to set the time for the left or right messageseconds- expiry time in seconds, 0 to turn off expiry
-
getExpiryTime
public int getExpiryTime(boolean left)
Returns the expiry time in seconds.- Parameters:
left- whether to return left or right expiry- Returns:
- the time in seconds, 0 for no expiry
-
-