myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject svn commit: r1790106 - in /myfaces/tobago/branches/TOBAGO-1719: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/ tobago-core/src/main/java/org/apache/myf...
Date Tue, 04 Apr 2017 13:12:19 GMT
Author: hnoeth
Date: Tue Apr  4 13:12:19 2017
New Revision: 1790106

URL: http://svn.apache.org/viewvc?rev=1790106&view=rev
Log:
TOBAGO-1719 Update Bootstrap to 4.0.0 alpha 6 (from alpha 5)
* bootstrap v4-alpha6 progressbar implemented

Modified:
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ProgressRenderer.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/50-progress/progress.xhtml

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ProgressRenderer.java?rev=1790106&r1=1790105&r2=1790106&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ProgressRenderer.java
(original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ProgressRenderer.java
Tue Apr  4 13:12:19 2017
@@ -19,15 +19,19 @@
 
 package org.apache.myfaces.tobago.internal.renderkit.renderer;
 
-import org.apache.myfaces.tobago.component.UIProgress;
+import org.apache.myfaces.tobago.internal.component.AbstractUIProgress;
+import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
+import org.apache.myfaces.tobago.internal.util.JsonUtils;
+import org.apache.myfaces.tobago.internal.util.RenderUtils;
+import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.html.Arias;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.internal.util.JsonUtils;
-import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.internal.util.RenderUtils;
+import org.apache.myfaces.tobago.renderkit.html.HtmlRoleValues;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,31 +46,30 @@ public class ProgressRenderer extends Re
 
   @Override
   public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws
IOException {
-
-    final UIProgress progress = (UIProgress) component;
+    final AbstractUIProgress progress = (AbstractUIProgress) component;
 
     final double value = progress.getRangeValue();
     final double max = progress.getRangeMax();
-    final double percent = value >= max ? 1 : (value / max);
-
-    String title = progress.getTip();
-    if (title == null) {
-      title = (int) (percent * 100) + " %";
-    }
-
-    final int newValue = percent == 0 ? 0 : 100;
-    final double newMax = percent == 0 ? 100 : 1 / percent * 100;
+    final double percent = value / max;
 
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
 
-    writer.startElement(HtmlElements.PROGRESS);
+    writer.startElement(HtmlElements.DIV);
     writer.writeIdAttribute(progress.getClientId(facesContext));
     writer.writeClassAttribute(Classes.create(progress), progress.getCustomClass(), BootstrapClass.PROGRESS);
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, progress);
     writer.writeStyleAttribute(progress.getStyle());
-    writer.writeAttribute(HtmlAttributes.TITLE, title, true);
-    writer.writeAttribute(HtmlAttributes.MAX, Double.toString(newMax), false);
-    writer.writeAttribute(HtmlAttributes.VALUE, newValue);
+
+    writer.startElement(HtmlElements.DIV);
+    writer.writeClassAttribute(BootstrapClass.PROGRESS_BAR);
+    writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.PROGRESSBAR.toString(), false);
+    writer.writeAttribute(Arias.VALUEMIN, 0);
+    writer.writeAttribute(Arias.VALUEMAX, 100);
+    writer.writeAttribute(Arias.VALUENOW, String.valueOf((int) percent * 100), false);
+
+    Style style = new Style();
+    style.setWidth(new Measure(percent * 100, Measure.Unit.PERCENT));
+    writer.writeStyleAttribute(style);
 
     writer.writeCommandMapAttribute(JsonUtils.encode(RenderUtils.getBehaviorCommands(facesContext,
progress)));
   }
@@ -75,6 +78,7 @@ public class ProgressRenderer extends Re
   public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws
IOException {
 
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
-    writer.endElement(HtmlElements.PROGRESS);
+    writer.endElement(HtmlElements.DIV);
+    writer.endElement(HtmlElements.DIV);
   }
 }

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java?rev=1790106&r1=1790105&r2=1790106&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
(original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
Tue Apr  4 13:12:19 2017
@@ -257,6 +257,7 @@ public enum BootstrapClass implements Cs
   PAGE_LINK("page-link"),
   PAGINATION("pagination"),
   PROGRESS("progress"),
+  PROGRESS_BAR("progress-bar"),
   ROW("row"),
   SR_ONLY("sr-only"),
   TAB_CONTENT("tab-content"),

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java?rev=1790106&r1=1790105&r2=1790106&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java
(original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java
Tue Apr  4 13:12:19 2017
@@ -42,7 +42,10 @@ public enum Arias implements MarkupLangu
   PRESSED("aria-pressed"),
   RELEVANT("aria-relevant"),
   SETSIZE("aria-setsize"),
-  SORT("aria-sort");
+  SORT("aria-sort"),
+  VALUEMAX("aria-valuemax"),
+  VALUEMIN("aria-valuemin"),
+  VALUENOW("aria-valuenow");
 
   private final String value;
 

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java?rev=1790106&r1=1790105&r2=1790106&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
(original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
Tue Apr  4 13:12:19 2017
@@ -28,6 +28,7 @@ public enum HtmlRoleValues {
   MENU("menu"),
   NAVIGATION("navigation"),
   PRESENTATION("presentation"),
+  PROGRESSBAR("progressbar"),
   TAB("tab"),
   TABLIST("tablist"),
   TABPANEL("tabpanel");

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/50-progress/progress.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/50-progress/progress.xhtml?rev=1790106&r1=1790105&r2=1790106&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/50-progress/progress.xhtml
(original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/50-progress/progress.xhtml
Tue Apr  4 13:12:19 2017
@@ -36,7 +36,7 @@
   <tc:section label="Basics">
     <p>A static progressbar, with <code>value</code> of type <code>double</code>.</p>
     <pre><code class="language-markup">&lt;tc:progress value="15.8" max="20"/></code></pre>
-    <tc:progress value="14.9" max="20"/>
+    <tc:progress value="15.8" max="20"/>
   </tc:section>
 
   <tc:section label="Style">



Mime
View raw message