All Packages Class Hierarchy This Package Previous Next Index
Class COM.ibm.beans.gauge.BaseGauge
java.lang.Object
|
+----java.awt.Component
|
+----COM.ibm.beans.gauge.BaseGauge
- public abstract class BaseGauge
- extends Component
- implements Gauge,
GaugeSynchronization,
Runnable, Serializable
This class provides a generic extensible implementation of the
Gauge interface. This class is abstract, and can be extended to
create widgets which act as single-value gauges. There is an
abstract extended form of the paint method, which must be
implemented in derived classes; these must not override
the standard component paint method.
BaseGauge(long,
long, long, GaugeSynchronization)
- Create a base gauge with an initial value and range, and
the given gauge synchronization as the default gauge
synchronization.
addImage(Image)
- Register an image to be monitored during loading
addImages(Image[])
- Register images to be monitored during loading
addNotify()
-
addPropertyChangeListener(PropertyChangeListener)
- Add listeners to gauge properties
adjustValue(long)
- Adjust the value for the gauge to present by a relative
amount.
areImagesReady()
- Return true if all images registered to be monitored
during loading are now ready.
background()
- Return the background to be drawn by this gauge prior to
each paint, or null if no background is set.
copyright()
-
dispose()
- Release all resources used by the gauge, including
stopping all threads.
getDefaultGaugeSynchronization()
- Return the default gauge synchronization, which is set
when the gauge is created.
getGaugeSynchronization()
- Return the current gauge synchronization.
getMaximum()
- Return the maximum of the current gauge range.
getMinimum()
- Return the minimum of the current gauge range.
getPreferredSize()
- Return the preferred size for the gauge, as set by
setPreferredSize().
getSupport()
-
getValue()
- Return the current value of the gauge.
imagesReady()
- This method is called automatically whenever the final
image currently registered to be monitored during loading
becomes ready.
imageUpdate(Image,
int, int, int, int, int)
- The standard component imageUpdate method.
isImageReady(Image)
- Return true if the image registered to be monitored
during loading is now ready.
isSynchronized(long,
long, long, long, long, long)
- Return true if the gauge considers the current display to
be fully synchronized.
nextValue(long,
long, long, long, long, long)
- Return the next value which the gauge display will show.
nextValueDelay(boolean)
- Return the time interval in milliseconds after which the
next value is to be displayed by the gauge.
paint(Graphics)
- The standard paint method, this cannot be overridden by
derived classes
paint(Graphics,
Dimension, long, long, long, boolean, long, long, long)
- Paint the gauge.
processComponentEvent(ComponentEvent)
-
removeNotify()
-
removePropertyChangeListener(PropertyChangeListener)
- Remove listeners to gauge properties
resetSynchronization()
-
run()
- The standard Runnable run method.
setBackground(Background)
- Set the background to be drawn by this gauge prior to
each paint.
setDefaultGaugeSynchronization(GaugeSynchronization)
- Set the default gauge synchronization to be used by this
gauge.
setGaugeSynchronization(GaugeSynchronization)
- Set the gauge synchronization to be used by this gauge.
setMaximum(long)
- Set the maximum value property for the gauge
setMinimum(long)
- Set the minimum value property for the gauge
setPreferredSize(int,
int)
- Set the preferred size for the gauge.
setRange(long,
long)
- Set the range for the gauge to present.
setValue(long)
- Set the value for the gauge to present.
setValueAndRange(long,
long, long)
- Set the value for the gauge to present, together with the
range to present it in.
synchronize()
- Wait until the gauge is synchronized.
update(Graphics)
- The standard update method, this cannot be overridden by
derived classes
waitForImages()
- This method waits until all currently registered images
are loaded.
BaseGauge
public BaseGauge(long initialValue,
long minimum,
long maximum,
GaugeSynchronization defaultGaugeSynchronization)
- Create a base gauge with an initial value and range, and
the given gauge synchronization as the default gauge
synchronization. The Background is set to null.
- See Also:
- setDefaultGaugeSynchronization,
setBackground
dispose
public void dispose()
- Release all resources used by the gauge, including
stopping all threads. This method should be called when
the gauge is no longer required.
copyright
public static String copyright()
resetSynchronization
public void resetSynchronization()
getDefaultGaugeSynchronization
public GaugeSynchronization getDefaultGaugeSynchronization()
- Return the default gauge synchronization, which is set
when the gauge is created.
- See Also:
- setDefaultGaugeSynchronization
setDefaultGaugeSynchronization
protected final void setDefaultGaugeSynchronization(GaugeSynchronization defaultGaugeSynchronization)
- Set the default gauge synchronization to be used by this
gauge. If null is passed, the default gauge
synchronization is reset to an immediate update
synchronization.
- See Also:
- setGaugeSynchronization
getGaugeSynchronization
public GaugeSynchronization getGaugeSynchronization()
- Return the current gauge synchronization. If a gauge
synchronization has been set, that will be returned,
otherwise this gauge's default gauge synchronization will
be returned.
- See Also:
- setGaugeSynchronization
setPreferredSize
public void setPreferredSize(int x,
int y)
- Set the preferred size for the gauge.
- See Also:
- preferredSize
getPreferredSize
public final Dimension getPreferredSize()
- Return the preferred size for the gauge, as set by
setPreferredSize(). The preferred size returned is
constrained below by the size returned by minimumSize().
- Overrides:
- getPreferredSize
in class Component
- See Also:
- setPreferredSize
adjustValue
public void adjustValue(long valueChange)
- Adjust the value for the gauge to present by a relative
amount.
background
public Background background()
- Return the background to be drawn by this gauge prior to
each paint, or null if no background is set.
- See Also:
- setBackground
nextValueDelay
public long nextValueDelay(boolean isSynchronized)
- Return the time interval in milliseconds after which the
next value is to be displayed by the gauge. This class
delegates this method to the current gauge
synchronization.
- See Also:
- setGaugeSynchronization,
getGaugeSynchronization,
nextValueDelay
isSynchronized
public boolean isSynchronized(long gaugevalue,
long gaugemin,
long gaugemax,
long currentdisplayvalue,
long currentdisplaymin,
long currentdisplaymax)
- Return true if the gauge considers the current display to
be fully synchronized. This class delegates this method
to the current gauge synchronization.
- See Also:
- setGaugeSynchronization,
getGaugeSynchronization,
isSynchronized
setGaugeSynchronization
public void setGaugeSynchronization(GaugeSynchronization gaugeSynchronization)
- Set the gauge synchronization to be used by this gauge.
If null is passed, the gauge synchronization is reset to
this gauge's default synchronization.
- See Also:
- setDefaultGaugeSynchronization
setBackground
public void setBackground(Background background)
- Set the background to be drawn by this gauge prior to
each paint. Setting null as the background causes no
background to be drawn prior to each paint.
- See Also:
- background
waitForImages
protected void waitForImages()
- This method waits until all currently registered images
are loaded.
- See Also:
- addImage, addImages, imagesReady, imagesReadyNotify, isImageReady
imagesReady
protected void imagesReady()
- This method is called automatically whenever the final
image currently registered to be monitored during loading
becomes ready. The default implementation re-lays out the
parent and repaints this component.
- See Also:
- addImage, addImages, imagesReady, imagesReadyNotify, isImageReady, waitForImages
imageUpdate
public boolean imageUpdate(Image image,
int flags,
int x,
int y,
int w,
int h)
- The standard component imageUpdate method. This method is
essential for correct functioning of this class. If
overridden, super.imageUpdate should still be called.
- Overrides:
- imageUpdate
in class Component
addImages
protected void addImages(Image images[])
- Register images to be monitored during loading
- See Also:
- addImage, areImagesReady, imagesReady, isImageReady, waitForImages
addImage
protected void addImage(Image image)
- Register an image to be monitored during loading
- See Also:
- addImages, areImagesReady, imagesReady, isImageReady, waitForImages
isImageReady
public boolean isImageReady(Image image)
- Return true if the image registered to be monitored
during loading is now ready. An image is considered ready
when it has completed loading, been aborted, or has an
error.
- See Also:
- addImage, addImages, imagesReadyNotify, waitForImages
areImagesReady
public boolean areImagesReady()
- Return true if all images registered to be monitored
during loading are now ready. An image is considered
ready when it has completed loading, been aborted, or has
an error.
- See Also:
- addImage, addImages, imagesReadyNotify, isImageReady, waitForImages
nextValue
public long nextValue(long gaugeValue,
long gaugeMinimum,
long gaugeMaximum,
long currentDisplayValue,
long currentDisplayMinimum,
long currentDisplayMaximum)
- Return the next value which the gauge display will show.
This class delegates this method to the current gauge
synchronization.
- See Also:
- setGaugeSynchronization,
getGaugeSynchronization,
nextValue
update
public final void update(Graphics g)
- The standard update method, this cannot be overridden by
derived classes
- Overrides:
- update
in class Component
paint
public final void paint(Graphics g)
- The standard paint method, this cannot be overridden by
derived classes
- Overrides:
- paint
in class Component
addNotify
public void addNotify()
- Overrides:
- addNotify
in class Component
removeNotify
public void removeNotify()
- Overrides:
- removeNotify
in class Component
paint
public abstract void paint(Graphics g,
Dimension d,
long nextDisplayValue,
long nextDisplayMinimum,
long nextDisplayMaximum,
boolean incremental,
long currentDisplayValue,
long currentDisplayMinimum,
long currentDisplayMaximum)
- Paint the gauge. The display value to showm and the range
this value is in, are supplied. This method may be called
to perform incremental updates, in which case incremental
will be true and the currently displayed value and range
are also supplied. In this case, it is sufficient to
amend only the parts of the display which change. Note
that the given dimension should be used to determine the
area to be drawn, since this may be different from the
component size.
- Parameters:
- g - a graphics to draw on.
- d - the dimension of the area to draw into.
- nextDisplayValue - the value to show.
- nextDisplayMinimum - the minimum of the range to
show.
- nextDisplayMaximum - the maximum of the range to
show.
- incremental - whether this is an incremental
paint request.
- currentDisplayValue - the value currently
displaying.
- currentDisplayMinimum - the minimum of the range
the current display value is in.
- currentDisplayMaximum - the maximum of the range
the current display value is in.
run
public void run()
- The standard Runnable run method.
synchronize
public void synchronize()
- Wait until the gauge is synchronized. The gauge is
synchronized when the current gauge synchronization
confirms that it is synchronized.
- See Also:
- setGaugeSynchronization
setMinimum
public void setMinimum(long minimum)
- Set the minimum value property for the gauge
setMaximum
public void setMaximum(long maximum)
- Set the maximum value property for the gauge
getMinimum
public long getMinimum()
- Return the minimum of the current gauge range.
getMaximum
public long getMaximum()
- Return the maximum of the current gauge range.
setRange
public void setRange(long minimum,
long maximum)
- Set the range for the gauge to present.
setValueAndRange
public void setValueAndRange(long value,
long minimum,
long maximum)
- Set the value for the gauge to present, together with the
range to present it in.
getValue
public long getValue()
- Return the current value of the gauge. Note that this may
not be the value currently displayed to the user, if the
gauge display is not yet synchronized.
setValue
public void setValue(long value)
- Set the value for the gauge to present.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener l)
- Add listeners to gauge properties
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener l)
- Remove listeners to gauge properties
getSupport
protected PropertyChangeSupport getSupport()
processComponentEvent
protected void processComponentEvent(ComponentEvent evt)
- Overrides:
- processComponentEvent
in class Component
All Packages Class Hierarchy This Package Previous Next Index