com.jalios.jcms.context
Class JcmsMessage

java.lang.Object
  extended by com.jalios.jcms.context.JcmsMessage

public class JcmsMessage
extends Object

Wrapper class for message(s) to be displayed to the user in the GUI.

In order for the message to be visible, JSP doMessageBox.jsp must be invoked, either in the current request when using JcmsContext.addMsg(javax.servlet.http.HttpServletRequest, JcmsMessage), or in any request of the session when using JcmsContext.addMsgSession(javax.servlet.http.HttpServletRequest, JcmsMessage).

Example, when used inside any Java Bean or FormHandler extending JcmsContext or any of its subclass ( JcmsJspContext, JcmsFormHandler...) :

   addMsg( new JcmsMessage(Level.WARN, glp("jcmsplugin.myplugin.msg.warn.missing-something")) );
 
Example when used in any other class :
   JcmsContext.addMsg(request, new JcmsMessage(Level.WARN, JcmsUtil.glp(userLang, "jcmsplugin.myplugin.msg.warn.missing-something")) );
 

Since:
jcms-7.0

Nested Class Summary
static class JcmsMessage.Level
          Criticity Level of message being displayed to the User.
 
Constructor Summary
JcmsMessage(JcmsMessage.Level level, String message)
          Creates a new JcmsMessage with the specified level and message
JcmsMessage(String id, JcmsMessage.Level level, String message)
          Creates a new JcmsMessage with the specified level and message, and with a unique identifier.
 
Method Summary
 boolean equals(Object obj)
           
 String getId()
          Retrieves the id of this JcmsMessage, if any.
 JcmsMessage.Level getLevel()
           
 String getMessage()
           
 void setId(String id)
           
 void setLevel(JcmsMessage.Level level)
           
 void setMessage(String message)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcmsMessage

public JcmsMessage(JcmsMessage.Level level,
                   String message)
Creates a new JcmsMessage with the specified level and message

Parameters:
level - the criticity level
message - the message, must already be I18Ned

JcmsMessage

public JcmsMessage(String id,
                   JcmsMessage.Level level,
                   String message)
Creates a new JcmsMessage with the specified level and message, and with a unique identifier.

Parameters:
id - an identifier of this message, can be null
level - the criticity level
message - the message, must already be I18Ned
Method Detail

getId

public String getId()
Retrieves the id of this JcmsMessage, if any.

Returns:
the JcmsMessage identifier, or null if none has been defined.

setId

public void setId(String id)

getLevel

public JcmsMessage.Level getLevel()

setLevel

public void setLevel(JcmsMessage.Level level)

getMessage

public String getMessage()

setMessage

public void setMessage(String message)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2001-2010 Jalios SA. All Rights Reserved.