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/02/15 08:54:50 UTC
svn commit: r1783072 - in
/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main:
java/org/apache/myfaces/tobago/example/demo/TestController.java
webapp/script/tobago-testAll.js webapp/testAll.xhtml
Author: lofwyr
Date: Wed Feb 15 08:54:49 2017
New Revision: 1783072
URL: http://svn.apache.org/viewvc?rev=1783072&view=rev
Log:
TOBAGO-1515 Offsets for SegementLayout
* cleanup (currently the CSS offset-classes are added two times)
[developed by hnoeth]
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-testAll.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java?rev=1783072&r1=1783071&r2=1783072&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java Wed Feb 15 08:54:49 2017
@@ -26,8 +26,11 @@ import javax.enterprise.context.RequestS
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.inject.Named;
+import java.io.File;
import java.io.Serializable;
import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
@RequestScoped
@Named
@@ -50,4 +53,53 @@ public class TestController implements S
return null;
}
+
+ public List<TestPage> getTestPages() {
+ List<TestPage> testPages = new ArrayList<TestPage>();
+
+ int idCount = 1;
+ final File rootDir = new File("src/main/webapp/content");
+ for (String testJs : getTestJs(rootDir)) {
+ final String xhtml = "/faces/" + testJs.substring(16, testJs.length() - 8) + ".xhtml";
+ final String adjustedTestJs = "/" + testJs.substring(16);
+ testPages.add(new TestPage("tp" + idCount++, xhtml, adjustedTestJs));
+ }
+ return testPages;
+ }
+
+ private List<String> getTestJs(File dir) {
+ List<String> xhtmls = new ArrayList<String>();
+ for (File file : dir.listFiles()) {
+ if (file.isDirectory()) {
+ xhtmls.addAll(getTestJs(file));
+ } else if (!file.getName().startsWith("x-") && file.getName().endsWith(".test.js")) {
+ xhtmls.add(file.getPath());
+ }
+ }
+ return xhtmls;
+ }
+
+ public class TestPage {
+ private final String id;
+ private final String xhtml;
+ private final String js;
+
+ TestPage(String id, String xhtml, String js) {
+ this.id = id;
+ this.xhtml = xhtml;
+ this.js = js;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getXhtml() {
+ return xhtml;
+ }
+
+ public String getJs() {
+ return js;
+ }
+ }
}
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-testAll.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-testAll.js?rev=1783072&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-testAll.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-testAll.js Wed Feb 15 08:54:49 2017
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+Tobago.registerListener(function() {
+ jQuery("iframe").each(function() {
+ jQuery(this).load(function() {
+
+ var idCount = jQuery(this).attr("id").substring(7);
+ var $thisFrame = jQuery("#page\\:tp" + idCount);
+ var $nextFrame = jQuery("#page\\:tp" + ++idCount);
+
+ waitForTest(function() {
+ $thisFrame = jQuery($thisFrame.selector);
+ return $thisFrame.contents().find("#qunit-banner").length > 0
+ && $thisFrame.contents().find("#qunit-banner").attr("class") != "";
+ }, function() {
+ $nextFrame = jQuery($nextFrame.selector);
+ runNextFrame($nextFrame);
+ });
+ });
+ });
+
+ var $firstFrame = jQuery("#page\\:tp1");
+ runNextFrame($firstFrame);
+}, Tobago.Phase.DOCUMENT_READY);
+
+function waitForTest(waitingDone, executeWhenDone) {
+ var stillWaiting = true;
+ var interval = setInterval(function() {
+ if (stillWaiting) {
+ stillWaiting = !waitingDone();
+ } else {
+ executeWhenDone();
+ clearInterval(interval);
+ }
+ }, 500);
+}
+
+function runNextFrame($nextFrame) {
+ if ($nextFrame.length > 0) {
+ var url = $nextFrame.attr("name");
+ if (url != undefined) {
+ $nextFrame.removeAttr("name");
+ $nextFrame.attr("src", url);
+ }
+ }
+}
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml?rev=1783072&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml Wed Feb 15 08:54:49 2017
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <tc:script file="#{request.contextPath}/script/tobago-testAll.js"/>
+
+ <c:forEach items="#{testController.testPages}" var="testPage">
+ <tc:object id="#{testPage.id}" name="test.xhtml?page=#{testPage.xhtml}&testjs=#{testPage.js}"/>
+ </c:forEach>
+</ui:composition>