Skip to content

Commit

Permalink
Merge pull request #5490 from eclipse-ee4j/mojarra_issue_5489_support…
Browse files Browse the repository at this point in the history
…_FacesMessage.Severity.SUCCESS

Support new FacesMessage.Severity.SUCCESS in h:message/h:messages
  • Loading branch information
BalusC authored Sep 16, 2024
2 parents ce5d863 + 1ba4c10 commit 3d066f4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,10 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce
// Default to summary if we have no detail
String detail = null != (detail = curMessage.getDetail()) ? detail : summary;

if (curMessage.getSeverity() == FacesMessage.SEVERITY_INFO) {
severityStyle = (String) component.getAttributes().get("infoStyle");
severityStyleClass = (String) component.getAttributes().get("infoClass");
} else if (curMessage.getSeverity() == FacesMessage.SEVERITY_WARN) {
severityStyle = (String) component.getAttributes().get("warnStyle");
severityStyleClass = (String) component.getAttributes().get("warnClass");
} else if (curMessage.getSeverity() == FacesMessage.SEVERITY_ERROR) {
severityStyle = (String) component.getAttributes().get("errorStyle");
severityStyleClass = (String) component.getAttributes().get("errorClass");
} else if (curMessage.getSeverity() == FacesMessage.SEVERITY_FATAL) {
severityStyle = (String) component.getAttributes().get("fatalStyle");
severityStyleClass = (String) component.getAttributes().get("fatalClass");
if (curMessage.getSeverity() != null) {
String severityPrefix = curMessage.getSeverity().name().toLowerCase();
severityStyle = (String) component.getAttributes().get(severityPrefix + "Style");
severityStyleClass = (String) component.getAttributes().get(severityPrefix + "Class");
}

String style = (String) component.getAttributes().get("style");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,10 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce
// Default to summary if we have no detail
String detail = null != (detail = curMessage.getDetail()) ? detail : summary;

if (curMessage.getSeverity() == FacesMessage.SEVERITY_INFO) {
severityStyle = (String) component.getAttributes().get("infoStyle");
severityStyleClass = (String) component.getAttributes().get("infoClass");
} else if (curMessage.getSeverity() == FacesMessage.SEVERITY_WARN) {
severityStyle = (String) component.getAttributes().get("warnStyle");
severityStyleClass = (String) component.getAttributes().get("warnClass");
} else if (curMessage.getSeverity() == FacesMessage.SEVERITY_ERROR) {
severityStyle = (String) component.getAttributes().get("errorStyle");
severityStyleClass = (String) component.getAttributes().get("errorClass");
} else if (curMessage.getSeverity() == FacesMessage.SEVERITY_FATAL) {
severityStyle = (String) component.getAttributes().get("fatalStyle");
severityStyleClass = (String) component.getAttributes().get("fatalClass");
if (curMessage.getSeverity() != null) {
String severityPrefix = curMessage.getSeverity().name().toLowerCase();
severityStyle = (String) component.getAttributes().get(severityPrefix + "Style");
severityStyleClass = (String) component.getAttributes().get(severityPrefix + "Class");
}

// Done intializing local variables. Move on to rendering.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5604,6 +5604,24 @@
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
CSS style class to apply to any message
with a severity class of "SUCCESS".
</description>
<name>successClass</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
CSS style(s) to apply to any message
with a severity class of "SUCCESS".
</description>
<name>successStyle</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
Advisory title information about markup elements generated
Expand Down
20 changes: 20 additions & 0 deletions impl/src/main/resources/com/sun/faces/standard-html-renderkit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5103,6 +5103,26 @@
<attribute-name>infoStyle</attribute-name>
<attribute-class>java.lang.String</attribute-class>
</attribute>
<attribute>
<description>
CSS style class to apply to any message
with a severity class of "SUCCESS".
</description>
<display-name>Success Class</display-name>
<icon/>
<attribute-name>successClass</attribute-name>
<attribute-class>java.lang.String</attribute-class>
</attribute>
<attribute>
<description>
CSS style(s) to apply to any message
with a severity class of "SUCCESS".
</description>
<display-name>Success Styles</display-name>
<icon/>
<attribute-name>successStyle</attribute-name>
<attribute-class>java.lang.String</attribute-class>
</attribute>
<attribute>
<description>
Flag indicating whether the detail portion of the
Expand Down

0 comments on commit 3d066f4

Please sign in to comment.