com.funambol.util
Interface Observable

All Superinterfaces:
java.lang.Runnable

public interface Observable
extends java.lang.Runnable

this interface is used by classes running tasks to implements Observer / Observable paradigm.

Eache watchable can have multiple watchers and must call the method update(object) of his watchers each time the watchable state changes.


Method Summary
 boolean addObserver(Observer o)
          add a observer to this observable
 int getMax()
          returns the number of steps the task will use.
 java.lang.String getMessage()
          a string that describes the current operation.
 int getProgress()
          returns a integere between 0 and max giving the progress of the task.
 long getProgressPercent()
          returns a long between 0 an 100 that indicate the % of the task completed.
 boolean isFinished()
          boolean returning true if task is finished
 void removeObserver(Observer o)
          remove an observer from this observable
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

addObserver

boolean addObserver(Observer o)
add a observer to this observable

Returns:
false if observable does not support more observers

removeObserver

void removeObserver(Observer o)
remove an observer from this observable


getProgressPercent

long getProgressPercent()
returns a long between 0 an 100 that indicate the % of the task completed. Should be formatted inside the watchable, i.e. returning 13.742913341 is a bad thing :) long is returned instead of double because of cld 1.0 limitations


getProgress

int getProgress()
returns a integere between 0 and max giving the progress of the task. if we are syncronizing 37 contacts progress should return the number of contacts syncronized.


getMax

int getMax()
returns the number of steps the task will use. if we are syncronizing 37 contacts this should return 37


getMessage

java.lang.String getMessage()
a string that describes the current operation. if we are syncronizing contacts this should be something like "syncronizing contacts"


isFinished

boolean isFinished()
boolean returning true if task is finished



Copyright © 2001-2009 Funambol.