public static String getErrorSeverityClass ( String clientId ) { String [ ] levels = { "bf-no-message has-success" , "bf-info" , "bf-warning has-warning" , "bf-error has-error" , "bf-fatal has-error" } ; int level = 0 ; Iterator < FacesMessage > messages = FacesContext . getCurrentInstance ( ) . getMessages ( clientId ) ; if ( null != messages ) { if ( ! messages . hasNext ( ) ) { return "" ; } while ( messages . hasNext ( ) ) { FacesMessage message = messages . next ( ) ; if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_INFO ) ) if ( level < 1 ) level = 1 ; if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_WARN ) ) if ( level < 2 ) level = 2 ; if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_ERROR ) ) if ( level < 3 ) level = 3 ; if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_FATAL ) ) if ( level < 4 ) level = 4 ; } return levels [ level ] ; } return "" ; }
Returns style matching the severity error .