Package com.jalios.jcms.context
Class JcmsMessage
- java.lang.Object
-
- com.jalios.jcms.context.JcmsMessage
-
public class JcmsMessage extends java.lang.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 usingJcmsContext.addMsg(javax.servlet.http.HttpServletRequest, JcmsMessage)
, or in any request of the session when usingJcmsContext.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
Nested Classes Modifier and Type Class Description static class
JcmsMessage.Level
Criticity Level of message being displayed to the User.
-
Constructor Summary
Constructors Constructor Description JcmsMessage(JcmsMessage.Level level, java.lang.String message)
Creates a new JcmsMessage with the specified level and messageJcmsMessage(java.lang.String id, JcmsMessage.Level level, java.lang.String message)
Creates a new JcmsMessage with the specified level and message, and with a unique identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getId()
Retrieves the id of this JcmsMessage, if any.JcmsMessage.Level
getLevel()
java.lang.String
getMessage()
void
setId(java.lang.String id)
void
setLevel(JcmsMessage.Level level)
void
setMessage(java.lang.String message)
java.lang.String
toString()
-
-
-
Constructor Detail
-
JcmsMessage
public JcmsMessage(JcmsMessage.Level level, java.lang.String message)
Creates a new JcmsMessage with the specified level and message- Parameters:
level
- the criticity levelmessage
- the message, must already be I18Ned
-
JcmsMessage
public JcmsMessage(java.lang.String id, JcmsMessage.Level level, java.lang.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 nulllevel
- the criticity levelmessage
- the message, must already be I18Ned
-
-
Method Detail
-
getId
public java.lang.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(java.lang.String id)
-
getLevel
public JcmsMessage.Level getLevel()
-
setLevel
public void setLevel(JcmsMessage.Level level)
-
getMessage
public java.lang.String getMessage()
-
setMessage
public void setMessage(java.lang.String message)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-