Java Code Examples for javax.faces.application.FacesMessage#setSummary()
The following examples show how to use
javax.faces.application.FacesMessage#setSummary() .
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: JSFUtils.java From development with Apache License 2.0 | 6 votes |
public static boolean replaceMessageInListIfExisting(String oldKey, Object[] oldParams, String newKey, Object[] newParams) { FacesContext fc = FacesContext.getCurrentInstance(); String oldText = JSFUtils.getText(oldKey, oldParams); String newText = JSFUtils.getText(newKey, newParams); for (Iterator<FacesMessage> i = fc.getMessages(); i.hasNext();) { FacesMessage fm = i.next(); if (fm.getDetail().equals(oldText)) { fm.setDetail(newText); fm.setSummary(newText); return true; } } return false; }
Example 2
Source File: CustomExceptionHandler.java From admin-template with MIT License | 5 votes |
private void addFacesMessage(BusinessException be) { FacesMessage facesMessage = new FacesMessage(); if (has(be.getSummary())) { facesMessage.setSummary(be.getSummary()); } if (has(be.getDetail())) { facesMessage.setDetail(be.getDetail()); } if (has(be.getSeverity())) { facesMessage.setSeverity(be.getSeverity()); } else { facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR); } Messages.add(be.getFieldId(), facesMessage); }
Example 3
Source File: DashboardManagedBean.java From journaldev with MIT License | 5 votes |
public void handleReorder(DashboardReorderEvent event) { FacesMessage message = new FacesMessage(); message.setSeverity(FacesMessage.SEVERITY_INFO); message.setSummary("Reordered: " + event.getWidgetId()); message.setDetail("Item index: " + event.getItemIndex()+ ", Column index: " + event.getColumnIndex() + ", Sender index: " + event.getSenderColumnIndex()); addMessage(message); }
Example 4
Source File: ManageLanguageCtrlTest.java From development with Apache License 2.0 | 5 votes |
/** * @param contextStub */ @SuppressWarnings("unused") private void givenJSFUtilsMessage(FacesContextStub contextStub, String key, String value, Object[] params) { setResourceBundle(contextStub, key, value); FacesMessage firstFM = new FacesMessage(FacesMessage.SEVERITY_WARN, value, null); firstFM.setDetail(value); firstFM.setSummary(value); contextStub.addMessage(null, firstFM); }
Example 5
Source File: SectionTitleValidator.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void validate(FacesContext context, UIComponent toValidate, Object value) throws ValidatorException { String str = (String) value; if (str.trim().length() < 1) { ((UIInput) toValidate).setValid(false); FacesMessage message = new FacesMessage(); String messageText = JsfUtil.getLocalizedMessage("sectionTitle.validator.stringWithSpaceOnly"); message.setDetail(messageText); message.setSummary(messageText); message.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(message); } }
Example 6
Source File: AnswerBean.java From sakai with Educational Community License v2.0 | 5 votes |
public void validatePartialCredit(FacesContext context, UIComponent toValidate,Object value){ Integer pCredit = null; boolean isValid = true; if ("0.0".equals(value.toString())) { pCredit = 0; } else { try { pCredit = Integer.parseInt(value.toString()); } catch (NumberFormatException e) { isValid = false; } } if(isValid && (pCredit==null || pCredit<0 || pCredit>99 )){ isValid = false; } if (!isValid) { ((UIInput)toValidate).setValid(false); FacesMessage message=new FacesMessage(); message.setSeverity(FacesMessage.SEVERITY_ERROR); String summary=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","partial_credit_limit_summary"); String detail =ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","partial_credit_limit_detail"); message.setSummary(summary) ; message.setDetail(detail); context.addMessage(toValidate.getClientId(context), message); } }
Example 7
Source File: EmptyStringValidator.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Throw exception if there is only space(s) character as input. */ public void validate(FacesContext context, UIComponent toValidate, Object value) throws ValidatorException { String str = (String) value; if (str.trim().length() < 1) { ((UIInput) toValidate).setValid(false); FacesMessage message = new FacesMessage(); message.setDetail(Utilities.rb.getString("signup.validator.stringWithSpaceOnly")); message.setSummary(Utilities.rb.getString("signup.validator.stringWithSpaceOnly")); message.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(message); } }
Example 8
Source File: DashboardController.java From primefaces-blueprints with The Unlicense | 5 votes |
public void handleReorder(DashboardReorderEvent event) { FacesMessage message = new FacesMessage(); message.setSeverity(FacesMessage.SEVERITY_INFO); message.setSummary("Reordered: " + event.getWidgetId()); message.setDetail("Item index: " + event.getItemIndex() + ", Column index: " + event.getColumnIndex() + ", Sender index: " + event.getSenderColumnIndex()); addMessage(message); }
Example 9
Source File: SectionTitleValidator.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void validate(FacesContext context, UIComponent toValidate, Object value) throws ValidatorException { String str = (String) value; if (str.trim().length() < 1) { ((UIInput) toValidate).setValid(false); FacesMessage message = new FacesMessage(); String messageText = JsfUtil.getLocalizedMessage("sectionTitle.validator.stringWithSpaceOnly"); message.setDetail(messageText); message.setSummary(messageText); message.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(message); } }
Example 10
Source File: AnswerBean.java From sakai with Educational Community License v2.0 | 5 votes |
public void validatePartialCredit(FacesContext context, UIComponent toValidate,Object value){ Integer pCredit = null; boolean isValid = true; if ("0.0".equals(value.toString())) { pCredit = 0; } else { try { pCredit = Integer.parseInt(value.toString()); } catch (NumberFormatException e) { isValid = false; } } if(isValid && (pCredit==null || pCredit<0 || pCredit>99 )){ isValid = false; } if (!isValid) { ((UIInput)toValidate).setValid(false); FacesMessage message=new FacesMessage(); message.setSeverity(FacesMessage.SEVERITY_ERROR); String summary=ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","partial_credit_limit_summary"); String detail =ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages","partial_credit_limit_detail"); message.setSummary(summary) ; message.setDetail(detail); context.addMessage(toValidate.getClientId(context), message); } }
Example 11
Source File: EmptyStringValidator.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Throw exception if there is only space(s) character as input. */ public void validate(FacesContext context, UIComponent toValidate, Object value) throws ValidatorException { String str = (String) value; if (str.trim().length() < 1) { ((UIInput) toValidate).setValid(false); FacesMessage message = new FacesMessage(); message.setDetail(Utilities.rb.getString("signup.validator.stringWithSpaceOnly")); message.setSummary(Utilities.rb.getString("signup.validator.stringWithSpaceOnly")); message.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(message); } }