当前位置: 首页>>代码示例>>Java>>正文


Java FacesMessage.setSeverity方法代码示例

本文整理汇总了Java中javax.faces.application.FacesMessage.setSeverity方法的典型用法代码示例。如果您正苦于以下问题:Java FacesMessage.setSeverity方法的具体用法?Java FacesMessage.setSeverity怎么用?Java FacesMessage.setSeverity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.application.FacesMessage的用法示例。


在下文中一共展示了FacesMessage.setSeverity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTrackById

import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
public void onTrackById() {
    Cargo cargo = cargoRepository.find(new TrackingId(trackingId));

    if (cargo != null) {
        List<HandlingEvent> handlingEvents = handlingEventRepository
                .lookupHandlingHistoryOfCargo(new TrackingId(trackingId))
                .getDistinctEventsByCompletionTime();
        this.cargo = new CargoTrackingViewAdapter(cargo, handlingEvents);
    } else {
        // TODO See if this can be injected.
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage message = new FacesMessage(
                "Cargo with tracking ID: " + trackingId + " not found.");
        message.setSeverity(FacesMessage.SEVERITY_ERROR);
        context.addMessage(null, message);
        this.cargo = null;
    }
}
 
开发者ID:RETIT,项目名称:continuous-performance-evaluation,代码行数:19,代码来源:Track.java

示例2: register

import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
public String register() {
    String trackingId = null;

    try {
        if (!originUnlocode.equals(destinationUnlocode)) {
            trackingId = bookingServiceFacade.bookNewCargo(
                    originUnlocode,
                    destinationUnlocode,
                    new SimpleDateFormat(FORMAT).parse(arrivalDeadline));
        } else {
            // TODO See if this can be injected.
            FacesContext context = FacesContext.getCurrentInstance();
            FacesMessage message = new FacesMessage(
                    "Origin and destination cannot be the same.");
            message.setSeverity(FacesMessage.SEVERITY_ERROR);
            context.addMessage(null, message);
            return null;
        }
    } catch (ParseException e) {
        throw new RuntimeException("Error parsing date", e);
    }

    return "show.xhtml?faces-redirect=true&trackingId=" + trackingId;
}
 
开发者ID:RETIT,项目名称:continuous-performance-evaluation,代码行数:25,代码来源:Registration.java

示例3: addDetailMessage

import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
public static void addDetailMessage(String message, FacesMessage.Severity severity) {

        FacesMessage facesMessage = new FacesMessage("", message);
        if (severity != null && severity != FacesMessage.SEVERITY_INFO) {
            facesMessage.setSeverity(severity);
        }

        FacesContext.getCurrentInstance().addMessage(null, facesMessage);
    }
 
开发者ID:adminfaces,项目名称:admin-persistence,代码行数:10,代码来源:Messages.java

示例4: adicionarMensagem

import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
public void adicionarMensagem(String mensagem, Severity tipoMensagem) {
	FacesContext fc = FacesContext.getCurrentInstance();
	FacesMessage fm = new FacesMessage(mensagem);
	fm.setSeverity(tipoMensagem);
	fc.addMessage(null, fm);

}
 
开发者ID:IsadoraScusselFarias,项目名称:ProjetoFinalInitium,代码行数:8,代码来源:CriterioBean.java

示例5: addFacesMessage

import javax.faces.application.FacesMessage; //导入方法依赖的package包/类
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);
}
 
开发者ID:adminfaces,项目名称:admin-template,代码行数:16,代码来源:CustomExceptionHandler.java


注:本文中的javax.faces.application.FacesMessage.setSeverity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。