ch.epfl.lsr.apex
Class APEXStatus

java.lang.Object
  extended bych.epfl.lsr.apex.APEXStatus

public class APEXStatus
extends Object

A status listener for APEX operations.

You can either use the blocking methods getStatus or getReason, or redefine the receivedStatus method or add an ActionListener to receive status events.

Author:
Marc Stoecklin

Constructor Summary
APEXStatus()
          Instantiates a new APEX status.
APEXStatus(ActionListener listener)
           Instantiates a new APEX status with an associated ActionListener Please consider the possibility to redefine the receivedStatus method for reuse.
APEXStatus(ActionListener listener, Object obj)
           Instantiates a new APEX status with an associated ActionListener and an object for reuse (e.g. in actionPerformed) Please consider the possibility to redefine the receivedStatus method for reuse.
APEXStatus(Object obj)
          Instantiates a new APEX status containig an optional object for later reuse.
 
Method Summary
 void endStatus()
          Can be called from the application to disable and terminate the status and release blocked threads.
 Object getObject()
          Returns the object associated to this status
 int getStatusCode()
          Returns the status code of this status or blocks if the status code is not known yet.
 String getStatusReason()
          Returns the textual reason of this status or blocks if the status code is not known yet.
 void receivedStatus(APEXStatus status)
          Can be redefined in order to call methods within the application on an event.
 void setActionListener(ActionListener listener)
          Sets an ActionListener on this status which is activated is a status update is performes.
 void setObject(Object obj)
          Sets an object associated to this status
 void setStatus(int code)
          Is called internally if the status for this status is known.
 void setStatus(int code, String reason)
          Is called internally if the status for this status is known.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

APEXStatus

public APEXStatus()

Instantiates a new APEX status.

Please consider the possibility to redefine the receivedStatus method for reuse.


APEXStatus

public APEXStatus(Object obj)

Instantiates a new APEX status containig an optional object for later reuse.

Please consider the possibility to redefine the receivedStatus method for reuse.


APEXStatus

public APEXStatus(ActionListener listener)

Instantiates a new APEX status with an associated ActionListener

Please consider the possibility to redefine the receivedStatus method for reuse.

Parameters:
listener - An action listener

APEXStatus

public APEXStatus(ActionListener listener,
                  Object obj)

Instantiates a new APEX status with an associated ActionListener and an object for reuse (e.g. in actionPerformed)

Please consider the possibility to redefine the receivedStatus method for reuse.

Parameters:
listener - An action listener
obj - An object associated to this status
Method Detail

setActionListener

public void setActionListener(ActionListener listener)
Sets an ActionListener on this status which is activated is a status update is performes.

Parameters:
listener - An action listener

setStatus

public void setStatus(int code)
Is called internally if the status for this status is known.

Parameters:
code - A status code

setStatus

public void setStatus(int code,
                      String reason)
Is called internally if the status for this status is known.

Parameters:
code - A status code
reason - A textual reason

getStatusCode

public int getStatusCode()
Returns the status code of this status or blocks if the status code is not known yet.

Returns:
A status code

getStatusReason

public String getStatusReason()
Returns the textual reason of this status or blocks if the status code is not known yet.

Returns:
A textual reason

endStatus

public void endStatus()
Can be called from the application to disable and terminate the status and release blocked threads.


receivedStatus

public void receivedStatus(APEXStatus status)
Can be redefined in order to call methods within the application on an event.

Parameters:
status - An APEXStatus object

getObject

public Object getObject()
Returns the object associated to this status

Returns:
The associated object

setObject

public void setObject(Object obj)
Sets an object associated to this status

Parameters:
obj - The associated object