Java Code Examples for javax.faces.application.FacesMessage#SEVERITY_INFO

The following examples show how to use javax.faces.application.FacesMessage#SEVERITY_INFO . 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: GeneralBean.java    From sailfish-core with Apache License 2.0 6 votes vote down vote up
public void showGrowlMessage() {
	String severityRaw = BeanUtil.getRequestParam("Severity");
	String summary = BeanUtil.getRequestParam("Summary");
	String detail = BeanUtil.getRequestParam("Detail");

       Severity severity;

       if("WARN".equals(severityRaw)) {
		severity = FacesMessage.SEVERITY_WARN;
       } else if("ERROR".equals(severityRaw)) {
		severity = FacesMessage.SEVERITY_ERROR;
	} else {
		severity = FacesMessage.SEVERITY_INFO;
	}

	BeanUtil.showMessage(severity, summary, detail);
}
 
Example 2
Source File: EditTaskAction.java    From javaee8-jsf-sample with GNU General Public License v3.0 5 votes vote down vote up
public String save() {
    LOG.log(Level.INFO, "saving task@{0}", task);
    if (this.task.getId() == null) {
        this.task = taskService.save(task);
    } else {
        this.task = taskService.update(taskId, task);
    }
    FacesMessage info = new FacesMessage(FacesMessage.SEVERITY_INFO, "Task is saved successfully!", "Task is saved successfully!");
    FacesContext.getCurrentInstance().addMessage(null, info);

    return "/tasks.xhtml?faces-redirect=true";
}
 
Example 3
Source File: ModelTemplateController.java    From ipst with Mozilla Public License 2.0 5 votes vote down vote up
public String deleteMT() {
    log.log(Level.INFO, "delete MT");
    FacesContext context = FacesContext.getCurrentInstance();
    ResourceBundle bundle = context.getApplication().getResourceBundle(context, "msg");

    try {
        ModelTemplateContainer modelTemplateContainer = pmanager.findModelTemplateContainer(this.currentddbid);
        List<ModelTemplate> modelTemplates = modelTemplateContainer.getModelTemplates();
        for (ModelTemplate mt : modelTemplates) {
            if (mt.getId().compareTo(currentId) == 0) {
                this.modelTemplate = mt;
            }
        }

        modelTemplates.remove(this.modelTemplate);
        log.log(Level.INFO, "deleteMT:  ModelTemplatesList  after remove  "    + modelTemplates.contains(this.modelTemplate));
        modelTemplateContainer.setModelTemplates(modelTemplates);
        modelTemplateContainer = pmanager.save(modelTemplateContainer);
        FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, this.modelTemplate.getComment() + " " + bundle.getString("delete.operation.msg"), bundle.getString("success.msg"));
        FacesContext.getCurrentInstance().addMessage(null, msg);
        return "../modelTemplateContainer/list.jsf";

    } catch (Exception ex) {
        String errorMessage = getRootErrorMessage(ex);
        log.log(Level.WARNING, "Error  " + errorMessage);
        FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR,    errorMessage, bundle.getString("delete.failure.msg"));
        facesContext.addMessage(null, m);
        return "edit";

    }
}
 
Example 4
Source File: ParametersController.java    From ipst with Mozilla Public License 2.0 5 votes vote down vote up
public String delete() {
    log.log(Level.INFO, "Delete: [ parametersId: " + this.parameters.getId() + " " + "defParamSetNum: " + this.parameters.getDefParamSetNum() + "]");
    FacesContext context = FacesContext.getCurrentInstance();
    ResourceBundle bundle = context.getApplication().getResourceBundle(context, "msg");
    try {
        ParametersContainer paramitersContainer = pmanager.findParametersContainer(this.currentddbid);
        List<Parameters> parametersList = paramitersContainer.getParameters();
        ArrayList<Parameters> parametersUpdated = new ArrayList<Parameters>();
        for (Parameters ps : parametersList) {
            if (ps.getId().compareTo(this.parameters.getId()) == 0) {
                this.parameters = ps;
            } else {
                parametersUpdated.add(ps);
            }
        }

        paramitersContainer.setParameters(parametersUpdated);
        paramitersContainer = pmanager.save(paramitersContainer);

        FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO,  "Parameters  " + bundle.getString("delete.operation.msg"), bundle.getString("delete.success.msg"));
        FacesContext.getCurrentInstance().addMessage(null, msg);
        return "../parametersContainer/list.jsf";

    } catch (Exception ex) {
        String errorMessage = getRootErrorMessage(ex);
        log.log(Level.WARNING, "Error  " + errorMessage);
        FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, bundle.getString("delete.failure.msg"));
        facesContext.addMessage(null, m);
        return "edit";

    }
}
 
Example 5
Source File: EquipmentController.java    From ipst with Mozilla Public License 2.0 5 votes vote down vote up
public void onTransfer(TransferEvent event) {
    log.log(Level.INFO, "onTransfer:: enter");
    FacesContext context = FacesContext.getCurrentInstance();
    ResourceBundle bundle = context.getApplication().getResourceBundle(context, "msg");
    StringBuilder builder = new StringBuilder();
    for (Object item : event.getItems()) {
        builder.append((String) item).append("<br />");
    }
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, bundle.getString("connection.operation.transf.msg"), bundle.getString("connection.success.msg"));
    FacesContext.getCurrentInstance().addMessage(null, msg);
}
 
Example 6
Source File: DialogFrameworkManagedBean.java    From journaldev with MIT License 5 votes vote down vote up
public void onEmployeeChosen(SelectEvent event){
	Employee employee = (Employee) event.getObject();
       FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, 
       		"Employee Selected", 
       		"Id:" + employee.getEmployeeId()+"\n"+
       		"Name:"+employee.getEmployeeName());
       FacesContext.getCurrentInstance().addMessage(null, message);
}
 
Example 7
Source File: UserController.java    From primefaces-blueprints with The Unlicense 5 votes vote down vote up
public void submit(ActionEvent event) {
    ds.addOrUpdateEntity(user);
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "User Successfully added...", "User Successfully added...");
    FacesContext.getCurrentInstance().addMessage(null, msg);
    _log.info("Done ....");
    prepareAddNewUser();

}
 
Example 8
Source File: FormLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
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: EditTaskAction.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
public String save() {
	log.debug("saving task@" + task);
	this.task = taskRepository.save(task);
	FacesMessage info= new FacesMessage(FacesMessage.SEVERITY_INFO, "Task is saved successfully!",   "Task is saved successfully!");
	FacesContext.getCurrentInstance().addMessage(null, info);
	
	return "/tasks.xhtml?faces-redirect=true";
}
 
Example 10
Source File: EditTaskAction.java    From ee7-sandbox with Apache License 2.0 5 votes vote down vote up
public String save() {
    log.log(Level.INFO, "saving task@{0}", task);
    if (this.task.getId() == null) {
        this.task = taskRepository.save(task);
    } else {
        this.task = taskRepository.update(task);
    }
    FacesMessage info = new FacesMessage(FacesMessage.SEVERITY_INFO, "Task is saved successfully!", "Task is saved successfully!");
    FacesContext.getCurrentInstance().addMessage(null, info);

    return "/tasks.xhtml?faces-redirect=true";
}
 
Example 11
Source File: FormLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeErrorMessage(FacesContext context, ResponseWriter w, FormLayout c, FacesMessage.Severity sev, String text) throws IOException {
    if(sev==FacesMessage.SEVERITY_ERROR) {
        writeErrorMessage(context, w, c, text);
    } else if(sev==FacesMessage.SEVERITY_WARN) {
        writeWarnMessage(context, w, c, text);
    } else if(sev==FacesMessage.SEVERITY_INFO) {
        writeInfoMessage(context, w, c, text);
    } else if(sev == FacesMessage.SEVERITY_FATAL){
        writeFatalMessage(context, w, c, text);
    }
}
 
Example 12
Source File: GenericController.java    From primefaces-blueprints with The Unlicense 4 votes vote down vote up
public void onSelect(SelectEvent event) {
    TagCloudItem item = (TagCloudItem) event.getObject();
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Item Selected", item.getLabel());
    FacesContext.getCurrentInstance().addMessage(null, msg);
}
 
Example 13
Source File: ServiceCenterController.java    From primefaces-blueprints with The Unlicense 4 votes vote down vote up
public void onRowReorder(ReorderEvent event){
	 FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Row Moved", "From: " + event.getFromIndex() + ", To:" + event.getToIndex());
        FacesContext.getCurrentInstance().addMessage(null, msg);
}
 
Example 14
Source File: ScheduleController.java    From primefaces-blueprints with The Unlicense 4 votes vote down vote up
public void onEventResize(ScheduleEntryResizeEvent event) {
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event resized", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());

    addMessage(message);
}
 
Example 15
Source File: ScheduleController.java    From primefaces-blueprints with The Unlicense 4 votes vote down vote up
public void onEventMove(ScheduleEntryMoveEvent event) {
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event moved", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());

    addMessage(message);
}
 
Example 16
Source File: FacesMessages.java    From BootsFaces-OSP with Apache License 2.0 4 votes vote down vote up
public static void info(String refItem, String summary, String detail) {
	FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
	reportMessage(refItem, facesMsg);
}
 
Example 17
Source File: ResponseHandler.java    From development with Apache License 2.0 4 votes vote down vote up
static FacesMessage.Severity mapToFaces(ReturnType type) {
    if (type == ReturnType.WARNING) {
        return FacesMessage.SEVERITY_WARN;
    }
    return FacesMessage.SEVERITY_INFO;
}
 
Example 18
Source File: JsfUtil.java    From tomee with Apache License 2.0 4 votes vote down vote up
public static void addSuccessMessage(final String msg) {
    final FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
    FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg);
}
 
Example 19
Source File: ModelTemplateController.java    From ipst with Mozilla Public License 2.0 4 votes vote down vote up
public void updloadData() {
    FacesContext context = FacesContext.getCurrentInstance();
    ResourceBundle bundle = context.getApplication().getResourceBundle(context, "msg");
    log.log(Level.INFO,    " enter uploadData for  MT_id:" + this.getCurrentId()    + " MTC_id:" + this.getCurrentddbid());
    try {
        if (this.dataName != null && !this.dataName.equals("")    && this.dataFile != null) {
            ModelTemplateContainer modelTemplateContainer = pmanager.findModelTemplateContainer(this.currentddbid);
            List<ModelTemplate> modelTemplates = modelTemplateContainer.getModelTemplates();
            for (ModelTemplate mt : modelTemplates) {
                if (mt.getId().compareTo(currentId) == 0) {
                    this.modelTemplate = mt;
                }

            }

            Map<String, ModelData> mapData = this.modelTemplate.modelDataMap();
            mapData.put(dataName, new ModelData(dataFile.getContents()));
            List<ModelTemplate> modelTemplateUpdated = updateModelTemplatesData(mapData, modelTemplates);
            modelTemplateContainer.setModelTemplates(modelTemplateUpdated);
            modelTemplateContainer = pmanager.save(modelTemplateContainer);

            log.log(Level.INFO,    " ModelTemplateContainer save  " + dataFile.getFileName());
            Set<String> mapKey = mapData.keySet();
            this.keyList = new ArrayList<String>();
            keyList.addAll(mapKey);
            FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, dataFile.getFileName() + " " + bundle.getString("upload.operation.msg"), bundle.getString("success.msg"));
            FacesContext.getCurrentInstance().addMessage(null, msg);
            this.dataName = "";
        } else {
            if (this.dataName.equals("") && this.dataFile != null) {
                throw new Exception("Data can't be empty");
            }
        }
    } catch (Exception ex) {
        log.log(Level.WARNING, "Error :" + ex.getMessage());
        String errorMessage = getRootErrorMessage(ex);
        FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR,    errorMessage, bundle.getString("upload.failure.msg"));
        facesContext.addMessage(null, m);
        ex.printStackTrace();
    }
}
 
Example 20
Source File: ModelTemplateContainerController.java    From ipst with Mozilla Public License 2.0 4 votes vote down vote up
public void onRowToggle(ToggleEvent event) {
    log.log(Level.INFO, ":: onRowToggle enter");
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Row State " + event.getVisibility(), "Model Template :" + ((ModelTemplate) event.getData()).getId());
    FacesContext.getCurrentInstance().addMessage(null, msg);
}