You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/09/04 10:28:35 UTC

svn commit: r1701174 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/ tobago-theme/tobago-theme-st...

Author: lofwyr
Date: Fri Sep  4 08:28:34 2015
New Revision: 1701174

URL: http://svn.apache.org/r1701174
Log:
TOBAGO-1486: Message should be closeable.

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/BootstrapClass.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1701174&r1=1701173&r2=1701174&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java Fri Sep  4 08:28:34 2015
@@ -84,6 +84,8 @@ public final class DataAttributes {
    */
   public static final String DISABLED = "data-tobago-disabled";
 
+  public static final String DISMISS = "data-dismiss";
+
   /**
    * Custom form attribute. Used to show the virtual form of the component.
    */

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java?rev=1701174&r1=1701173&r2=1701174&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java Fri Sep  4 08:28:34 2015
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.render
 
 public enum HtmlRoleValues {
 
+  ALERT("alert"),
   DIALOG("dialog"),
   DOCUMENT("document"),
   MENU("menu"),

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/BootstrapClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/BootstrapClass.java?rev=1701174&r1=1701173&r2=1701174&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/BootstrapClass.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/BootstrapClass.java Fri Sep  4 08:28:34 2015
@@ -36,9 +36,11 @@ public enum BootstrapClass implements Cs
   ALERT_DANGER("alert-danger"),
   ALERT_WARNING("alert-warning"),
   ALERT_INFO("alert-info"),
+  ALERT_DISMISSIBLE("alert-dismissible"),
   BTN("btn"),
   BTN_DEFAULT("btn-default"),
   CHECKBOX("checkbox"),
+  CLOSE("close"),
   COLLAPSE("collapse"),
   COLLAPSED("collapsed"),
   CONTAINER("container"),

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java?rev=1701174&r1=1701173&r2=1701174&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java Fri Sep  4 08:28:34 2015
@@ -38,10 +38,14 @@ import org.apache.myfaces.tobago.layout.
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.html.Aria;
 import org.apache.myfaces.tobago.renderkit.html.BootstrapClass;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlRoleValues;
 import org.apache.myfaces.tobago.renderkit.html.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -107,9 +111,22 @@ public class MessagesRenderer extends La
 
         if (first || lastSeverity != severity) {
           writer.startElement(HtmlElements.DIV, messages);
-          writer.writeClassAttribute(
-              TobagoClass.MESSAGES, BootstrapClass.ALERT, BootstrapClass.alert(severity));
+          writer.writeClassAttribute(TobagoClass.MESSAGES,
+              BootstrapClass.ALERT, BootstrapClass.ALERT_DISMISSIBLE, BootstrapClass.alert(severity));
           HtmlRendererUtils.writeDataAttributes(facesContext, writer, messages);
+          writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.ALERT.toString(), false);
+
+          writer.startElement(HtmlElements.BUTTON, null);
+          writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON, false);
+          writer.writeClassAttribute(BootstrapClass.CLOSE);
+          writer.writeAttribute(DataAttributes.DISMISS, "alert", false);
+          writer.writeAttribute(Aria.ACTIVEDESCENDANT.getValue(), "Close", false); // todo: i18n
+          writer.startElement(HtmlElements.SPAN, null);
+          writer.writeAttribute(Aria.HIDDEN.getValue(), Boolean.TRUE.toString(), false);
+          writer.writeText("×"); // times
+          writer.endElement(HtmlElements.SPAN);
+          writer.endElement(HtmlElements.BUTTON);
+
         }
 
         encodeMessage(writer, messages, message, item.getClientId());

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java?rev=1701174&r1=1701173&r2=1701174&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java Fri Sep  4 08:28:34 2015
@@ -115,7 +115,7 @@ public class NavRenderer extends Rendere
     writer.writeClassAttribute(BootstrapClass.NAVBAR_TOGGLE, BootstrapClass.COLLAPSED);
     writer.writeAttribute(DataAttributes.TOGGLE, "collapse", false);
     writer.writeAttribute(DataAttributes.TARGET, JQueryUtils.escapeIdForHtml(navbarId), true);
-    writer.writeAttribute("aria-expanded", "false", false);
+    writer.writeAttribute("aria-expanded", Boolean.FALSE.toString(), false);
     writer.writeAttribute("aria-controls", navbarId, false);
 
     writer.startElement(HtmlElements.SPAN, null);