pt.digitalis.dif.dem.objects.messages
Class MessageList

java.lang.Object
  extended by pt.digitalis.dif.dem.objects.messages.MessageList

public class MessageList
extends Object

Represents a view message with language translations and persistence information

Author:
Pedro Viegas pviegas@digitalis.pt
, Rodrigo Goncalves rgoncalves@digitalis.pt
Created on:
Nov 2, 2007

Constructor Summary
MessageList()
           
 
Method Summary
 void addMessage(String id, Message message)
          Adds a message to the list.
 void addMessage(String id, MessageTranslations translations)
          Adds a message to the list.
 void addMessage(String id, String message)
          Adds a message to the list.
 void addMessageList(MessageList list)
          Adds a message list to the list.
 void addMessageTranslation(String id, String language, Message message)
          Adds a message translation to the list
 boolean containsMessageWithID(String messageID)
          Checks if a given message is contained on the list.
 List<String> getMessageIDs()
          Gets the list of messages IDs
 Map<String,String> getMessages()
          Gets the list of messages and their default translation message
 Map<String,String> getMessages(String language)
          Gets the list of messages and their default message translation to the given language
 MessageTranslations getMessageTranslations(String id)
          Gets the translations for a given message
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageList

public MessageList()
Method Detail

addMessage

public void addMessage(String id,
                       Message message)
Adds a message to the list. Uses the default language

Parameters:
id - the message id
message - the message

addMessage

public void addMessage(String id,
                       MessageTranslations translations)
Adds a message to the list. Note: It overrides the current translations if they exist.

Parameters:
id - the message id
translations - the translations list

addMessage

public void addMessage(String id,
                       String message)
Adds a message to the list. Uses the default language and no custom message

Parameters:
id - the message id
message - the message

addMessageList

public void addMessageList(MessageList list)
Adds a message list to the list. All identical ids will override the current ones.

Parameters:
list - the list of message translations to add

addMessageTranslation

public void addMessageTranslation(String id,
                                  String language,
                                  Message message)
Adds a message translation to the list

Parameters:
id -
language -
message -

containsMessageWithID

public boolean containsMessageWithID(String messageID)
Checks if a given message is contained on the list.

Parameters:
messageID - the message ID
Returns:
T if the message with the given ID is contained within the list, F otherwise

getMessageIDs

public List<String> getMessageIDs()
Gets the list of messages IDs

Returns:
the message translations

getMessages

public Map<String,String> getMessages()
Gets the list of messages and their default translation message

Returns:
the message map

getMessages

public Map<String,String> getMessages(String language)
Gets the list of messages and their default message translation to the given language

Parameters:
language - the language desired
Returns:
the message map

getMessageTranslations

public MessageTranslations getMessageTranslations(String id)
Gets the translations for a given message

Parameters:
id - the id of the message to search
Returns:
the message translations for the given message id

toString

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


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.