Package javax.faces.application.FacesMessage

Examples of javax.faces.application.FacesMessage.Severity


      if(msg.isRendered() && !uiMessage.isRedisplay()) {
        writer.endElement("div");
        return;
       
      } else {
        Severity severity = msg.getSeverity();
        String severityKey = null;
       
        if(severity.equals(FacesMessage.SEVERITY_ERROR)) severityKey = "error";
        else if(severity.equals(FacesMessage.SEVERITY_INFO)) severityKey = "info";
        else if(severity.equals(FacesMessage.SEVERITY_WARN)) severityKey = "warn";
        else if(severity.equals(FacesMessage.SEVERITY_FATAL))  severityKey = "fatal";

                String styleClass = "ui-message-" + severityKey + " ui-widget ui-corner-all";
                if(iconOnly) {
                    styleClass = styleClass + " ui-message-icon-only ui-helper-clearfix";
                }
View Full Code Here


    /** {@inheritDoc} */
    public Severity getMaximumSeverity()
    {

        Severity severity = null;
        Iterator messages = getMessages();
        while (messages.hasNext())
        {
            FacesMessage message = (FacesMessage) messages.next();
            if (severity == null)
            {
                severity = message.getSeverity();
            }
            else if (message.getSeverity().getOrdinal() > severity.getOrdinal())
            {
                severity = message.getSeverity();
            }
        }
        return severity;
View Full Code Here

   }

   @Override
   public Severity getMaximumSeverity()
   {
      Severity max = null;
      for (FacesMessage msg : messages.keySet())
      {
         if (max == null || msg.getSeverity().compareTo(max) > 0)
         {
            max = msg.getSeverity();
View Full Code Here

         final String viewId = render.attributeValue("view-id");
         Element messageElement = render.element("message");
         String message = messageElement==null ? null : messageElement.getTextTrim();
         String control = messageElement==null ? null : messageElement.attributeValue("for");
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  getFacesMessageValuesMap().get( severityName.toUpperCase() );
         rule.addNavigationHandler( new RenderNavigationHandler(stringValueExpressionFor(viewId), message, severity, control) );
      }
     
      Element redirect = element.element("redirect");
      if (redirect!=null)
      {
         List<Element> children = redirect.elements("param");
         final List<Param> params = new ArrayList<Param>();
         for (Element child: children)
         {
            params.add( parseParam(child, true) );
         }
         final String viewId = redirect.attributeValue("view-id");
         final String url    = redirect.attributeValue("url");
         final String includePageParamsAttr = redirect.attributeValue("include-page-params");
         final boolean includePageParams = includePageParamsAttr == null ? true : Boolean.getBoolean(includePageParamsAttr);

         Element messageElement = redirect.element("message");
         String control = messageElement==null ? null : messageElement.attributeValue("for");
         String message = messageElement==null ? null : messageElement.getTextTrim();
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  getFacesMessageValuesMap().get( severityName.toUpperCase() );
         rule.addNavigationHandler(new RedirectNavigationHandler(stringValueExpressionFor(viewId),
               stringValueExpressionFor(url), params, message, severity, control, includePageParams) );
      }
View Full Code Here

      {
         String viewId = redirect.attributeValue("view-id");
         Element messageElement = redirect.element("message");
         final String message = messageElement==null ? null : messageElement.getTextTrim();
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  Pages.getFacesMessageValuesMap().get( severityName.toUpperCase() );
         return new ConfigRedirectHandler(viewId == null ? null : Expressions.instance().createValueExpression(
               viewId, String.class), clazz, endConversation, message, severity);
      }
View Full Code Here

        Iterator<FacesMessage> msgIterator = fc.getMessages();
        if (msgIterator != null)
        { // Check Messages
            while (msgIterator.hasNext())
            { // Check Severity
                Severity fms = msgIterator.next().getSeverity();
                if (fms == FacesMessage.SEVERITY_ERROR || fms == FacesMessage.SEVERITY_FATAL)
                    return true;
            }
        }
        return false;
View Full Code Here

         final String viewId = render.attributeValue("view-id");
         Element messageElement = render.element("message");
         String message = messageElement==null ? null : messageElement.getTextTrim();
         String control = messageElement==null ? null : messageElement.attributeValue("for");
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  getFacesMessageValuesMap().get( severityName.toUpperCase() );
         rule.addNavigationHandler( new RenderNavigationHandler(stringValueExpressionFor(viewId), message, severity, control) );
      }
     
      Element redirect = element.element("redirect");
      if (redirect!=null)
      {
         List<Element> children = redirect.elements("param");
         final List<Param> params = new ArrayList<Param>();
         for (Element child: children)
         {
            params.add( parseParam(child, true) );
         }
         final String viewId = redirect.attributeValue("view-id");
         final String url    = redirect.attributeValue("url");
         final String includePageParamsAttr = redirect.attributeValue("include-page-params");
         final boolean includePageParams = includePageParamsAttr == null ? true : Boolean.getBoolean(includePageParamsAttr);

         Element messageElement = redirect.element("message");
         String control = messageElement==null ? null : messageElement.attributeValue("for");
         String message = messageElement==null ? null : messageElement.getTextTrim();
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  getFacesMessageValuesMap().get( severityName.toUpperCase() );
         rule.addNavigationHandler(new RedirectNavigationHandler(stringValueExpressionFor(viewId),
               stringValueExpressionFor(url), params, message, severity, control, includePageParams) );
      }
View Full Code Here

         final String viewId = render.attributeValue("view-id");
         Element messageElement = render.element("message");
         String message = messageElement==null ? null : messageElement.getTextTrim();
         String control = messageElement==null ? null : messageElement.attributeValue("for");
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  getFacesMessageValuesMap().get( severityName.toUpperCase() );
         rule.addNavigationHandler( new RenderNavigationHandler(stringValueExpressionFor(viewId), message, severity, control) );
      }
     
      Element redirect = element.element("redirect");
      if (redirect!=null)
      {
         List<Element> children = redirect.elements("param");
         final List<Param> params = new ArrayList<Param>();
         for (Element child: children)
         {
            params.add( parseParam(child, true) );
         }
         final String viewId = redirect.attributeValue("view-id");
         final String url    = redirect.attributeValue("url");
         final String includePageParamsAttr = redirect.attributeValue("include-page-params");
         final boolean includePageParams = includePageParamsAttr == null ? true : Boolean.getBoolean(includePageParamsAttr);

         Element messageElement = redirect.element("message");
         String control = messageElement==null ? null : messageElement.attributeValue("for");
         String message = messageElement==null ? null : messageElement.getTextTrim();
         String severityName = messageElement==null ? null : messageElement.attributeValue("severity");
         Severity severity = severityName==null ?
                  FacesMessage.SEVERITY_INFO :
                  getFacesMessageValuesMap().get( severityName.toUpperCase() );
         rule.addNavigationHandler(new RedirectNavigationHandler(stringValueExpressionFor(viewId),
               stringValueExpressionFor(url), params, message, severity, control, includePageParams) );
      }
View Full Code Here

         return result;
     }

     public Severity getMaximumSeverity() {
         assertNotReleased();
         Severity max = FacesMessage.SEVERITY_INFO;

         if (null == componentMessageLists) {
             return null;
         }
         // Get an Iterator over the ArrayList instances
         List messages = getMergedMessageLists();
         for (int i = 0, size = messages.size(); i < size; i++) {
             Severity s = ((FacesMessage) messages.get(i)).getSeverity();
             if (s.getOrdinal() > max.getOrdinal()) {
                 max = s;
             }

             if (FacesMessage.SEVERITY_FATAL.equals(max)) {
                 break;
View Full Code Here

      }
   }

   public Severity getMaximumSeverity() {
      checkReleased();
      Severity max = null;
      Iterator<FacesMessage> messages = getMessages();
      while (messages.hasNext()) {
         FacesMessage msg = (FacesMessage) messages.next();
         Severity severity = msg.getSeverity();
         if ((null == max) || (max.getOrdinal() < severity.getOrdinal())) {
            max = severity;
         }
      }
      return max;
   }
View Full Code Here

TOP

Related Classes of javax.faces.application.FacesMessage.Severity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.