talx x1.0.5

talx.model
Class GUIState

java.lang.Object
  extended bytalx.model.GUIState
All Implemented Interfaces:
GUIStateConstants, java.io.Serializable

public class GUIState
extends java.lang.Object
implements java.io.Serializable, GUIStateConstants

Holds the entire visual state of the system. Although this class is Serializable, it cannot be used directly when deserialzed. Before it can be used, it must have it transport toolkit set. The GUIStates returned from a "set" method on a deserialized GUIState with no toolkit will result in a GUIState that does not contain all of the information required to complete the deserialization process, and is useless in the system.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface talx.model.GUIStateConstants
ACTIVE_COMMANDS, ARCHIVE_MESSAGE, CHOICE_DIALOG, COMPOSE_FOCUS, COMPOSE_WINDOW, COMPOSER_CAPTION, COMPOSER_DIRTY, CONFIRM_DIALOG, CURRENT_PEOPLE, CURRENT_PLAYER, DEFAULT_MESSAGE, DIALOG_FOCUS, DIALOG_TEXT, INBOX_FOCUS, INBOX_MAIL_COUNTS, INBOX_MAIL_COUNTS_ANSWERED, INBOX_MAIL_COUNTS_NEW, INBOX_PANEL, INBOX_PLAYER_CAPTIONS, NO_CHANGE, NO_MESSAGE, NO_PEOPLE, NO_PERSON, NO_PLAYER, READER_CAPTION, READER_FOCUS, READER_HEADERS, READER_WINDOW, STATE_ABBR, STATE_CONST, STATE_DESC
 
Constructor Summary
GUIState(TransportToolkit tt)
          Creates a new gui state with no values set.
 
Method Summary
 void fetchMessage(TransportToolkit tt)
          Gets the actual message from the store after deserialization.
 Person findPerson()
          Returns the person who sent the current message.
static GUIState fromString(java.lang.String source)
          Converts the output of toString back to a GUIstate object.
 java.io.Serializable get(java.lang.String key)
          Gets the value associated with the given key.
 long getMask()
          Returns the bit mask of this state
 javax.mail.internet.MimeMessage getMessage()
          Returns the current message.
 StringValueMap getProps()
           
 boolean isTrue(long mask)
          Returns true if the current value contains all of the bits from mask.
 boolean isTrue(long requiredMask, long prohibitedMask)
          Returns true if the current value contains all bits from requiredMask and no bits from prohibitedMask.
 GUIState put(java.lang.String key, java.io.Serializable value)
          Adds the given key value pair.
 GUIState setMask(long mask)
          Returns a new GUIstate with mask added and all other bits removed.
 GUIState setMask(long addMask, long removeMask)
          Returns a new GUIState with addMask added and removeMask removed.
 GUIState setMessage(javax.mail.internet.MimeMessage m)
          Returns a new GUIState with the given message.
static java.lang.String[] setStrings(java.lang.String[] target, java.lang.String[] add, java.lang.String[] remove)
          Adds and deletes strings from an array such as the String array for ACTIVE_COMMANDS.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GUIState

public GUIState(TransportToolkit tt)
Creates a new gui state with no values set.

Method Detail

setStrings

public static java.lang.String[] setStrings(java.lang.String[] target,
                                            java.lang.String[] add,
                                            java.lang.String[] remove)
Adds and deletes strings from an array such as the String array for ACTIVE_COMMANDS.

Parameters:
target - the array to be altered.
remove - array of items to remove from target, if present.
add - array of items to add to target, if absent. This array WILL BE ALTERED in the course of the method. Therefore, if the array is needed for later processing, this method should be given a copy.
Throws:
java.lang.NullPointerException - if any of the entries in any array are null or add or remove are null.

fetchMessage

public void fetchMessage(TransportToolkit tt)
                  throws javax.mail.MessagingException
Gets the actual message from the store after deserialization. This method must be called on a deserialized GUIState before it can be used.

Throws:
javax.mail.MessagingException

setMask

public GUIState setMask(long addMask,
                        long removeMask)
Returns a new GUIState with addMask added and removeMask removed. All other bits remain unchanged.


setMask

public GUIState setMask(long mask)
Returns a new GUIstate with mask added and all other bits removed.


setMessage

public GUIState setMessage(javax.mail.internet.MimeMessage m)
Returns a new GUIState with the given message.


put

public GUIState put(java.lang.String key,
                    java.io.Serializable value)
Adds the given key value pair.


get

public java.io.Serializable get(java.lang.String key)
Gets the value associated with the given key.


isTrue

public boolean isTrue(long mask)
Returns true if the current value contains all of the bits from mask.


isTrue

public boolean isTrue(long requiredMask,
                      long prohibitedMask)
Returns true if the current value contains all bits from requiredMask and no bits from prohibitedMask.


getMessage

public javax.mail.internet.MimeMessage getMessage()
Returns the current message.


findPerson

public Person findPerson()
Returns the person who sent the current message. This method passes the request through to the TransportToolkit. This exists for the benefit of features that need the person but don't have access to the toolkit.


getMask

public long getMask()
Returns the bit mask of this state


getProps

public StringValueMap getProps()

toString

public java.lang.String toString()

fromString

public static GUIState fromString(java.lang.String source)
Converts the output of toString back to a GUIstate object. The resulting object must have its fetchMessage method called before it is completely restored. Also, the resulting StringValueMap will not contain only string representations of the original serializable Objects.

Throws:
java.lang.IllegalArgumentException - if the source is not a legal GUIState string.

talx x1.0.5

© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.