org.xith3d.ui.hud.widgets
Class ProgressBar

java.lang.Object
  extended by org.xith3d.ui.hud.base.Widget
      extended by org.xith3d.ui.hud.base.BackgroundSettableWidget
          extended by org.xith3d.ui.hud.widgets.ProgressBar
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO

public class ProgressBar
extends BackgroundSettableWidget


Nested Class Summary
static class ProgressBar.Description
          This class is used to describe a ProgressBar Widget.
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
BackgroundSettableWidget.BackgroundSettableDescriptionBase
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
protected static boolean DEFAULT_HEAVYWEIGHT
           
 
Fields inherited from class org.xith3d.ui.hud.base.Widget
transformHeight_Pixels2HUD, transformWidth_Pixels2HUD
 
Constructor Summary
ProgressBar(boolean isHeavyWeight, float width, float height)
          Creates a new ProgressBar.
ProgressBar(boolean isHeavyWeight, float width, float height, int minValue, int maxValue)
          Creates a new ProgressBar.
ProgressBar(boolean isHeavyWeight, float width, float height, int minValue, int maxValue, ProgressBar.Description desc)
          Creates a new ProgressBar.
ProgressBar(float width, float height)
          Creates a new ProgressBar.
ProgressBar(float width, float height, int minValue, int maxValue)
          Creates a new ProgressBar.
ProgressBar(float width, float height, int minValue, int maxValue, ProgressBar.Description desc)
          Creates a new ProgressBar.
 
Method Summary
protected  void drawWidget(Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height, boolean drawsSelf)
          
 HUDFont getFont()
           
 org.openmali.vecmath2.Colorf getFontColor()
           
 int getMaxValue()
           
 int getMinValue()
           
 int getValue()
           
protected  void init()
          This method is called when the WidgetContainer is set.
protected  java.lang.String makeText()
          Creates the ProgressBar's percentage text from the current value.
 void setFont(HUDFont font)
          Sets the Font to use for the percent value in the center of the ProgressBar.
 void setFont(HUDFont font, org.openmali.vecmath2.Colorf color)
          Sets the Font to use for the percent value in the center of the ProgressBar.
 void setFontColor(org.openmali.vecmath2.Colorf color)
          Sets the Font color to use for the percent value in the center of the ProgressBar.
 void setMaxValue(int maxValue)
          Sets the maximum value this ProgressBar can take.
 void setMinAndMaxValue(int minValue, int maxValue)
           
 void setMinMaxAndValue(int minValue, int maxValue, int value)
           
 void setMinValue(int minValue)
          Sets the minimum value this ProgressBar can take.
 void setValue(int value)
          Sets the current value of this ProgressBar.
protected  void setValue(int value, boolean forced)
          Sets the current value of this ProgressBar.
 
Methods inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
drawBackground, getBackgroundColor, getBackgroundTexture, getBackgroundTileMode, setBackground, setBackground, setBackground, setBackgroundColor, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTileMode, setNoBackground
 
Methods inherited from class org.xith3d.ui.hud.base.Widget
addContainerListener, addControllerListener, addFocusListener, addInputListener, addKeyboardListener, addLocationListener, addMouseListener, addSizeListener, addVisibilityListener, bindToGlobalMouseMovement, blocksFocusMoveDeviceComponent, calculateTransformHeight_Pixels2HUD, calculateTransformWidth_Pixels2HUD, compareAbsZIndex, createShape, detach, drawAndUpdateWidget, drawBorder, drawWidgetAfterWidgetAssembler, drawWidgetContents, getAbsoluteLocationOnHUD_, getAspect, getAssembly, getBorder, getContainer, getContentAspect, getContentHeight, getContentHeightPX, getContentLeftPX, getContentOffset, getContentTopPX, getContentWidth, getContentWidthPX, getContextMenu, getCursor, getEqualHeight_, getEqualWidth_, getForcedRedrawFrequency, getHeight, getHeightPX, getHUD, getLeft, getLevel, getLocation, getLocation, getLocationHUD2Pixels_, getLocationHUD2SG_, getLocationPixels2HUD_, getLocationSG2HUD_, getMaxRedrawFrequency, getMinHeight, getMinWidth, getName, getParentWindow, getPickHeight, getPickWidth, getRelLocationHUD2Pixels_, getRootHostWidget, getShape, getSize, getSizeHUD2Pixels_, getSizeHUD2SG_, getSizeOfPixels_, getSizePixels2HUD_, getSizeSG2HUD_, getToolTip, getTop, getTransparency, getUserObject, getWidgetAssembler, getWidth, getWidthPX, getZIndex, hasDropShadow, hasFocus, hasFocus, hasToolTip, initSize, isAHostedWidgetDirty, isClickable, isDraggable, isFocussable, isHeavyWeight, isHovered, isInitialized, isInitializing, isPickable, isThisWidgetDirty, isVisible, notifyOnDragStopped, onAttachedToContainer, onAttachedToHUD, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetachedFromContainer, onDetachedFromHUD, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onLocationChanged, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseExited, onMouseMoved, onMouseStopped, onMouseWheelMoved, onSizeChanged, onVisibilityChanged, pick, pickConditionsMatch, removeContainerListener, removeControllerListener, removeFocusListener, removeInputListener, removeKeyboardListener, removeLocationListener, removeMouseListener, removeSizeListener, removeVisibilityListener, requestFocus, resetWidgetDirty, setBorder, setBorder, setClickable, setContentClipRect, setContextMenu, setCursor, setDraggable, setFocussable, setForcedRedrawFrequency, setHasDropShadow, setHeight, setHostedWidgetDirty, setHostTextureDirty, setHostTextureDirty, setHostWidget, setLocation, setLocation, setLocation, setMaxRedrawFrequency, setName, setPickable, setSize, setSize, setSize, setSize, setTextureDirty, setTextureDirty, setToolTip, setTransparency, setTransparency, setUserObject, setVisible, setWidgetDirty, setWidth, setZIndex, startDragging, toString, update, updateAbsZIndex, updateSizeFactors, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_HEAVYWEIGHT

protected static final boolean DEFAULT_HEAVYWEIGHT
See Also:
Constant Field Values
Constructor Detail

ProgressBar

public ProgressBar(boolean isHeavyWeight,
                   float width,
                   float height,
                   int minValue,
                   int maxValue,
                   ProgressBar.Description desc)
Creates a new ProgressBar.

Parameters:
isHeavyWeight -
width - the desired width
height - the desired height
minValue - the initial minimum value
maxValue - the initial maximum value
desc - the ProgressBar.Description to describe this ProgressBar

ProgressBar

public ProgressBar(boolean isHeavyWeight,
                   float width,
                   float height,
                   int minValue,
                   int maxValue)
Creates a new ProgressBar.

Parameters:
isHeavyWeight -
width - the desired width
height - the desired height
minValue - the initial minimum value
maxValue - the initial maximum value

ProgressBar

public ProgressBar(boolean isHeavyWeight,
                   float width,
                   float height)
Creates a new ProgressBar.

Parameters:
isHeavyWeight -
width - the desired width
height - the desired height

ProgressBar

public ProgressBar(float width,
                   float height,
                   int minValue,
                   int maxValue,
                   ProgressBar.Description desc)
Creates a new ProgressBar.

Parameters:
width - the desired width
height - the desired height
minValue - the initial minimum value
maxValue - the initial maximum value
desc - the ProgressBar.Description to describe this ProgressBar

ProgressBar

public ProgressBar(float width,
                   float height,
                   int minValue,
                   int maxValue)
Creates a new ProgressBar.

Parameters:
width - the desired width
height - the desired height
minValue - the initial minimum value
maxValue - the initial maximum value

ProgressBar

public ProgressBar(float width,
                   float height)
Creates a new ProgressBar.

Parameters:
width - the desired width
height - the desired height
Method Detail

setFont

public void setFont(HUDFont font)
Sets the Font to use for the percent value in the center of the ProgressBar.

Parameters:
font - the Font

getFont

public final HUDFont getFont()
Returns:
the Font to use for the percent value in the center of the ProgressBar.

setFontColor

public void setFontColor(org.openmali.vecmath2.Colorf color)
Sets the Font color to use for the percent value in the center of the ProgressBar.

Parameters:
color - the Color

getFontColor

public final org.openmali.vecmath2.Colorf getFontColor()
Returns:
the Font color to use for the percent value in the center of the ProgressBar.

setFont

public final void setFont(HUDFont font,
                          org.openmali.vecmath2.Colorf color)
Sets the Font to use for the percent value in the center of the ProgressBar.

Parameters:
font - the Font
color - the font-color

setMinValue

public void setMinValue(int minValue)
Sets the minimum value this ProgressBar can take. Default: 0

Parameters:
minValue - the new minimum value

getMinValue

public final int getMinValue()
Returns:
the minimum value this ProgressBar can take. Default: 0

setMaxValue

public void setMaxValue(int maxValue)
Sets the maximum value this ProgressBar can take. Default: 100

Parameters:
maxValue - the new minimum value

getMaxValue

public final int getMaxValue()
Returns:
the maximum value this ProgressBar can take. Default: 100

setMinAndMaxValue

public final void setMinAndMaxValue(int minValue,
                                    int maxValue)

setMinMaxAndValue

public final void setMinMaxAndValue(int minValue,
                                    int maxValue,
                                    int value)

makeText

protected java.lang.String makeText()
Creates the ProgressBar's percentage text from the current value.

Returns:
the current percentage text.

setValue

protected void setValue(int value,
                        boolean forced)
Sets the current value of this ProgressBar. Default: 0

Parameters:
value - the new value
forced -

setValue

public final void setValue(int value)
Sets the current value of this ProgressBar. Default: 0

Parameters:
value - the new value

getValue

public final int getValue()
Returns:
the current value of this ProgressBar. Default: 0

drawWidget

protected void drawWidget(Texture2DCanvas texCanvas,
                          int offsetX,
                          int offsetY,
                          int width,
                          int height,
                          boolean drawsSelf)

Specified by:
drawWidget in class Widget

init

protected void init()
This method is called when the WidgetContainer is set.

Specified by:
init in class Widget