Package javax.faces.application.FacesMessage

Examples of javax.faces.application.FacesMessage.Severity


         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) );
         }
         final String viewId = redirect.attributeValue("view-id");
         final String url    = redirect.attributeValue("url");

         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) );
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

        return Lists.newArrayList(filteredMessages);
    }

    private Predicate<MessageForRender> getMessagesLevelFilter(FacesContext context, UIComponent component) {

        final Severity level = getLevel(component);
        final boolean displayAll = isComponentMessages(component);
        final boolean redisplay = Boolean.TRUE.equals(component.getAttributes().get("redisplay"));
        Predicate<MessageForRender> predicate = new Predicate<MessageForRender>() {
            private int count = 0;
View Full Code Here

        return predicate;
    }

    protected Severity getLevel(UIComponent component) {
        Object levelName = component.getAttributes().get("level");
        final Severity level = (Severity) (FacesMessage.VALUES_MAP.containsKey(levelName) ? FacesMessage.VALUES_MAP
                .get(levelName) : FacesMessage.SEVERITY_INFO);
        return level;
    }
View Full Code Here

            UIComponent target = rendererUtils.findComponentFor(component, forId);
            if (null != target) {
                parametersBuilder.put("forComponentId", target.getClientId(facesContext));
            }
        }
        Severity level = getLevel(component);
        if (FacesMessage.SEVERITY_INFO != level) {
            parametersBuilder.put("level", level.getOrdinal());
        }
        if (!rendererUtils.isBooleanAttribute(component, "showSummary")) {
            parametersBuilder.put("showSummary", false);
        }
        if (rendererUtils.isBooleanAttribute(component, "showDetail")) {
View Full Code Here

            UIComponent target = rendererUtils.findComponentFor(component, forId);
            if (null != target) {
                parametersBuilder.put("forComponentId", target.getClientId(facesContext));
            }
        }
        Severity level = getLevel(component);
        if (FacesMessage.SEVERITY_INFO != level) {
            parametersBuilder.put("level", level.getOrdinal());
        }
        if (!rendererUtils.isBooleanAttribute(component, "showSummary")) {
            parametersBuilder.put("showSummary", false);
        }
        if (rendererUtils.isBooleanAttribute(component, "showDetail")) {
View Full Code Here

        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";

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

    }
     
    mortalidade.setLotes(getEntity());
    mortalidadeBean.setAction(action);
    mortalidadeBean.save(mortalidade, Action.INSERT);
    Severity severityLevel = FacesUtil.getFacesContext().getMaximumSeverity();
      boolean notHasError = (severityLevel == null || (severityLevel != null && !severityLevel.equals(FacesMessage.SEVERITY_ERROR)));
      if(notHasError){
      mortalidade = new Historicomortalidade();
        this.alteracaoMortalidade= false;
      }
    }
View Full Code Here

    public void saveAndClean() {
      boolean isEdit =isActionEdit();
      super.saveAndClean();
     
      // na edição, ao salvar os dados, o usuário é redirecionado para a pagina de pesquisa
      Severity severityLevel = FacesUtil.getFacesContext().getMaximumSeverity();
      boolean notHasError = (severityLevel == null || (severityLevel != null && !severityLevel.equals(FacesMessage.SEVERITY_ERROR)));
      if(isEdit && notHasError)
        loadSearchMode();
    }
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

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.