Class Message

All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean, Component, Ordered, ScriptEventSupport, ContentElement, LifecycleElement, org.springframework.core.Ordered

public class Message extends ContentElementBase
Encapsulates a text message to be displayed

The Message is used to display static text in the user interface

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • Message

      public Message()
  • Method Details

    • performApplyModel

      public void performApplyModel(Object model, LifecycleElement parent)
      Message perform apply model parses message text for rich text functionality if the messageText contains [ or ] special characters The following updates are done here:
      • Evaluate the progressive render condition (if set) and combine with the current render status to set the render status
      Called after the initialize phase to perform conditional logic based on the model data

      Where components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data

      Specified by:
      performApplyModel in interface LifecycleElement
      Overrides:
      performApplyModel in class ComponentBase
      Parameters:
      model - - Top level object containing the data (could be the form or a top level business object, dto)
      parent - parent lifecycle element
    • performFinalize

      public void performFinalize(Object model, LifecycleElement parent)
      The following finalization is done here:
      • progressiveRender and conditionalRefresh variables are processed if set
      • If any of the style properties were given, sets the style string on the style property
      • Set the skipInTabOrder flag for nested components
      The last phase before the view is rendered

      Here final preparations can be made based on the updated view state.

      Specified by:
      performFinalize in interface LifecycleElement
      Overrides:
      performFinalize in class ComponentBase
      Parameters:
      model - - top level object containing the data
      parent - - parent component
    • isRender

      public boolean isRender()
      Override to render only if the message text has been given or there is a conditional expression on the message text Indicates whether the component should be rendered in the UI

      If set to false, the corresponding component template will not be invoked (therefore nothing will be rendered to the UI).

      Specified by:
      isRender in interface LifecycleElement
      Overrides:
      isRender in class ComponentBase
      Returns:
      boolean true if the component should be rendered, false if it should not be
    • getMessageText

      public String getMessageText()
      Text that makes up the message that will be displayed.

      If special characters [] are detected the message is split at that location. The types of features supported by the parse are (note that <> are not part of the content, they specify placeholders):

      • [id=<component id>] - insert component with id specified at that location in the message
      • [n] - insert component at index n from the inlineComponent list
      • [<html tag>][/<html tag>] - insert html content directly into the message content at that location, without the need to escape the <> characters in xml
      • [color=<html color code/name>][/color] - wrap content in color tags to make text that color in the message
      • [css=<css classes>][/css] - apply css classes specified to the wrapped content - same as wrapping the content in span with class property set
      • [link=<href src>][/link] - an easier way to create an anchor that will open in a new page to the href specified after =
      • [action=<href src>][/action] - create an action link inline without having to specify a component by id or index. The options for this are as follows and MUST be in a comma separated list in the order specified (specify 1-4 always in this order):
        • methodToCall(String)
        • validateClientSide(boolean) - true if not set
        • ajaxSubmit(boolean) - true if not set
        • successCallback(js function or function declaration) - this only works when ajaxSubmit is true
        The tag would look something like this [action=methodToCall]Action[/action] in most common cases. And in more complex cases [action=methodToCall,true,true,functionName]Action[/action].

        In addition to these settings, you can also specify data to send to the server in this fashion (space is required between settings and data):

        [action=<action settings> data={key1: 'value 1', key2: value2}]

      If the [] characters are needed in message text, they need to be declared with an escape character: \\[ \\]

      Returns:
      message text
    • setMessageText

      public void setMessageText(String messageText)
      Setter for the message text
      Parameters:
      messageText -
    • getWrapperTag

      public String getWrapperTag()
      Defines the html tag that will wrap this message, if left blank, this will automatically be set by the framework to the appropriate tag (in most cases p or div)
      Returns:
      the html tag used to wrap this message
    • setWrapperTag

      public void setWrapperTag(String wrapperTag)
      See Also:
    • isRenderWrapperTag

      public boolean isRenderWrapperTag()
      If true, render the wrapper element (p or div) around this message (default true).

      The wrapper will be either a p tag, for when the element only contains inline elements, or a div tag, for when the message might contain block level elements or undetermined html tags resulting from rich message functionality. When false, skips the wrapper generation for this message - this has the additional effect the css classes/style classes will be lost for this message.

      Returns:
      true if generating a wrapping span, false otherwise
    • setRenderWrapperTag

      public void setRenderWrapperTag(boolean renderWrapperTag)
      Sets the generate wrapper element flag
      Parameters:
      renderWrapperTag -
    • getMessageComponentStructure

      public List<Component> getMessageComponentStructure()
      The message component structure is a list of components which represent the components that make up a message when using rich message functionality.

      The structure represents the parsed messageText when not set. Normally this structure is setup by the Message class and SHOULD NOT BE SET in xml, unless full control over the structure is needed.

      Returns:
      list of components which represent the message structure
    • setMessageComponentStructure

      public void setMessageComponentStructure(List<Component> messageComponentStructure)
      Set the message component structure. This will override/ignore messageText when set. Normally this SHOULD NOT BE SET by the xml configuration.
      Parameters:
      messageComponentStructure - list of components which represent the message structure
    • getInlineComponents

      @ViewLifecycleRestriction(exclude={"APPLY_MODEL","FINALIZE"}) public List<Component> getInlineComponents()
      The inlineComponents are a list of components in order by index.

      inlineComponents is only used when the message is using rich message functionality. A message with [0] will reference component at index 0 of this list and insert it at that place in the message, and likewise [1] will reference item 1, etc. If the index referenced is out of bounds (or list doesn't exist), an error will be thrown during message parse.

      Returns:
      the inlineComponents to be filled in at indexes referenced by [n] in the message
    • setInlineComponents

      public void setInlineComponents(List<Component> inlineComponents)
      Set the inlineComponents to be filled in at indexes referenced by [n] in the message
      Parameters:
      inlineComponents - the inlineComponents to be filled in at indexes referenced by [n] in the message
    • isParseComponents

      public boolean isParseComponents()
      Indicates if the inline components must be parsed for rich messages
      Returns:
      boolean
    • setParseComponents

      public void setParseComponents(boolean parseComponents)
      Sets the parse components flag to indicate if inline components must be parsed for rich messages
      Parameters:
      parseComponents -
    • isRichMessage

      public boolean isRichMessage()
      If this message is considered a rich message (is using some rich message functionality with by using the special [] tags), returns true
      Returns:
      return true if this message contains rich message content
    • isContainsBlockElements

      public boolean isContainsBlockElements()
      True if the message contains block elements, or when it contains an unknown tag that may be a block element.
      Returns:
      true when the message contains block elements (non-inline elements), false otherwise
    • completeValidation

      public void completeValidation(ValidationTrace tracer)
      Validates different requirements of component compiling a series of reports detailing information on errors found in the component. Used by the RiceDictionaryValidator.
      Specified by:
      completeValidation in interface Component
      Overrides:
      completeValidation in class ComponentBase
      Parameters:
      tracer - Record of component's location