當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。