org.zaval.lw
Class LwProgress
java.lang.Object
|
+--org.zaval.lw.LwCanvas
|
+--org.zaval.lw.LwProgress
- All Implemented Interfaces:
- Layoutable, LwComponent, Validationable
- public class LwProgress
- extends LwCanvas
This is progress bar component that can be used to display progress status for
some processes. The progress status is changed starting from zero to a maximal value. The
maximal value can be set by the setMaxValue method and current status can be
controlled by the getValue and setValue methods. Use the
addActionListener and removeActionListener methods to listen
whenever the current progress status has been changed. The action event returns previous
value by the data argument.
The progress bar component can be oriented one of the following manner:
- LwToolkit.HORIZONTAL (the default orientation)
- LwToolkit.VERTICAL
Use the setOrientation method to define the progress bar orientation.
Use the setView method to define title and bundle views for the component. The title
view is rendered at the center of the progress bar component.
| Fields inherited from class org.zaval.lw.LwCanvas |
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y |
|
Constructor Summary |
LwProgress()
Constructs the progress bar. |
|
Method Summary |
void |
addActionListener(LwActionListener l)
Adds the specified action listener to receive action events from this component. |
protected java.awt.Dimension |
calcPreferredSize()
Gets the "pure" preferred size for this component. |
int |
getValue()
Gets the current progress value. |
LwView |
getView(int type)
Gets the specified element view. |
void |
paint(java.awt.Graphics g)
Paints this component. |
protected void |
recalc()
Invoked with validate method only if the component is not valid.
|
void |
removeActionListener(LwActionListener l)
Removes the specified action listener. |
void |
setBundleColor(java.awt.Color c)
Sets the bundle color. |
void |
setBundleSize(int size)
Sets the bundle size. |
void |
setGap(int g)
Sets the gap. |
void |
setMaxValue(int m)
Sets the maximal value. |
void |
setOrientation(int o)
Sets the specified orientation for the component. |
void |
setValue(int p)
Sets the current value. |
void |
setView(int type,
LwView v)
Sets the specified view for the specified progress bar element. |
| Methods inherited from class org.zaval.lw.LwCanvas |
calcInsets, canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwComponentAt, getLwParent, getOrigin, getPreferredSize, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isOpaque, isValid, isVisible, repaint, repaint, repaint, requestFocus, setBackground, setEnabled, setInsets, setLocation, setLwParent, setOpaque, setPSSize, setSize, setViewMan, setVisible, update, validate, viewManChanged, vrp |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TITLE_VIEW
public static final int TITLE_VIEW
- The title view id.
BUNDLE_VIEW
public static final int BUNDLE_VIEW
- The bundle view id.
LwProgress
public LwProgress()
- Constructs the progress bar.
setOrientation
public void setOrientation(int o)
- Sets the specified orientation for the component. Use LwToolkit.HORIZONTAL or
LwToolkit.VERTICAL constants as the orientation value.
- Parameters:
o - the specified orientation.
getValue
public int getValue()
- Gets the current progress value.
- Returns:
- a current progress value.
setBundleSize
public void setBundleSize(int size)
- Sets the bundle size. The bundle size makes sense only in a case when the bundle view has not been
specified., otherwise the method will not have effect
- Parameters:
size - the bundle size.
setBundleColor
public void setBundleColor(java.awt.Color c)
- Sets the bundle color. The bundle color makes sense only in a case when the bundle view has not been
specified.
- Parameters:
c - the bundle color.
setMaxValue
public void setMaxValue(int m)
- Sets the maximal value.
- Parameters:
m - the maximal value.
setValue
public void setValue(int p)
- Sets the current value.
- Parameters:
p - the current value.
setGap
public void setGap(int g)
- Sets the gap. The gap defines indent between progress bar bundles.
- Parameters:
g - the gap.
getView
public LwView getView(int type)
- Gets the specified element view.
- Parameters:
type - the element type. Use the BUNDLE_VIEW or TITLE_VIEW as the argument value.- Returns:
- a view.
setView
public void setView(int type,
LwView v)
- Sets the specified view for the specified progress bar element.
- Parameters:
type - the element type. Use the BUNDLE_VIEW or TITLE_VIEW as the argument value.v - the specified title view.
paint
public void paint(java.awt.Graphics g)
- Description copied from class:
LwCanvas
- Paints this component. You can use the method to define a face of the
component
- Overrides:
paint in class LwCanvas
- Following copied from class:
org.zaval.lw.LwCanvas
- Parameters:
g - the graphics context to be used for painting.
addActionListener
public void addActionListener(LwActionListener l)
- Adds the specified action listener to receive action events from this component.
- Parameters:
l - the specified action listener.
removeActionListener
public void removeActionListener(LwActionListener l)
- Removes the specified action listener.
- Parameters:
l - the specified action listener.
recalc
protected void recalc()
- Description copied from class:
LwCanvas
- Invoked with
validate method only if the component is not valid.
The method should be overridden to calculate metrical characteristics of the component to
minimize computation time of the preferred size for the component. For example, you can
calculate a preferred size inside the method and just return it by
calcPreferredSize method.
- Overrides:
recalc in class LwCanvas
calcPreferredSize
protected java.awt.Dimension calcPreferredSize()
- Description copied from class:
LwCanvas
- Gets the "pure" preferred size for this component. The method should be overridden to define
the component preferred size. Don't use insets to calculate the preferred size, the insets
will be added with
getPreferredSize method.
- Overrides:
calcPreferredSize in class LwCanvas
- Following copied from class:
org.zaval.lw.LwCanvas
- Returns:
- a "pure" preferred size.
|