de.matthiasmann.twl
Class ProgressBar

java.lang.Object
  extended by de.matthiasmann.twl.Widget
      extended by de.matthiasmann.twl.TextWidget
          extended by de.matthiasmann.twl.ProgressBar

public class ProgressBar
extends TextWidget

A progress bar.


Nested Class Summary
 
Nested classes/interfaces inherited from class de.matthiasmann.twl.Widget
Widget.OffscreenMouseAdjustments, Widget.RenderOffscreen
 
Field Summary
static AnimationState.StateKey STATE_INDETERMINATE
           
static AnimationState.StateKey STATE_VALUE_CHANGED
           
static float VALUE_INDETERMINATE
           
 
Fields inherited from class de.matthiasmann.twl.TextWidget
STATE_HOVER, STATE_TEXT_CHANGED, STATE_TEXT_SELECTION
 
Fields inherited from class de.matthiasmann.twl.Widget
STATE_DISABLED, STATE_HAS_FOCUSED_CHILD, STATE_HAS_OPEN_POPUPS, STATE_KEYBOARD_FOCUS
 
Constructor Summary
ProgressBar()
           
 
Method Summary
protected  void applyTheme(ThemeInfo themeInfo)
          Apply the given theme.
protected  void applyThemeProgressBar(ThemeInfo themeInfo)
           
 int getMinHeight()
          Returns the minimum height of the widget.
 int getMinWidth()
          Returns the minimum width of the widget.
 int getPreferredInnerHeight()
          Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children.
 int getPreferredInnerWidth()
          Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children.
 Image getProgressImage()
           
 java.lang.String getText()
           
 float getValue()
          Returns the current value or VALUE_INDETERMINATE
protected  void paintWidget(GUI gui)
          Called by Widget.paint(de.matthiasmann.twl.GUI) after painting the background and before painting all children.
 void setIndeterminate()
          Sets the progress bar to an indeterminate state.
 void setProgressImage(Image progressImage)
          Sets the progress image.
 void setText(java.lang.String text)
          Sets the text which is displayed on top of the progress bar image.
 void setValue(float value)
          Sets the progress value to the specified value between 0.0f and 1.0f.
 
Methods inherited from class de.matthiasmann.twl.TextWidget
applyThemeTextWidget, computeRelativeCursorPositionX, computeRelativeCursorPositionX, computeTextHeight, computeTextWidth, computeTextX, computeTextY, destroy, getAlignment, getCharSequence, getFont, getNumTextLines, handleMouseHover, hasText, isCache, isMultilineText, paintLabelText, paintTextAt, paintWithSelection, paintWithSelection, setAlignment, setCache, setCharSequence, setFont
 
Methods inherited from class de.matthiasmann.twl.Widget
add, addActionMapping, addPropertyChangeListener, addPropertyChangeListener, adjustSize, afterAddToGUI, allChildrenRemoved, applyThemeBackground, applyThemeBorder, applyThemeInputMap, applyThemeMaxSize, applyThemeMinSize, applyThemeMouseCursor, applyThemeOffscreenExtra, applyThemeOverlay, applyThemeTooltip, beforeRemoveFromGUI, borderChanged, canAcceptKeyboardFocus, childAdded, childInvalidateLayout, childRemoved, childVisibilityChanged, computeSize, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, focusFirstChild, focusLastChild, focusNextChild, focusPrevChild, getActionMap, getAnimationState, getBackground, getBorderBottom, getBorderHorizontal, getBorderLeft, getBorderRight, getBorderTop, getBorderVertical, getBottom, getChild, getChildAt, getChildIndex, getGUI, getHeight, getInnerBottom, getInnerHeight, getInnerRight, getInnerWidth, getInnerX, getInnerY, getInputMap, getKeyboardFocusOrder, getMaxHeight, getMaxWidth, getMouseCursor, getMouseCursor, getNumChildren, getOffscreenExtraBottom, getOffscreenExtraLeft, getOffscreenExtraRight, getOffscreenExtraTop, getOrCreateActionMap, getOverlay, getParent, getPreferredHeight, getPreferredWidth, getRenderOffscreen, getRight, getRootWidget, getTheme, getThemePath, getThemeTooltipContent, getTintAnimator, getTooltipContent, getTooltipContentAt, getWidgetAt, getWidth, getX, getY, giveupKeyboardFocus, handleEvent, handleKeyStrokeAction, hasKeyboardFocus, hasOpenPopups, hasSharedAnimationState, insertChild, invalidateLayout, invalidateLayoutLocally, isAbsoluteTheme, isClip, isDepthFocusTraversal, isEnabled, isFocusKeyEnabled, isInside, isLocallyEnabled, isMouseInside, isVisible, keyboardFocusChildChanged, keyboardFocusGained, keyboardFocusGained, keyboardFocusLost, layout, layoutChildFullInnerArea, layoutChildrenFullInnerArea, moveChild, paint, paintBackground, paintChild, paintChildren, paintDragOverlay, paintOverlay, positionChanged, reapplyTheme, removeAllChildren, removeChild, removeChild, removePropertyChangeListener, removePropertyChangeListener, requestKeyboardFocus, requestKeyboardFocus, resetTooltip, setActionMap, setBackground, setBorderSize, setBorderSize, setBorderSize, setBorderSize, setCanAcceptKeyboardFocus, setClip, setDepthFocusTraversal, setEnabled, setFocusKeyEnabled, setInnerSize, setInputMap, setMaxSize, setMinSize, setMouseCursor, setOffscreenExtra, setOffscreenExtra, setOverlay, setPosition, setRenderOffscreen, setSize, setTheme, setTintAnimator, setTooltipContent, setVisible, sizeChanged, updateTintAnimation, updateTooltip, validateLayout, widgetDisabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_VALUE_CHANGED

public static final AnimationState.StateKey STATE_VALUE_CHANGED

STATE_INDETERMINATE

public static final AnimationState.StateKey STATE_INDETERMINATE

VALUE_INDETERMINATE

public static final float VALUE_INDETERMINATE
See Also:
Constant Field Values
Constructor Detail

ProgressBar

public ProgressBar()
Method Detail

getValue

public float getValue()
Returns the current value or VALUE_INDETERMINATE

Returns:
the current value or VALUE_INDETERMINATE

setIndeterminate

public void setIndeterminate()
Sets the progress bar to an indeterminate state.

See Also:
STATE_INDETERMINATE

setValue

public void setValue(float value)
Sets the progress value to the specified value between 0.0f and 1.0f. This will also clear the STATE_INDETERMINATE state.

Parameters:
value - the progress value between 0.0f and 1.0f.

getText

public java.lang.String getText()

setText

public void setText(java.lang.String text)
Sets the text which is displayed on top of the progress bar image.

Parameters:
text - the text

getProgressImage

public Image getProgressImage()

setProgressImage

public void setProgressImage(Image progressImage)
Sets the progress image.

This is called from applyThemeProgressBar(de.matthiasmann.twl.ThemeInfo)

When the progress bar is in indeterminate state then the image is not drawn, otherwise it is drawn with a scaled width based on the current progress value.

Parameters:
progressImage - the progress image, can be null.

applyThemeProgressBar

protected void applyThemeProgressBar(ThemeInfo themeInfo)

applyTheme

protected void applyTheme(ThemeInfo themeInfo)
Description copied from class: Widget
Apply the given theme. This method also calls invalidateLayout()

Overrides:
applyTheme in class TextWidget
Parameters:
themeInfo - The theme info for this widget

paintWidget

protected void paintWidget(GUI gui)
Description copied from class: Widget
Called by Widget.paint(de.matthiasmann.twl.GUI) after painting the background and before painting all children.

This should be overwritten instead of paint if normal themeable painting is desired by the subclass.

The default implementation does nothing.

Overrides:
paintWidget in class TextWidget
Parameters:
gui - the GUI object - it's the same as getGUI()

getMinWidth

public int getMinWidth()
Description copied from class: Widget
Returns the minimum width of the widget. Layout manager will allocate atleast the minimum width to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Overrides:
getMinWidth in class Widget
Returns:
the minimum width of the widget

getMinHeight

public int getMinHeight()
Description copied from class: Widget
Returns the minimum height of the widget. Layout manager will allocate atleast the minimum height to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Overrides:
getMinHeight in class Widget
Returns:
the minimum height of the widget

getPreferredInnerWidth

public int getPreferredInnerWidth()
Description copied from class: Widget
Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerWidth in class TextWidget
Returns:
the preferred inner width

getPreferredInnerHeight

public int getPreferredInnerHeight()
Description copied from class: Widget
Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerHeight in class TextWidget
Returns:
the preferred inner height