com.gwtext.client.widgets
Class ProgressBar

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.gwtext.client.widgets.Component
              extended by com.gwtext.client.widgets.BoxComponent
                  extended by com.gwtext.client.widgets.ProgressBar
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, Observable

public class ProgressBar
extends BoxComponent

An updateable progress bar component. The progress bar supports two different modes: manual and automatic.

In manual mode, you are responsible for showing, updating (via updateProgress) and clearing the progress bar as needed from your own code. This method is most appropriate when you want to show progress throughout an operation that has predictable points of interest at which you can update the control.

In automatic mode, you simply call wait and let the progress bar run indefinitely, only clearing it once the operation is complete. You can optionally have the progress bar wait for a specific amount of time and then clear itself. Automatic mode is most appropriate for timed operations or asymchronous operations in which you have no need for indicating intermediate progress.


Field Summary
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Constructor Summary
ProgressBar()
           
ProgressBar(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 void addListener(ProgressBarListener listener)
          Add a ProgressBar listener.
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
           
protected  com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
           
 java.lang.String getText()
          The progress bar text.
 float getValue()
           
 java.lang.String getXType()
          Gets the xtype for this component as registered with ComponentMgr.
 boolean isWaiting()
          Returns true if the progress bar is currently in a wait(com.gwtext.client.widgets.WaitConfig) operation.
 void reset()
          Resets the progress bar value to 0 and text to empty string.
 void reset(boolean hide)
          Resets the progress bar value to 0 and text to empty string.
 void setSize(int width, int height)
          Sets the size of the progress bar.
 void setText(java.lang.String text)
          The progress bar text (defaults to '').
 void setTextEl(com.google.gwt.user.client.Element textEl)
          The element to render the progress text to (defaults to the progress bar's internal text element).
 void setTextEl(java.lang.String textElID)
          The element to render the progress text to (defaults to the progress bar's internal text element).
 void setValue(float value)
          The value of the progress bar.
 void updateProgress(float value)
          Updates the progress bar value.
 void updateProgress(float value, java.lang.String text)
          Updates the progress bar value, and its text.
 void updateText(java.lang.String text)
          Updates the progress bar text.
 void wait(WaitConfig waitConfig)
          Initiates an auto-updating progress bar.
 
Methods inherited from class com.gwtext.client.widgets.BoxComponent
addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setHeight, setPagePosition, setPosition, setSize, setWidth, setWidth, syncSize, updateBox
 
Methods inherited from class com.gwtext.client.widgets.Component
addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, addPlugin, addStyleDependentName, addStyleName, afterRender, beforeDestroy, check, checkExtVer, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, findParentBy, findParentByType, fireEvent, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getCls, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getTitle, getXTypes, hashCode, hide, initComponent, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, purgeListeners, removeClass, removeStyleDependentName, removeStyleName, render, render, render, render, render, render, resumeEvents, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoEl, setAutoShow, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setElement, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setTitle, setVisible, show, suspendEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgressBar

public ProgressBar()

ProgressBar

public ProgressBar(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

getConfigPrototype

protected com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
Overrides:
getConfigPrototype in class BoxComponent

getXType

public java.lang.String getXType()
Description copied from class: Component
Gets the xtype for this component as registered with ComponentMgr. For a list of all available xtypes, see the Component javadocs.

 
 

TextField field = new TextField(); field.getXType() returns "textfield"

Overrides:
getXType in class BoxComponent
Returns:
the xtype

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
Overrides:
create in class BoxComponent

isWaiting

public boolean isWaiting()
Returns true if the progress bar is currently in a wait(com.gwtext.client.widgets.WaitConfig) operation.

Returns:
true if in wait

reset

public void reset()
Resets the progress bar value to 0 and text to empty string.


reset

public void reset(boolean hide)
Resets the progress bar value to 0 and text to empty string. If hide = true, the progress bar will also be hidden (using the hideMode property internally).

Parameters:
hide - true to hide the progress bar (defaults to false)

setSize

public void setSize(int width,
                    int height)
Sets the size of the progress bar.

Overrides:
setSize in class BoxComponent
Parameters:
width - the width
height - the height

updateProgress

public void updateProgress(float value)
Updates the progress bar value. Any existing text value will be unchanged. Note that even if the progress bar value exceeds 1, it will never automatically reset -- you are responsible for determining when the progress is complete and calling reset to clear and/or hide the control.

Parameters:
value - the new value

updateProgress

public void updateProgress(float value,
                           java.lang.String text)
Updates the progress bar value, and its text. Note that even if the progress bar value exceeds 1, it will never automatically reset -- you are responsible for determining when the progress is complete and calling reset to clear and/or hide the control.

Parameters:
value - the new value
text - the new text

updateText

public void updateText(java.lang.String text)
Updates the progress bar text. If specified, textEl will be updated, otherwise the progress bar itself will display the updated text.

Parameters:
text - the text to display

wait

public void wait(WaitConfig waitConfig)
Initiates an auto-updating progress bar. A duration can be specified, in which case the progress bar will automatically reset after a fixed amount of time and optionally call a callback function if specified. If no duration is passed in, then the progress bar will run indefinitely and must be manually cleared by calling reset.

Parameters:
waitConfig - the wait configuration

addListener

public void addListener(ProgressBarListener listener)
Add a ProgressBar listener.

Parameters:
listener - the listener

setText

public void setText(java.lang.String text)
The progress bar text (defaults to '').

Parameters:
text - the progress bar text

getText

public java.lang.String getText()
The progress bar text.

Returns:
the progress bar text (defaults to '')

setTextEl

public void setTextEl(java.lang.String textElID)
               throws java.lang.IllegalStateException
The element to render the progress text to (defaults to the progress bar's internal text element).

Note that the text element must already be rendered to the DOM before creation of the progress bar. You can call textElComponent.render(RootPanel.getBodyElement()) to force addition of the textEl to the broswer DOM.

Parameters:
textElID - the text element ID
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setTextEl

public void setTextEl(com.google.gwt.user.client.Element textEl)
               throws java.lang.IllegalStateException
The element to render the progress text to (defaults to the progress bar's internal text element).

Note that the text element must already be rendered to the DOM before creation of the progress bar. You can call textElComponent.render(RootPanel.getBodyElement()) to force addition of the textEl to the broswer DOM.

Parameters:
textEl - the text element
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setValue

public void setValue(float value)
The value of the progress bar. A floating point value between 0 and 1 (e.g., .5, defaults to 0)

Parameters:
value - the value of the progress bar

getValue

public float getValue()
Returns:
the value of the progress bar