com.levigo.util.swing.messaging
Class MessageResult

java.lang.Object
  extended by com.levigo.util.swing.messaging.MessageResult

public class MessageResult
extends Object

MessageResult can be used by MessageListeners to add result information to this message.

For example, user input, which of multiple buttons are hitten or whatever.
For this purpose, MessageResult has an result Map, in which results of any kind can be placed, identified by an given key.

Author:
Carolin Koehler

Field Summary
static String BOOLEAN_DECISION
          This key can be used by MessageListeners when feeding a MessageResultas a key for a boolean value that represents a simple YES/NO decision by the user.
static String CANCEL_AFFIRMED
          This value constant can be used by MessageListeners when feeding a MessageResultas user decision result for a YES/NO/CANCEL question.
static String NO_AFFIRMED
          This value constant can be used by MessageListeners when feeding a MessageResultas user decision result for a YES/NO/CANCEL question.
static String STANDARD_INPUT_STRING
          This key can be used to identify single input Strings returned by the user in messages of type Message.INPUT (e.g.
static String YES_AFFIRMED
          This value constant can be used by MessageListeners when feeding a MessageResultas user decision result for a YES/NO/CANCEL question.
static String YES_NO_CANCEL_DECISION
          This key can be used by MessageListeners when feeding a MessageResultas a key for a value that represents a simple YES/NO/CANCEL decision by the user.
 
Constructor Summary
MessageResult(MessageEvent associatedMessageEvent)
          Constructor for MessageResult.
 
Method Summary
 void addResult(Object resultIdentifier, Object result)
          Adds an result by name to already holded results.
 boolean containsKey(Object resultIdentifier)
          Returns true if result map contains a mapping for the specified resultIdentifier.
protected  void finalize()
           
 Object get(Object resultIdentifier)
          Returns the value to which the specified result identifier is mapped in this identity hash map, or null if the map contains no mapping for this identifier.
 boolean getBoolean(Object resultIdentifier)
          Returns the boolean valu for the given identifier.
 MessageEvent getMessageEvent()
          Returns the associate MessageEvent.
 Iterator getResultKeys()
          Returns an iterator over the key in the result map.
 boolean isEmpty()
          Returns true if result map is empty otherwise false
 Object removeResult(Object resultIdentifier)
          Removes result Object for given resultIdentifier from result map.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BOOLEAN_DECISION

public static final String BOOLEAN_DECISION
This key can be used by MessageListeners when feeding a MessageResultas a key for a boolean value that represents a simple YES/NO decision by the user.

See Also:
Constant Field Values

YES_NO_CANCEL_DECISION

public static final String YES_NO_CANCEL_DECISION
This key can be used by MessageListeners when feeding a MessageResultas a key for a value that represents a simple YES/NO/CANCEL decision by the user. See as possible result values also

See Also:
Constant Field Values

YES_AFFIRMED

public static final String YES_AFFIRMED
This value constant can be used by MessageListeners when feeding a MessageResultas user decision result for a YES/NO/CANCEL question. The key for this value is YES_NO_CANCEL_DECISION

See Also:
Constant Field Values

NO_AFFIRMED

public static final String NO_AFFIRMED
This value constant can be used by MessageListeners when feeding a MessageResultas user decision result for a YES/NO/CANCEL question. The key for this value is YES_NO_CANCEL_DECISION

See Also:
Constant Field Values

CANCEL_AFFIRMED

public static final String CANCEL_AFFIRMED
This value constant can be used by MessageListeners when feeding a MessageResultas user decision result for a YES/NO/CANCEL question. The key for this value is YES_NO_CANCEL_DECISION

See Also:
Constant Field Values

STANDARD_INPUT_STRING

public static final String STANDARD_INPUT_STRING
This key can be used to identify single input Strings returned by the user in messages of type Message.INPUT (e.g. as entered in a text field by the user).

See Also:
Constant Field Values
Constructor Detail

MessageResult

public MessageResult(MessageEvent associatedMessageEvent)
Constructor for MessageResult.

Method Detail

addResult

public void addResult(Object resultIdentifier,
                      Object result)
Adds an result by name to already holded results.

Parameters:
resultIdentifier - identifies the result Object for later use
result - the result Object

get

public Object get(Object resultIdentifier)
Returns the value to which the specified result identifier is mapped in this identity hash map, or null if the map contains no mapping for this identifier.

Parameters:
resultIdentifier - the key whose associated result is to be returned.
Returns:
the result identified by given result identifier, null if the map contains no mapping for this identifier or found result is null.
See Also:
Map.get(Object)

getBoolean

public boolean getBoolean(Object resultIdentifier)
Returns the boolean valu for the given identifier. Returns true if the value is defined and set to true, false otherwise.

Parameters:
resultIdentifier - the key whose associated result is to be returned.
Returns:
the boolean result
See Also:
Map.get(Object)

containsKey

public boolean containsKey(Object resultIdentifier)
Returns true if result map contains a mapping for the specified resultIdentifier.

Parameters:
resultIdentifier - key whose presence in result map is to be tested.
Returns:
true if result map contains a mapping for the specified identifier.
See Also:
Map.containsKey(java.lang.Object)

isEmpty

public boolean isEmpty()
Returns true if result map is empty otherwise false

See Also:
Map.isEmpty()

getResultKeys

public Iterator getResultKeys()
Returns an iterator over the key in the result map.

Returns:
an iterator over the keys.

removeResult

public Object removeResult(Object resultIdentifier)
Removes result Object for given resultIdentifier from result map.

Returns the result Object to which the result map previously associated the resultIdentifier, or null if the result map contained no mapping for this identifier.

Parameters:
resultIdentifier - key whose mapping is to be removed from the map.
Returns:
previous value associated with specified key, or null if there was no mapping for key.
See Also:
Map.remove(java.lang.Object)

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable
See Also:
Object.finalize()

getMessageEvent

public MessageEvent getMessageEvent()
Returns the associate MessageEvent.

Returns:
MessageEvent

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.