JHotDraw 7rev733

org.jhotdraw.gui
Class DefaultActivityModel

java.lang.Object
  extended by javax.swing.DefaultBoundedRangeModel
      extended by org.jhotdraw.gui.DefaultActivityModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.BoundedRangeModel, ActivityModel

public class DefaultActivityModel
extends javax.swing.DefaultBoundedRangeModel
implements ActivityModel

Default implementation of ActivityModel.

Version:
$Id$
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport propertySupport
           
 
Fields inherited from class javax.swing.DefaultBoundedRangeModel
changeEvent, listenerList
 
Fields inherited from interface org.jhotdraw.gui.ActivityModel
CANCELABLE_PROPERTY, CANCELED_PROPERTY, CLOSED_PROPERTY, ERROR_PROPERTY, INDETERMINATE_PROPERTY, NOTE_PROPERTY, WARNING_PROPERTY
 
Constructor Summary
DefaultActivityModel(java.lang.Object owner, java.lang.String title)
          Creates a new indeterminate DefaultActivityModel.
DefaultActivityModel(java.lang.Object owner, java.lang.String title, java.lang.String note, boolean isIndeterminate)
          Creates a new DefaultActivityModel.
DefaultActivityModel(java.lang.Object owner, java.lang.String title, java.lang.String note, int min, int max)
          Creates a new DefaultActivityModel.
DefaultActivityModel(java.lang.Object owner, java.lang.String title, java.lang.String note, int min, int max, boolean isIndeterminate)
          Creates a new DefaultActivityModel.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener which can optionally be wrapped into a WeakPropertyChangeListener.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener which can optionally be wrapped into a WeakPropertyChangeListener.
 void cancel()
          Cancels the operation.
 void close()
          Indicate that the operation is closed.
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 java.lang.String getError()
          Specifies the error message that is displayed along with the progress message.
 java.lang.String getNote()
          Specifies the additional note that is displayed along with the progress message.
 java.lang.Object getOwner()
          Gets the owner of the progress model.
 java.lang.String getTitle()
          Returns the title of the progress model.
 java.lang.String getWarning()
          Specifies the warning message that is displayed along with the progress message.
 boolean isCancelable()
          Returns true if the operation can be canceled.
 boolean isCanceled()
          Returns true if the user has hit the Cancel button in the progress dialog.
 boolean isClosed()
          Returns true if the operation is completed.
 boolean isIndeterminate()
          Returns true if the progress observer is set to indeterminate.
 void printf(java.lang.String format, java.lang.Object... args)
          Sets a formatted note.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void setCancelable(boolean newValue)
          Set cancelable to false if the operation can not be canceled.
 void setDoCancel(java.lang.Runnable doCancel)
          The specified Runnable is executed when the user presses the cancel button.
 void setError(java.lang.String newValue)
          Specifies the additional error message that is displayed along with the progress message.
 void setIndeterminate(boolean newValue)
          Sets the progress observer to indeterminate.
 void setNote(java.lang.String newValue)
          Specifies the additional note that is displayed along with the progress message.
 void setWarning(java.lang.String newValue)
          Specifies the additional warning message that is displayed along with the progress message.
 
Methods inherited from class javax.swing.DefaultBoundedRangeModel
addChangeListener, fireStateChanged, getChangeListeners, getExtent, getListeners, getMaximum, getMinimum, getValue, getValueIsAdjusting, removeChangeListener, setExtent, setMaximum, setMinimum, setRangeProperties, setValue, setValueIsAdjusting, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.BoundedRangeModel
addChangeListener, getExtent, getMaximum, getMinimum, getValue, getValueIsAdjusting, removeChangeListener, setExtent, setMaximum, setMinimum, setRangeProperties, setValue, setValueIsAdjusting
 

Field Detail

propertySupport

protected java.beans.PropertyChangeSupport propertySupport
Constructor Detail

DefaultActivityModel

public DefaultActivityModel(java.lang.Object owner,
                            java.lang.String title,
                            java.lang.String note,
                            boolean isIndeterminate)
Creates a new DefaultActivityModel.


DefaultActivityModel

public DefaultActivityModel(java.lang.Object owner,
                            java.lang.String title,
                            java.lang.String note,
                            int min,
                            int max)
Creates a new DefaultActivityModel.


DefaultActivityModel

public DefaultActivityModel(java.lang.Object owner,
                            java.lang.String title,
                            java.lang.String note,
                            int min,
                            int max,
                            boolean isIndeterminate)
Creates a new DefaultActivityModel.


DefaultActivityModel

public DefaultActivityModel(java.lang.Object owner,
                            java.lang.String title)
Creates a new indeterminate DefaultActivityModel.

Method Detail

setCancelable

public void setCancelable(boolean newValue)
Set cancelable to false if the operation can not be canceled.

Specified by:
setCancelable in interface ActivityModel

setDoCancel

public void setDoCancel(java.lang.Runnable doCancel)
The specified Runnable is executed when the user presses the cancel button.

Specified by:
setDoCancel in interface ActivityModel

close

public void close()
Indicate that the operation is closed.

Specified by:
close in interface ActivityModel

isCanceled

public boolean isCanceled()
Returns true if the user has hit the Cancel button in the progress dialog.

Specified by:
isCanceled in interface ActivityModel

isClosed

public boolean isClosed()
Returns true if the operation is completed.

Specified by:
isClosed in interface ActivityModel

cancel

public void cancel()
Cancels the operation. This method must be invoked from the user event dispatch thread.

Specified by:
cancel in interface ActivityModel

setNote

public void setNote(java.lang.String newValue)
Specifies the additional note that is displayed along with the progress message. Used, for example, to show which file the is currently being copied during a multiple-file copy.

Specified by:
setNote in interface ActivityModel
Parameters:
newValue - a String specifying the note to display
See Also:
getNote()

getNote

public java.lang.String getNote()
Specifies the additional note that is displayed along with the progress message.

Specified by:
getNote in interface ActivityModel
Returns:
a String specifying the note to display
See Also:
setNote(java.lang.String)

setWarning

public void setWarning(java.lang.String newValue)
Description copied from interface: ActivityModel
Specifies the additional warning message that is displayed along with the progress message. Used, for example, to show which files couldn't be copied during a multiple-file copy..

Specified by:
setWarning in interface ActivityModel
Parameters:
newValue - a String specifying the message to display, or null if there is no warning.
See Also:
ActivityModel.getWarning()

getWarning

public java.lang.String getWarning()
Description copied from interface: ActivityModel
Specifies the warning message that is displayed along with the progress message.

Specified by:
getWarning in interface ActivityModel
Returns:
a String specifying the message to display, or null if there is no warning.

setError

public void setError(java.lang.String newValue)
Description copied from interface: ActivityModel
Specifies the additional error message that is displayed along with the progress message. Used, for example, to show which files couldn't be copied during a multiple-file copy..

Specified by:
setError in interface ActivityModel
Parameters:
newValue - a String specifying the message to display, or null if there is no error.
See Also:
ActivityModel.getWarning()

getError

public java.lang.String getError()
Description copied from interface: ActivityModel
Specifies the error message that is displayed along with the progress message.

Specified by:
getError in interface ActivityModel
Returns:
a String specifying the message to display, or null if there is no error.

setIndeterminate

public void setIndeterminate(boolean newValue)
Description copied from interface: ActivityModel
Sets the progress observer to indeterminate.

Specified by:
setIndeterminate in interface ActivityModel

isIndeterminate

public boolean isIndeterminate()
Description copied from interface: ActivityModel
Returns true if the progress observer is set to indeterminate.

Specified by:
isIndeterminate in interface ActivityModel

printf

public void printf(java.lang.String format,
                   java.lang.Object... args)
Description copied from interface: ActivityModel
Sets a formatted note.

Specified by:
printf in interface ActivityModel

getOwner

public java.lang.Object getOwner()
Description copied from interface: ActivityModel
Gets the owner of the progress model. This is typically a View or a Application.

Specified by:
getOwner in interface ActivityModel

getTitle

public java.lang.String getTitle()
Description copied from interface: ActivityModel
Returns the title of the progress model.

Specified by:
getTitle in interface ActivityModel

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener which can optionally be wrapped into a WeakPropertyChangeListener.

Specified by:
addPropertyChangeListener in interface ActivityModel
Parameters:
listener -

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener which can optionally be wrapped into a WeakPropertyChangeListener.

Parameters:
listener -

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener. If the listener was added wrapped into a WeakPropertyChangeListener, the WeakPropertyChangeListener is removed.

Specified by:
removePropertyChangeListener in interface ActivityModel
Parameters:
listener -

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  boolean oldValue,
                                  boolean newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  int oldValue,
                                  int newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  @Nullable
                                  java.lang.Object oldValue,
                                  @Nullable
                                  java.lang.Object newValue)

isCancelable

public boolean isCancelable()
Description copied from interface: ActivityModel
Returns true if the operation can be canceled.

Specified by:
isCancelable in interface ActivityModel

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.