Package javax.faces.application.FacesMessage

Examples of javax.faces.application.FacesMessage.Severity


            detail = fm.getDetail();
            severityOrdinal = fm.getSeverity().getOrdinal();
        }

        FacesMessage toFacesMessage() {
            Severity severity = null;
            for (Object o : FacesMessage.VALUES) {
                severity = (Severity) o;
                if (severity.getOrdinal() == severityOrdinal) {
                    break;
                }
            }
            return new FacesMessage(severity, summary, detail);
        }
View Full Code Here


//    AjaxContext ac = AjaxContext.getCurrentInstance(FacesContext.getCurrentInstance());
    // https://jira.jboss.org/jira/browse/RF-8432
//    if(ac.isAjaxRequest() && !this.isAjaxRendered()){
//      return false;
//    }
    Severity severity = message.getSeverity();
    for (Object key : FacesMessage.VALUES_MAP.keySet()) {
      Severity sev = (Severity) FacesMessage.VALUES_MAP.get(key);
      if (0 == sev.compareTo(severity)) {
        return severenities.contains(((String)key).toUpperCase(Locale.ENGLISH));
      }
    }
    return false;
  }
View Full Code Here

     
      if (in.readBoolean()) {
        clientId = in.readUTF();
      }

      Severity severity = FacesMessage.SEVERITY_INFO;
      int ordinal = in.readInt();
      if (ordinal >= 0 && ordinal < FacesMessage.VALUES.size()) {
        severity = (Severity) FacesMessage.VALUES.get(ordinal);
      }
     
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

    writer.startElement("span", message);
    writer.writeAttribute("id", message.getClientId(facesContext), null);
   
    if(msg != null) {
      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";
       
      writer.writeAttribute("class", "pf-message-" + severityKey, null);
     
      if(message.isShowSummary())
        encodeMessageText(writer, msg.getSummary(), severityKey + "-summary");
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

     * Test method for {@link org.jboss.portletbridge.context.FacesContextImpl#getMaximumSeverity()}.
     */
    public void testGetMaximumSeverity() {
   assertNull(portalFacesContext.getMaximumSeverity());
   portalFacesContext.addMessage(ID0, new FacesMessage());
   Severity maximumSeverity = portalFacesContext.getMaximumSeverity();
   assertEquals(0,maximumSeverity.compareTo(FacesMessage.SEVERITY_INFO));
   portalFacesContext.addMessage("_id1", new FacesMessage(FacesMessage.SEVERITY_ERROR,"error","error detail"));
   maximumSeverity = portalFacesContext.getMaximumSeverity();
   assertEquals(0,maximumSeverity.compareTo(FacesMessage.SEVERITY_ERROR));
    }
View Full Code Here

      {
         final 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(Expressions.instance().createValueExpression(viewId, String.class), clazz, endConversation, message, severity);
      }
     
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(viewId == null ? null :
            Expressions.instance().createValueExpression(viewId, String.class), 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) );
         }
         final String viewId = redirect.attributeValue("view-id");
         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(viewId == null ? null :
            Expressions.instance().createValueExpression(viewId, String.class), params, message, severity, control) );
      }
View Full Code Here

         severityOrdinal = fm.getSeverity().getOrdinal();
      }
     
      FacesMessage toFacesMessage()
      {
         Severity severity = null;
         for (Object o : FacesMessage.VALUES)
         {
            severity = (Severity) o;
            if (severity.getOrdinal() == severityOrdinal)
            {
               break;
            }
         }
         return new FacesMessage(severity, summary, detail );
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.