net.rim.device.api.ui.component.progressindicator
Class AbstractProgressIndicatorModel

java.lang.Object
  extended by net.rim.device.api.ui.component.progressindicator.AbstractProgressIndicatorModel
Direct Known Subclasses:
ActivityIndicatorModel, ProgressIndicatorModel

public abstract class AbstractProgressIndicatorModel
extends Object

This model represents the data related to the progress being indicated. This model follows the Model-View-Controller design pattern and is to be associated with an AbstractProgressIndicatorView and an AbstractProgressIndicatorController.

This model represents a baseline for representing the model of progress. It provides the ability to AbstractProgressIndicatorModel.cancel(), AbstractProgressIndicatorModel.reset(), and AbstractProgressIndicatorModel.resume(). It also allows for the association of an Adjustment in order to process changes in the model's data.

In order to allow for multiple threads to handle the data related to progress, the related methods of this class are synchronized.

Since:
BlackBerry API 6.0.0

Constructor Summary
AbstractProgressIndicatorModel()
          Constructs a new AbstractProgressIndicatorModel.
 
Method Summary
 void addListener(ProgressIndicatorListener listener)
          Adds a listener to this data model.
 void cancel()
          Cancels the current representation of progress.
 Adjustment getAdjustment()
          Returns the Adjustment object assigned to this model.
 AbstractProgressIndicatorController getController()
          Returns the controller that has been associated with this model.
abstract  boolean isComplete()
          Indicates whether or not the progress has reached completion.
 void removeAdjustment(Adjustment adjustment)
          Removes the association with an Adjustment object.
 void removeListener(ProgressIndicatorListener listener)
          Removes an associated ProgressIndicatorListener object.
 void reset()
          Resets the data model to its initial state.
 void resume()
          Resumes progress after the progress had been cancelled.
 void setAdjustment(Adjustment adjustment)
          Associates an Adjustment object with this model.
 void setController(AbstractProgressIndicatorController controller)
          Sets a controller for this model.
 void setNonProgrammaticValue(int value)
          Sets a value such that every ProgressIndicatorListener is notified that the update is from a non-programmatic source.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

AbstractProgressIndicatorModel

public AbstractProgressIndicatorModel()
Constructs a new AbstractProgressIndicatorModel.

Since:
BlackBerry API 6.0.0


Method Detail

addListener

public void addListener(ProgressIndicatorListener listener)
Adds a listener to this data model. If an added listener throws an exception, that exception is thrown from this model; this model does not handle the exception.

Parameters:
listener - The ProgressIndicatorListener to associate with this model.
Since:
BlackBerry API 6.0.0

cancel

public void cancel()
Cancels the current representation of progress. Override this method to implement the appropriate stops to any data structure that is updating progress and to stop any associated animation.

Since:
BlackBerry API 6.0.0

getAdjustment

public Adjustment getAdjustment()
Returns the Adjustment object assigned to this model.

Returns:
The Adjustment object assigned to this data model, null if none has been set.
Since:
BlackBerry API 6.0.0

getController

public AbstractProgressIndicatorController getController()
Returns the controller that has been associated with this model.

Returns:
The ProgressIndicatorController associated with this model, null if none has been set.
Since:
BlackBerry API 6.0.0

isComplete

public abstract boolean isComplete()
Indicates whether or not the progress has reached completion.

Returns:
true if the progress is complete, false otherwise.
Since:
BlackBerry API 6.0.0

removeAdjustment

public void removeAdjustment(Adjustment adjustment)
Removes the association with an Adjustment object. The Adjustment is removed only if it matches the one provided.

Parameters:
adjustment - The Adjustment object to remove from this model.
Since:
BlackBerry API 6.0.0

removeListener

public void removeListener(ProgressIndicatorListener listener)
Removes an associated ProgressIndicatorListener object. The listener is removed only if it matches the one provided.

Parameters:
listener - The ProgressIndicatorListener object to remove from this model.
Since:
BlackBerry API 6.0.0

reset

public void reset()
Resets the data model to its initial state. Override this method to reflect your specific data model. This method does not remove any associated Adjustment object.

Since:
BlackBerry API 6.0.0

resume

public void resume()
Resumes progress after the progress had been cancelled. Resumes progress from the state it was in when it was cancelled. Override this method to reflect your specific data model.

See Also:
AbstractProgressIndicatorModel.cancel()
Since:
BlackBerry API 6.0.0

setAdjustment

public void setAdjustment(Adjustment adjustment)
Associates an Adjustment object with this model.

Parameters:
adjustment - The Adjustment object to associate with this model.
Since:
BlackBerry API 6.0.0

setController

public void setController(AbstractProgressIndicatorController controller)
Sets a controller for this model.

Parameters:
controller - The ProgressIndicatorController to associate with this model.
Since:
BlackBerry API 6.0.0

setNonProgrammaticValue

public void setNonProgrammaticValue(int value)
Sets a value such that every ProgressIndicatorListener is notified that the update is from a non-programmatic source. This is intended for use when the user changes the value. The value assigned will be bounded by the current minimum and maximum values.

Parameters:
value - The new value for the model.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.