fdda.utils
Class Notification

java.lang.Object
  |
  +--fdda.utils.Notification
Direct Known Subclasses:
Notification

public abstract class Notification
extends Object

Provides an abstract interface for communicating messages to the user. The way these messages are displayed depends on the dialog component, where a subclass of Notification must be specified to do the real work. Each message has a source (roughly spoken the subsystem that triggers it) and a type.
Notification messages are not to be confused with logging; these are messages that the user shall definitely see; in some cases these are even questions the user must answer.
The 'message'-methods are all synchronized and it's therefore safe to use them from several concurrent threads (though no order of showing the messages is garanteed).

Author:
Jörg Rüdenauer

Field Summary
static int M_CONFIRM
          Type 'confirmation'
static int M_ERROR
          Type 'error'
static int M_QUESTION
          Type 'question'.
static int M_WARNING
          Type 'warning'.
static int S_ALGORITHM
          Source 'Algorithm'
static int S_MOD
          Source 'Modelling'
static int S_PLUGIN
          Source 'Plug-in'
static int S_PROCESSING
          Source 'Processing'
static int S_SYSTEM
          Source 'Operating System'
static int S_XML
          Source 'XML-Processing'
 
Constructor Summary
Notification()
           
 
Method Summary
static void indicateNormalState()
          Indicates to the user that the application is not occupied (e.g. by changing the cursor).
static void indicateOccupationState()
          Indicates to the user that the application is occupied (e.g. by changing the cursor).
protected abstract  void indicateState(boolean occupation)
          Delegate the occupation state indication to a subclass.
static void message(int type, int source, String message)
          Shows a message to the user, with a simple "Ok" button for confirmation and the source description as a title.
static void message(int type, int source, String title, String message)
          Shows a message to the user, with a simple "Ok" button for confirmation.
static int message(int type, int source, String message, String[] buttons)
          Shows a message to the user, with the source description as the title.
static int message(int type, int source, String title, String message, String[] buttons)
          Shows a message to the user.
static void setNotification(Notification aNotification)
          Initializes the component by specifying the subclass that shows the messages.
static void setSourceName(int nr, String name)
          Sets the description / name for a certain source.
protected abstract  int showMessage(int type, int source, String title, String message, String[] buttons)
          Delegate the showing of the message to a subclass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_WARNING

public static final int M_WARNING
Type 'warning'.

See Also:
Constant Field Values

M_QUESTION

public static final int M_QUESTION
Type 'question'. A question usually has some custom (abstract) buttons for the user to answer it.

See Also:
Constant Field Values

M_CONFIRM

public static final int M_CONFIRM
Type 'confirmation'

See Also:
Constant Field Values

M_ERROR

public static final int M_ERROR
Type 'error'

See Also:
Constant Field Values

S_XML

public static final int S_XML
Source 'XML-Processing'

See Also:
Constant Field Values

S_SYSTEM

public static final int S_SYSTEM
Source 'Operating System'

See Also:
Constant Field Values

S_ALGORITHM

public static final int S_ALGORITHM
Source 'Algorithm'

See Also:
Constant Field Values

S_MOD

public static final int S_MOD
Source 'Modelling'

See Also:
Constant Field Values

S_PROCESSING

public static final int S_PROCESSING
Source 'Processing'

See Also:
Constant Field Values

S_PLUGIN

public static final int S_PLUGIN
Source 'Plug-in'

See Also:
Constant Field Values
Constructor Detail

Notification

public Notification()
Method Detail

message

public static final int message(int type,
                                int source,
                                String title,
                                String message,
                                String[] buttons)
Shows a message to the user. Returns the number of the (abstract) button that was used to confirm the message.

Parameters:
type - the type of the message, one of the constants
source - the source of the message, probably one of the constants
title - the title of the message, e.g. used as title in a dialog
message - the message text
buttons - the inscriptions for (abstract) buttons, e.g. {"yes", "no"}
Returns:
the number of the button the user pressed (count starts with 0)

message

public static final void message(int type,
                                 int source,
                                 String title,
                                 String message)
Shows a message to the user, with a simple "Ok" button for confirmation.

Parameters:
type - the type of the message. It doesn't make sense to use this for a question
source - the source of the message, probably one of the constants
title - the title of the message, e.g. used as title in a dialog
message - the message text

message

public static final int message(int type,
                                int source,
                                String message,
                                String[] buttons)
Shows a message to the user, with the source description as the title.

Parameters:
type - the type of the message.
source - the source of the message, probably one of the constants
message - the message text
buttons - the inscriptions for (abstract) buttons, e.g. {"yes", "no"}
Returns:
the number of the button the user pressed (count starts with 0)

message

public static final void message(int type,
                                 int source,
                                 String message)
Shows a message to the user, with a simple "Ok" button for confirmation and the source description as a title.

Parameters:
type - the type of the message. It doesn't make sense to use this for a question
source - the source of the message, probably one of the constants
message - the message text

indicateOccupationState

public static final void indicateOccupationState()
Indicates to the user that the application is occupied (e.g. by changing the cursor).


indicateNormalState

public static final void indicateNormalState()
Indicates to the user that the application is not occupied (e.g. by changing the cursor).


showMessage

protected abstract int showMessage(int type,
                                   int source,
                                   String title,
                                   String message,
                                   String[] buttons)
Delegate the showing of the message to a subclass.

Parameters:
type - the type of the message, one of the constants
source - the source of the message, probably one of the constants
title - the title of the message, e.g. used as title in a dialog
message - the message text
buttons - the inscriptions for (abstract) buttons, e.g. {"yes", "no"}
Returns:
the number of the button the user pressed (count starts with 0)

indicateState

protected abstract void indicateState(boolean occupation)
Delegate the occupation state indication to a subclass.

Parameters:
occupation - whether the application is occupied

setNotification

public static final void setNotification(Notification aNotification)
Initializes the component by specifying the subclass that shows the messages.

Parameters:
aNotification - the (instance of) the subclass that shows the messages

setSourceName

public static final void setSourceName(int nr,
                                       String name)
Sets the description / name for a certain source. Old source names get replaced.

Parameters:
nr - the number of the source
name - the name / description of the source


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.