|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnextapp.echo2.app.Component
echopointng.ComponentEx
echopointng.AbleComponent
echopointng.ProgressBar
public class ProgressBar
The ProgressBar> component provides a visual display for an
integer value within a bounded interval.
A ProgressBar typically communicates the progress of an event
by displaying its percentage of completion and possibly a textual display of
this percentage.
The ProgressBar comes with a standard width and height that is optimised for HORIZONATL orientation. If you change the orientation, be sure to flip the height and width otherwise it will look strange. This is done by default on the basic setOrientation() method.
The width and height of the ProgressBar can be adjusted slightly by the ProgressBarRenderer, so it can fit the block size exactly. So dont assume its size is always exact.
| Field Summary | |
|---|---|
protected ChangeEvent |
changeEvent
Only one ChangeEvent is needed per instance since the event's only interesting property is the immutable source, which is the progress bar. |
protected ChangeListener |
changeListener
|
static Style |
DEFAULT_STYLE
|
static int |
ORIENTATION_HORIZONTAL
|
static int |
ORIENTATION_VERTICAL
|
static java.lang.String |
PROPERTY_COMPLETED_COLOR
|
static java.lang.String |
PROPERTY_MODEL
|
static java.lang.String |
PROPERTY_NUMBER_OF_BLOCKS
|
static java.lang.String |
PROPERTY_ORIENTATION
|
static java.lang.String |
PROPERTY_PROGRESS_STRING
|
static java.lang.String |
PROPERTY_PROGRESS_STRING_PAINTED
|
static java.lang.String |
PROPERTY_PROGRESSBAR_IMAGE
|
static java.lang.String |
PROPERTY_RENDERER
|
static java.lang.String |
PROPERTY_UNCOMPLETED_COLOR
|
| Fields inherited from class echopointng.ComponentEx |
|---|
PROPERTY_HIDDEN |
| Fields inherited from interface echopointng.able.AccessKeyable |
|---|
PROPERTY_ACCESS_KEY |
| Fields inherited from interface echopointng.able.Borderable |
|---|
PROPERTY_BORDER |
| Fields inherited from interface echopointng.able.MouseCursorable |
|---|
CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, PROPERTY_MOUSE_CURSOR, PROPERTY_MOUSE_CURSOR_URI |
| Fields inherited from interface echopointng.able.Insetable |
|---|
DEFAULT_INSETS, DEFAULT_OUTSETS, PROPERTY_INSETS, PROPERTY_OUTSETS |
| Fields inherited from interface echopointng.able.Widthable |
|---|
PROPERTY_WIDTH |
| Fields inherited from interface echopointng.able.Heightable |
|---|
PROPERTY_HEIGHT |
| Fields inherited from interface echopointng.able.ToolTipable |
|---|
PROPERTY_TOOL_TIP_TEXT |
| Constructor Summary | |
|---|---|
ProgressBar()
Creates a horizontal progress bar. |
|
ProgressBar(BoundedRangeModel newModel)
Creates a horizontal progress bar, the default orientation. |
|
ProgressBar(int min,
int max)
Creates a horizontal progress bar, which is the default. |
|
| Method Summary | |
|---|---|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener to the ProgressBar. |
protected ChangeListener |
createChangeListener()
Subclasses that want to handle ChangeEvents differently can override this to return a subclass of ModelListener or another ChangeListener implementation. |
protected void |
fireStateChanged()
Notify all listeners that have registered interest for notification on this event type. |
Color |
getCompletedColor()
|
int |
getMaximum()
Returns the model's maximum value. |
int |
getMinimum()
Returns the model's minimum value. |
BoundedRangeModel |
getModel()
Returns the data model used by the ProgressBar. |
int |
getNumberOfBlocks()
|
int |
getOrientation()
Returns ProgressBar.ORIENTATION_VERTICAL or
ProgressBar.ORIENTATION_HORIZONTAL, depending on the
orientation of the progress bar. |
double |
getPercentComplete()
Returns the percentage/percent complete for the progress bar. |
ImageReference |
getProgressBarImage()
This returns the image used to represent the ProgressBar. |
java.lang.String |
getProgressString()
Returns the current value of the Progress String. |
ProgressBarRenderer |
getRenderer()
Returns the renderer used by the ProgressBar. |
Color |
getUncompletedColor()
|
int |
getValue()
Returns the model's current value. |
void |
invalidate()
Can be called to invalidate the ProgressBar so that it will redraw its internals when next rendered. |
boolean |
isProgressStringPainted()
Returns true if the progress bar will render a string onto the representation of the progress bar. |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from the ProgressBar. |
void |
setCompletedColor(Color newColor)
Sets the completed Color of the ProgressBar. |
void |
setMaximum(int n)
Sets the model's maximum to n . |
void |
setMinimum(int n)
Sets the model's minimum to n . |
void |
setModel(BoundedRangeModel newModel)
Sets the data model used by the ProgressBar. |
void |
setNumberOfBlocks(int newValue)
Sets the number of blocks used when displaying the ProgressBar< |
void |
setOrientation(int newOrientation)
Sets the progress bar's orientation to newOrientation , which must be ProgressBar.ORIENTATION_VERTICAL or
ProgressBar.ORIENTATION_HORIZONTAL. |
void |
setOrientation(int newOrientation,
boolean flipWidthAndHeight)
Sets the progress bar's orientation to newOrientation , which must be ProgressBar.ORIENTATION_VERTICAL or
ProgressBar.ORIENTATION_HORIZONTAL. |
void |
setProgressString(java.lang.String newValue)
Sets the value of the Progress String. |
void |
setProgressStringPainted(boolean newValue)
Sets whether the progress bar will render a string. |
void |
setRenderer(ProgressBarRenderer newRenderer)
Sets the renderer used by the ProgressBar. |
void |
setUncompletedColor(Color newColor)
Sets the uncompleted Color of the ProgressBar. |
void |
setValue(int n)
Sets the model's value to n . |
java.lang.String |
toString()
|
void |
validate()
A life-cycle method invoked before the component is rendered to ensure it is in a valid state. |
| Methods inherited from class echopointng.AbleComponent |
|---|
getAccessKey, getBorder, getHeight, getInsets, getMouseCursor, getMouseCursorURI, getOutsets, getToolTipText, getWidth, setAccessKey, setBorder, setHeight, setInsets, setMouseCursor, setMouseCursorURI, setOutsets, setToolTipText, setWidth |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Field Detail |
|---|
public static final java.lang.String PROPERTY_COMPLETED_COLOR
public static final java.lang.String PROPERTY_MODEL
public static final java.lang.String PROPERTY_NUMBER_OF_BLOCKS
public static final java.lang.String PROPERTY_ORIENTATION
public static final java.lang.String PROPERTY_PROGRESS_STRING
public static final java.lang.String PROPERTY_PROGRESS_STRING_PAINTED
public static final java.lang.String PROPERTY_PROGRESSBAR_IMAGE
public static final java.lang.String PROPERTY_RENDERER
public static final java.lang.String PROPERTY_UNCOMPLETED_COLOR
public static final int ORIENTATION_HORIZONTAL
public static final int ORIENTATION_VERTICAL
public static final Style DEFAULT_STYLE
protected transient ChangeEvent changeEvent
protected ChangeListener changeListener
| Constructor Detail |
|---|
public ProgressBar()
ProgressBar.HORIZONTAL.
By default, the ProgressString is set to null and the
ProgressStringPainted is not painted.
Uses the defaultMinimum (0) and defaultMaximum (100). Uses the defaultMinimum for the initial value of the progress bar.
public ProgressBar(BoundedRangeModel newModel)
By default, the ProgressString is set to null and the
ProgressStringPainted is not painted.
Uses the specified BoundedRangeModel which holds the minimum, value, and maximum.
public ProgressBar(int min,
int max)
By default, the ProgressString is set to null and the
ProgressStringPainted is not painted.
Uses the specified minimum and maximum. Uses the specified minimum for the initial value of the progress bar.
| Method Detail |
|---|
public void addChangeListener(ChangeListener l)
l - the ChangeListener to addprotected ChangeListener createChangeListener()
protected void fireStateChanged()
public Color getCompletedColor()
Color of the ProgressBar's
completed blocks.public int getMaximum()
100.
public int getMinimum()
0.
public BoundedRangeModel getModel()
ProgressBar.
public int getNumberOfBlocks()
ProgressBar.public int getOrientation()
ProgressBar.ORIENTATION_VERTICAL or
ProgressBar.ORIENTATION_HORIZONTAL, depending on the
orientation of the progress bar. The default orientation is
ORIENTATION_HORIZONTAL.
public double getPercentComplete()
public ImageReference getProgressBarImage()
Notice that their is no setProgressBarImage() method. The internal image is updated whenever the model is changed.
This is done by making a call to the ProgressBarRenderer.drawProgressBar method, which subclasses can override to customise how the progress bar is drawn.
public java.lang.String getProgressString()
public ProgressBarRenderer getRenderer()
ProgressBar.
public Color getUncompletedColor()
Color of the ProgressBar's
uncompleted blocks.public int getValue()
public void invalidate()
public boolean isProgressStringPainted()
public void removeChangeListener(ChangeListener l)
l - the ChangeListener to removepublic void setCompletedColor(Color newColor)
Color of the ProgressBar.
public void setMaximum(int n)
Notifies any listeners if the data changes.
public void setMinimum(int n)
The underlying BoundedRangeModel will handle any mathematical issues arrising from assigning faulty values.
Notifies any listeners if the data changes.
public void setModel(BoundedRangeModel newModel)
public void setNumberOfBlocks(int newValue)
ProgressBar<
public void setOrientation(int newOrientation)
ProgressBar.ORIENTATION_VERTICAL or
ProgressBar.ORIENTATION_HORIZONTAL. The default
orientation is ORIENTATION_HORIZONTAL.
public void setOrientation(int newOrientation,
boolean flipWidthAndHeight)
ProgressBar.ORIENTATION_VERTICAL or
ProgressBar.ORIENTATION_HORIZONTAL. The default
orientation is ORIENTATION_HORIZONTAL.
If the flipWidthAndHeight parameter is true, then the width and height properties will be flipped around.
public void setProgressString(java.lang.String newValue)
null.
public void setProgressStringPainted(boolean newValue)
public void setRenderer(ProgressBarRenderer newRenderer)
public void setUncompletedColor(Color newColor)
Color of the ProgressBar.
public void setValue(int n)
The underlying BoundedRangeModel will handle any mathematical issues arrising from assigning faulty values.
Notifies any listeners if the data changes.
public java.lang.String toString()
toString in class java.lang.Objectpublic void validate()
Componentsuper.validate()
out of convention.
validate in class ComponentComponent.validate()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||