dsto.dfc.swt.controls
Class StatusBar

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by dsto.dfc.swt.controls.StatusBar
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class StatusBar
extends org.eclipse.swt.widgets.Composite

A single line status bar that shows error, warning and info messages. A separate stack of messages is maintained for each type and the current displayed message is the first message at the top of the error, warning or info stacks (in that order).

Author:
Matthew Phillips

Nested Class Summary
protected static class StatusBar.Item
           
 
Field Summary
static int ERROR
           
static int INFO
           
static int WARNING
           
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
StatusBar(org.eclipse.swt.widgets.Composite parent, int style)
           
 
Method Summary
 void addMessage(String id, int type, String message)
          Add a new message.
 void addMessage(String id, String message)
          Add a new message.
 int getCurrentType()
          Get the type of the currently displayed message.
 void removeMessage(String id)
          Remove a message.
 boolean showingMessage()
          True if the status bar is showing a message.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values
Constructor Detail

StatusBar

public StatusBar(org.eclipse.swt.widgets.Composite parent,
                 int style)
Method Detail

addMessage

public void addMessage(String id,
                       String message)
Add a new message. This shortcut allows the message type to be encoded in the message text.

Parameters:
id - An ID for the message. Any other message with that ID is replaced.
message - The message type and message text. The text must begin with "e:" (ERROR)"w:" (WARNING) or "i:" (INFO). The rest of the text is the message itself. Can use null as a shortcut for the equivalent of removeMessage (id).
See Also:
addMessage(String, int, String), removeMessage(String)

addMessage

public void addMessage(String id,
                       int type,
                       String message)
Add a new message.

Parameters:
id - An ID for the message. Any other message with that ID is replaced.
type - The message type: ERROR, WARNING or INFO.
message - The message text. Can use null as a shortcut for the equivalent of removeMessage (id) (type is ignored).
See Also:
addMessage(String, String), removeMessage(String)

removeMessage

public void removeMessage(String id)
Remove a message.

Parameters:
id - The ID of the message.
See Also:
addMessage(String, int, String)

getCurrentType

public int getCurrentType()
Get the type of the currently displayed message.

Returns:
The message type (ERROR, WARNING or INFO) or -1 if no message is displayed.

showingMessage

public boolean showingMessage()
True if the status bar is showing a message.



Copyright © 2008 Commonwealth of Australia