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 2017/09/28 12:18:03 UTC

[myfaces-tobago] branch master updated (28d0396 -> 14de847)

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git.


    from 28d0396  demo: brand link to tobago-vm.apache.org
     new 0a3a3b9  demo: show tobago build time in server-info
     new 14de847  TOBAGO-1813: Internal Measure support for CSS units: ch, rem, vw, vh, vmin, vmax

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  1 +
 .../org/apache/myfaces/tobago/layout/Measure.java  | 13 ++++++++++--
 .../myfaces/tobago/layout/MeasureUnitTest.java     |  6 ++++++
 .../tobago/example/demo/ManifestReader.java        | 20 ++++++++++++++++++
 .../30-concept/16-layout/20-flex/flex-layout.xhtml |  8 ++++----
 .../src/main/webapp/server-info.xhtml              | 24 ++++++++++------------
 6 files changed, 53 insertions(+), 19 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].

[myfaces-tobago] 01/02: demo: show tobago build time in server-info

Posted by lo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 0a3a3b971429ee423001345372f2f083fbdbaec1
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Sep 28 13:42:20 2017 +0200

    demo: show tobago build time in server-info
---
 pom.xml                                            |  1 +
 .../tobago/example/demo/ManifestReader.java        | 20 ++++++++++++++++++
 .../src/main/webapp/server-info.xhtml              | 24 ++++++++++------------
 3 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index e431f1c..e636c9a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -748,6 +748,7 @@
               </manifest>
               <manifestEntries>
                 <Revision>${scm.revision}</Revision>
+                <Build-Time>${maven.build.timestamp}</Build-Time>
               </manifestEntries>
               <manifestSections>
                 <manifestSection>
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java
index dcf9ce5..4be7c77 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java
@@ -28,7 +28,12 @@ import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import java.io.IOException;
 import java.net.URL;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Enumeration;
+import java.util.TimeZone;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 
@@ -42,6 +47,8 @@ public class ManifestReader {
 
   private final SheetState state;
 
+  private Date buildTime;
+
   public ManifestReader() {
 
     state = new SheetState();
@@ -65,6 +72,15 @@ public class ManifestReader {
         for (final Object key : attributes.keySet()) {
           jar.add(new ManifestEntry(key.toString(), attributes.get(key).toString()));
         }
+        if (name.startsWith("tobago-core")) {
+          final DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+          format.setTimeZone(TimeZone.getTimeZone("UTC"));
+          try {
+            buildTime = format.parse(attributes.getValue("Build-Time"));
+          } catch (ParseException e) {
+            LOG.error("Can't parse '" + attributes.getValue("Build-Time") + "'", e);
+          }
+        }
       }
     } catch (final IOException e) {
       LOG.error("Problem while processing URL: " + url, e);
@@ -78,4 +94,8 @@ public class ManifestReader {
   public SheetState getState() {
     return state;
   }
+
+  public Date getBuildTime() {
+    return buildTime;
+  }
 }
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml
index d5f6752..05fb690 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml
@@ -19,7 +19,7 @@
 
 <ui:composition template="/main.xhtml"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
-                xmlns:ui="http://java.sun.com/jsf/facelets">
+                xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core">
 
   <ui:param name="title" value="Server Info"/>
 
@@ -27,26 +27,24 @@
 
     <tc:section label="Main Properties">
 
-      <tc:in value="#{info.version}" readonly="true"
-             label="Tobago Version"/>
+      <tc:in value="#{info.version}" readonly="true" label="Tobago Version"/>
 
-      <tc:in value="#{info.jsfTitle}" readonly="true"
-             label="JSF Implementation"/>
+      <tc:in value="#{manifestReader.buildTime}" readonly="true" label="Tobago Build Time">
+        <f:convertDateTime type="both" />
+      </tc:in>
 
-      <tc:in value="#{info.jsfVersion}" readonly="true"
-             label="JSF Version"/>
+      <tc:in value="#{info.jsfTitle}" readonly="true" label="JSF Implementation"/>
 
-      <tc:in value="#{info.serverInfo}" readonly="true"
-             label="Server Info"/>
+      <tc:in value="#{info.jsfVersion}" readonly="true" label="JSF Version"/>
+
+      <tc:in value="#{info.serverInfo}" readonly="true" label="Server Info"/>
 
       <tc:in value="#{info.systemProperties['java.runtime.version']} - #{info.systemProperties['java.vm.vendor']}"
-             readonly="true"
-             label="Java"/>
+             readonly="true" label="Java"/>
 
       <tc:in
           value="#{info.systemProperties['os.name']} - #{info.systemProperties['os.version']} - #{info.systemProperties['os.arch']}"
-          readonly="true"
-          label="Operating System"/>
+          readonly="true" label="Operating System"/>
 
     </tc:section>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-tobago] 02/02: TOBAGO-1813: Internal Measure support for CSS units: ch, rem, vw, vh, vmin, vmax

Posted by lo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 14de8474cd4c0fc21770ba2d75f641cd44c37056
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Sep 28 14:17:58 2017 +0200

    TOBAGO-1813: Internal Measure support for CSS units: ch, rem, vw, vh, vmin, vmax
---
 .../main/java/org/apache/myfaces/tobago/layout/Measure.java | 13 +++++++++++--
 .../org/apache/myfaces/tobago/layout/MeasureUnitTest.java   |  6 ++++++
 .../content/30-concept/16-layout/20-flex/flex-layout.xhtml  |  8 ++++----
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
index ee7b668..91bc6c1 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
@@ -99,8 +99,11 @@ public final class Measure implements Serializable {
       if (value.endsWith("%")) {
         return new Measure(value.substring(0, length - 1), Unit.PERCENT);
       }
-      if (length >= 2 && Character.isLetter(value.charAt(length - 2))) {
-        return new Measure(value.substring(0, length - 2), Unit.valueOf(value.substring(length - 2).toUpperCase()));
+      for (int i = 4; i >= 2; i--) {
+        final int pos = length - i;
+        if (length >= i && Character.isLetter(value.charAt(pos))) {
+          return new Measure(value.substring(0, pos), Unit.valueOf(value.substring(pos).toUpperCase()));
+        }
       }
       return new Measure(value, Unit.PX);
 
@@ -173,6 +176,12 @@ public final class Measure implements Serializable {
     MM,
     IN,
     PC,
+    CH, // Relative to width of the "0" (zero)
+    REM, // Relative to font-size of the root element
+    VW, // Relative to 1% of the width of the viewport*
+    VH, // Relative to 1% of the height of the viewport*
+    VMIN, // Relative to 1% of viewport's* smaller dimension
+    VMAX, // Relative to 1% of viewport's* larger dimension
     PERCENT;
 
     private final String value;
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java
index 0eeaa8d..efba114 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java
@@ -42,6 +42,12 @@ public class MeasureUnitTest {
     Assert.assertEquals("13.7ex", "" + Measure.valueOf("13.7ex"));
     Assert.assertEquals("13.7em", "" + Measure.valueOf("13.7em"));
     Assert.assertEquals("13.7in", "" + Measure.valueOf("13.7in"));
+    Assert.assertEquals("13.7ch", "" + Measure.valueOf("13.7ch"));
+    Assert.assertEquals("13.7rem", "" + Measure.valueOf("13.7rem"));
+    Assert.assertEquals("13.7vw", "" + Measure.valueOf("13.7vw"));
+    Assert.assertEquals("13.7vh", "" + Measure.valueOf("13.7vh"));
+    Assert.assertEquals("13.7vmin", "" + Measure.valueOf("13.7vmin"));
+    Assert.assertEquals("13.7vmax", "" + Measure.valueOf("13.7vmax"));
     Assert.assertEquals("13.7%", "" + Measure.valueOf("13.7%"));
   }
 
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/20-flex/flex-layout.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/20-flex/flex-layout.xhtml
index 91cb12d..e40a6ee 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/20-flex/flex-layout.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/20-flex/flex-layout.xhtml
@@ -40,21 +40,21 @@
   </tc:section>
 
   <tc:section label="Columns">
-    <p>In this example, the <code>columns</code> attribute is set to '200px;auto;1*;2*;10em'.
+    <p>In this example, the <code>columns</code> attribute is set to '200px;auto;1*;2*;10rem'.
       This means:</p>
     <ul>
       <li>Column 1: Width is always at 200px.</li>
       <li>Column 2: Width is always the width of the button.</li>
       <li>Column 3: The left space is filled with the remaining buttons in a ratio of 1:3 for this button.</li>
       <li>Column 4: The left space is filled with the remaining buttons in a ratio of 2:3 for this button.</li>
-      <li>Column 5: Width is always set to 10em.</li>
+      <li>Column 5: Width is always set to 10rem.</li>
     </ul>
-    <tc:flexLayout columns="200px;auto;1*;2*;10em">
+    <tc:flexLayout columns="200px;auto;1*;2*;10rem">
       <tc:button label="200px"/>
       <tc:button label="auto"/>
       <tc:button label="1*"/>
       <tc:button label="2*"/>
-      <tc:button label="10em"/>
+      <tc:button label="10rem"/>
     </tc:flexLayout>
   </tc:section>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.