net.sf.jguiraffe.gui.platform.swing.builder.components
Class SwingProgressBarHandler

java.lang.Object
  extended by net.sf.jguiraffe.gui.platform.swing.builder.components.SwingComponentHandler
      extended by net.sf.jguiraffe.gui.platform.swing.builder.components.SwingProgressBarHandler
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, ProgressBarHandler, ComponentHandler, SwingEventSource

 class SwingProgressBarHandler
extends SwingComponentHandler
implements ProgressBarHandler, javax.swing.event.ChangeListener

An internally used handler class that deals with components of type JProgressBar.

The data type of this component handler is an integer representing the current value of the progress bar. This class also implements the ProgressBarHandler interface, which allows direct access to important properties.

Version:
$Id: SwingProgressBarHandler.java 69 2007-06-14 20:28:24Z oheger $
Author:
Oliver Heger

Constructor Summary
SwingProgressBarHandler(javax.swing.JProgressBar bar)
          Creates a new instance of SwingProgressBarHandler and initializes it with the managed component.
 
Method Summary
 java.lang.Object getData()
          Returns the data of the managed component.
 javax.swing.JProgressBar getProgressBar()
          Returns the managed JProgressBar component.
 java.lang.String getProgressText()
          Returns the text to be displayed on the progress bar.
 java.lang.Class getType()
          Returns the data type of the managed component.
 int getValue()
          Returns the current value of the progress bar.
protected  void registerChangeListener()
          Registers this object as change listener at the managed component.
 void setData(java.lang.Object data)
          Sets the data of the managed component.
 void setProgressText(java.lang.String s)
          Sets the text to be displayed on the progress bar.
 void setValue(int v)
          Sets the current value of the progress bar.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Notification method for change events.
protected  void unregisterChangeListener()
          Unregisters this handler as change listener from the managed component.
 
Methods inherited from class net.sf.jguiraffe.gui.platform.swing.builder.components.SwingComponentHandler
addActionListener, addChangeListener, addFocusListener, fireChangeEvent, getComponent, getJComponent, getOuterComponent, isEnabled, removeActionListener, removeChangeListener, removeFocusListener, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jguiraffe.gui.forms.ComponentHandler
getComponent, getOuterComponent, isEnabled, setEnabled
 

Constructor Detail

SwingProgressBarHandler

public SwingProgressBarHandler(javax.swing.JProgressBar bar)
Creates a new instance of SwingProgressBarHandler and initializes it with the managed component.

Parameters:
bar - the progress bar to be wrapped
Method Detail

getProgressBar

public javax.swing.JProgressBar getProgressBar()
Returns the managed JProgressBar component.

Returns:
the managed progress bar

getProgressText

public java.lang.String getProgressText()
Returns the text to be displayed on the progress bar.

Specified by:
getProgressText in interface ProgressBarHandler
Returns:
the progress text

getValue

public int getValue()
Returns the current value of the progress bar.

Specified by:
getValue in interface ProgressBarHandler
Returns:
the current value

setProgressText

public void setProgressText(java.lang.String s)
Sets the text to be displayed on the progress bar. The text will only be displayed if the allowText property was set when the progress bar was created.

Specified by:
setProgressText in interface ProgressBarHandler
Parameters:
s - the progress text

setValue

public void setValue(int v)
Sets the current value of the progress bar.

Specified by:
setValue in interface ProgressBarHandler
Parameters:
v - the new value

getData

public java.lang.Object getData()
Returns the data of the managed component.

Specified by:
getData in interface ComponentHandler
Returns:
the component's data

getType

public java.lang.Class getType()
Returns the data type of the managed component. In this case this is an integer.

Specified by:
getType in interface ComponentHandler
Returns:
the handler's data type

setData

public void setData(java.lang.Object data)
Sets the data of the managed component. The passed in value must be an integer. It is interpreted as the new value of the progress bar.

Specified by:
setData in interface ComponentHandler
Parameters:
data - the new data

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Notification method for change events. Notifies the registered change listeners.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - the event

registerChangeListener

protected void registerChangeListener()
Registers this object as change listener at the managed component.

Overrides:
registerChangeListener in class SwingComponentHandler

unregisterChangeListener

protected void unregisterChangeListener()
Unregisters this handler as change listener from the managed component.

Overrides:
unregisterChangeListener in class SwingComponentHandler
See Also:
SwingComponentHandler.registerChangeListener()


Copyright 2007 null. All Rights Reserved.