Java Code Examples for javax.faces.application.FacesMessage#getSeverity()
The following examples show how to use
javax.faces.application.FacesMessage#getSeverity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageRenderer.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
private String findHighestSeverityClass(List<FacesMessage> messageList, Message message) { boolean hasFatal = false; boolean hasError = false; boolean hasWarning = false; for (FacesMessage msg : messageList) { Severity severity = msg.getSeverity(); if (msg.isRendered() && !message.isRedisplay()) { continue; } if (severity.equals(FacesMessage.SEVERITY_WARN)) hasWarning = true; else if (severity.equals(FacesMessage.SEVERITY_ERROR)) hasError = true; else if (severity.equals(FacesMessage.SEVERITY_FATAL)) hasFatal = true; } if (hasFatal) return ("alert-danger " + (message.getFatalClass() == null ? "" : message.getFatalClass())); if (hasError) return ("alert-danger " + (message.getErrorClass() == null ? "" : message.getErrorClass())); if (hasWarning) return ("alert-warning " + (message.getWarnClass() == null ? "" : message.getWarnClass())); return ("alert-info " + (message.getInfoClass() == null ? "" : message.getInfoClass())); }
Example 2
Source File: MessageRenderer.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
private String findHighestSeverityStyle(List<FacesMessage> messageList, Message message) { boolean hasFatal = false; boolean hasError = false; boolean hasWarning = false; for (FacesMessage msg : messageList) { Severity severity = msg.getSeverity(); if (msg.isRendered() && !message.isRedisplay()) { continue; } if (severity.equals(FacesMessage.SEVERITY_WARN)) hasWarning = true; else if (severity.equals(FacesMessage.SEVERITY_ERROR)) hasError = true; else if (severity.equals(FacesMessage.SEVERITY_FATAL)) hasFatal = true; } if (hasFatal) return message.getFatalStyle(); if (hasError) return message.getErrorStyle(); if (hasWarning) return message.getWarnStyle(); return message.getInfoStyle(); }
Example 3
Source File: MessageRenderer.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
private String findHighestSeverityIcon(List<FacesMessage> messageList, Message message) { boolean hasFatal = false; boolean hasError = false; boolean hasWarning = false; for (FacesMessage msg : messageList) { Severity severity = msg.getSeverity(); if (msg.isRendered() && !message.isRedisplay()) { continue; } if (severity.equals(FacesMessage.SEVERITY_WARN)) hasWarning = true; else if (severity.equals(FacesMessage.SEVERITY_ERROR)) hasError = true; else if (severity.equals(FacesMessage.SEVERITY_FATAL)) hasFatal = true; } if (hasFatal) return "bficon bficon-error-circle-o";// "fa fa-exclamation-circle"; if (hasError) return "bficon bficon-error-circle-o";// "fa fa-exclamation-circle"; if (hasWarning) return "bficon bficon-warning-triangle-o";// "fa // fa-exclamation-triangle"; return "bficon bficon-info";// "fa fa-info-circle"; }
Example 4
Source File: JSFUtils.java From development with Apache License 2.0 | 5 votes |
public static boolean hasErrors(FacesContext fc) { for (Iterator<FacesMessage> i = fc.getMessages(); i.hasNext();) { FacesMessage m = i.next(); if (FacesMessage.SEVERITY_ERROR == m.getSeverity()) { return true; } } return false; }
Example 5
Source File: JSFUtils.java From development with Apache License 2.0 | 5 votes |
public static boolean hasWarnings(FacesContext fc) { for (Iterator<FacesMessage> i = fc.getMessages(); i.hasNext();) { FacesMessage m = i.next(); if (FacesMessage.SEVERITY_WARN == m.getSeverity()) { return true; } } return false; }
Example 6
Source File: DivMessageRendererBase.java From sakai with Educational Community License v2.0 | 5 votes |
public String getMessageStyle(UIComponent component, FacesMessage message) { String messageStyle = (String)component.getAttributes().get("style"); FacesMessage.Severity severity = message.getSeverity(); if (severity != null) { String severitySpecific = (String)component.getAttributes().get((String)severityToStyleAttr.get(severity)); if ((severitySpecific != null) && (severitySpecific.length() > 0)) { messageStyle = severitySpecific; } } return messageStyle; }
Example 7
Source File: DivMessageRendererBase.java From sakai with Educational Community License v2.0 | 5 votes |
public String getMessageClass(UIComponent component, FacesMessage message) { String messageClass = (String)component.getAttributes().get("styleClass"); FacesMessage.Severity severity = message.getSeverity(); if (severity != null) { String severitySpecific = (String)component.getAttributes().get((String)severityToClassAttr.get(severity)); if ((severitySpecific != null) && (severitySpecific.length() > 0)) { messageClass = severitySpecific; } } return messageClass; }
Example 8
Source File: FormLayoutRenderer.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
protected void writeErrorSummaryContent(FacesContext context, ResponseWriter w, FormLayout c, Iterator<FacesMessage> msg) throws IOException { boolean fatal = false; boolean err = false; boolean warn = false; boolean info = false; List<FacesMessage> l = new ArrayList<FacesMessage>(); while(msg.hasNext()) { FacesMessage m = msg.next(); l.add(m); if(m.getSeverity()==FacesMessage.SEVERITY_ERROR) { err = true; } else if(m.getSeverity()==FacesMessage.SEVERITY_WARN) { warn = true; } else if(m.getSeverity()==FacesMessage.SEVERITY_INFO) { info = true; } else if(m.getSeverity()==FacesMessage.SEVERITY_FATAL) { fatal = true; } } if( fatal ){ writeErrorSummaryMainText(context, w, c, FacesMessage.SEVERITY_FATAL); writeErrorSummaryRows(context, w, c, new MsgIterator(l, FacesMessage.SEVERITY_FATAL)); } if(err) { writeErrorSummaryMainText(context, w, c, FacesMessage.SEVERITY_ERROR); writeErrorSummaryRows(context, w, c, new MsgIterator(l, FacesMessage.SEVERITY_ERROR)); } if(warn) { writeErrorSummaryMainText(context, w, c, FacesMessage.SEVERITY_WARN); writeErrorSummaryRows(context, w, c, new MsgIterator(l, FacesMessage.SEVERITY_WARN)); } if(info) { writeErrorSummaryMainText(context, w, c, FacesMessage.SEVERITY_INFO); writeErrorSummaryRows(context, w, c, new MsgIterator(l, FacesMessage.SEVERITY_INFO)); } }
Example 9
Source File: DivMessageRendererBase.java From sakai with Educational Community License v2.0 | 5 votes |
public String getMessageStyle(UIComponent component, FacesMessage message) { String messageStyle = (String)component.getAttributes().get("style"); FacesMessage.Severity severity = message.getSeverity(); if (severity != null) { String severitySpecific = (String)component.getAttributes().get((String)severityToStyleAttr.get(severity)); if ((severitySpecific != null) && (severitySpecific.length() > 0)) { messageStyle = severitySpecific; } } return messageStyle; }
Example 10
Source File: DivMessageRendererBase.java From sakai with Educational Community License v2.0 | 5 votes |
public String getMessageClass(UIComponent component, FacesMessage message) { String messageClass = (String)component.getAttributes().get("styleClass"); FacesMessage.Severity severity = message.getSeverity(); if (severity != null) { String severitySpecific = (String)component.getAttributes().get((String)severityToClassAttr.get(severity)); if ((severitySpecific != null) && (severitySpecific.length() > 0)) { messageClass = severitySpecific; } } return messageClass; }
Example 11
Source File: FormLayoutRenderer.java From XPagesExtensionLibrary with Apache License 2.0 | 4 votes |
@Override protected boolean accept(Object object) { FacesMessage m = (FacesMessage)object; return m.getSeverity()==s; }