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/10/13 07:30:11 UTC
[myfaces-tobago] 01/04: Demo: * cleanup * show JSF version
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 b7fdc210dc4e32157f1bf7f70ea9ac17511d2355
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Oct 12 14:29:58 2017 +0200
Demo:
* cleanup
* show JSF version
---
.../apache/myfaces/tobago/util/FacesVersion.java | 25 ++++++++---
.../tobago/example/{test => demo}/Version.java | 29 +++++-------
.../src/main/webapp/WEB-INF/faces-config.xml | 6 ---
.../content/40-test/90000-attic/version/version.js | 44 -------------------
.../40-test/90000-attic/version/version.xhtml | 51 ----------------------
.../src/main/webapp/server-info.xhtml | 14 +++++-
6 files changed, 43 insertions(+), 126 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
index fd3cf51..bc36fe6 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
@@ -28,7 +28,8 @@ public enum FacesVersion {
VERSION_12,
VERSION_20,
VERSION_21,
- VERSION_22;
+ VERSION_22,
+ VERSION_23;
private static FacesVersion currentVersion;
private static boolean mojarra;
@@ -45,6 +46,8 @@ public enum FacesVersion {
currentVersion = VERSION_21;
Application.class.getMethod("getFlowHandler");
currentVersion = VERSION_22;
+ Application.class.getMethod("getSearchExpressionHandler");
+ currentVersion = VERSION_23;
} catch (final NoSuchMethodException e) {
// ignore
}
@@ -82,7 +85,8 @@ public enum FacesVersion {
return currentVersion == VERSION_12
|| currentVersion == VERSION_20
|| currentVersion == VERSION_21
- || currentVersion == VERSION_22;
+ || currentVersion == VERSION_22
+ || currentVersion == VERSION_23;
}
/**
@@ -92,7 +96,8 @@ public enum FacesVersion {
public static boolean supports20() {
return currentVersion == VERSION_20
|| currentVersion == VERSION_21
- || currentVersion == VERSION_22;
+ || currentVersion == VERSION_22
+ || currentVersion == VERSION_23;
}
/**
@@ -101,7 +106,8 @@ public enum FacesVersion {
*/
public static boolean supports21() {
return currentVersion == VERSION_21
- || currentVersion == VERSION_22;
+ || currentVersion == VERSION_22
+ || currentVersion == VERSION_23;
}
/**
@@ -109,7 +115,16 @@ public enum FacesVersion {
* @return Supports 2.2 or higher
*/
public static boolean supports22() {
- return currentVersion == VERSION_22;
+ return currentVersion == VERSION_22
+ || currentVersion == VERSION_23;
+ }
+
+ /**
+ * Does the JSF is version 2.3 or higher
+ * @return Supports 2.3 or higher
+ */
+ public static boolean supports23() {
+ return currentVersion == VERSION_23;
}
public static boolean isMojarra() {
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/Version.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Version.java
similarity index 71%
rename from tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
rename to tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Version.java
index d05548c..c34c34e 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Version.java
@@ -17,22 +17,17 @@
* under the License.
*/
-package org.apache.myfaces.tobago.example.test;
+package org.apache.myfaces.tobago.example.demo;
import org.apache.myfaces.tobago.util.FacesVersion;
-import javax.faces.context.FacesContext;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+@Named
+@ApplicationScoped
public class Version {
- public boolean isVersion11() {
- return !FacesVersion.supports12();
- }
-
- public boolean isVersion12() {
- return FacesVersion.supports12() && !FacesVersion.supports20();
- }
-
public boolean isVersion20() {
return FacesVersion.supports20() && !FacesVersion.supports21();
}
@@ -42,7 +37,11 @@ public class Version {
}
public boolean isVersion22() {
- return FacesVersion.supports22();
+ return FacesVersion.supports22() && !FacesVersion.supports23();
+ }
+
+ public boolean isVersion23() {
+ return FacesVersion.supports23();
}
public boolean isMojarra() {
@@ -52,12 +51,4 @@ public class Version {
public boolean isMyfaces() {
return FacesVersion.isMyfaces();
}
-
- public String getJsfVersion() {
- return FacesContext.class.getPackage().getImplementationVersion();
- }
-
- public String getJsfTitle() {
- return FacesContext.class.getPackage().getImplementationTitle();
- }
}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
index 9bf07be..0348684 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
@@ -236,12 +236,6 @@
</managed-bean>
<managed-bean>
- <managed-bean-name>version</managed-bean-name>
- <managed-bean-class>org.apache.myfaces.tobago.example.test.Version</managed-bean-class>
- <managed-bean-scope>none</managed-bean-scope>
- </managed-bean>
-
- <managed-bean>
<managed-bean-name>dynamic</managed-bean-name>
<managed-bean-class>org.apache.myfaces.tobago.example.test.DynamicBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/90000-attic/version/version.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/90000-attic/version/version.js
deleted file mode 100644
index 4429b27..0000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/90000-attic/version/version.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-
-TestVersion = {};
-
-TestVersion.init = function () {
-
- var checked = jQuery("input[checked]");
- if (checked.size() !== 2) {
- TobagoAssert.fail("2 field must be checked", null, 2, checked);
- }
-
- var textList = jQuery("input[type=text]");
-
- var version = checked.eq(0).next().html().toLowerCase();
- var packageVersion = "version " + textList.eq(0).val().toLowerCase();
-
- if (packageVersion.indexOf(version) === -1) {
- TobagoAssert.fail("Version number", null, version, packageVersion);
- }
-
- var impl = checked.eq(1).next().html().toLowerCase();
- var packageImpl = textList.eq(1).val().toLowerCase();
-
- if (packageImpl.indexOf(impl) === -1) {
- TobagoAssert.fail("Implementation", null, impl, packageImpl);
- }
-};
-
-Tobago.registerListener(TestVersion.init, Tobago.Phase.DOCUMENT_READY);
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/90000-attic/version/version.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/90000-attic/version/version.xhtml
deleted file mode 100644
index e8323ac..0000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/90000-attic/version/version.xhtml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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.
--->
-
-<!-- XXX This is an old page. Content might not be up to date. Needs to be refactored, or just deleted. -->
-<f:view
- xmlns:tc="http://myfaces.apache.org/tobago/component"
- xmlns:f="http://java.sun.com/jsf/core">
-
- <tc:page id="page">
- <!-- <tc:gridLayoutConstraint width="700px" height="600px"/> -->
-
- <f:facet name="layout">
- <tc:gridLayout rows="auto;auto"/>
- </f:facet>
-
- <tc:box label="From class FacesVersion">
- <tc:selectBooleanCheckbox value="#{version.version11}" label="Version 1.1 (not supported)"/>
- <tc:selectBooleanCheckbox value="#{version.version12}" label="Version 1.2 (not supported)"/>
- <tc:selectBooleanCheckbox value="#{version.version20}" label="Version 2.0"/>
- <tc:selectBooleanCheckbox value="#{version.version21}" label="Version 2.1"/>
- <tc:selectBooleanCheckbox value="#{version.version22}" label="Version 2.2"/>
-
- <tc:selectBooleanCheckbox value="#{version.mojarra}" label="Mojarra"/>
- <tc:selectBooleanCheckbox value="#{version.myfaces}" label="MyFaces"/>
- </tc:box>
-
- <tc:box label="From package">
- <tc:in value="#{version.jsfVersion}" label="JSF Version"/>
- <tc:in value="#{version.jsfTitle}" label="JSF Title"/>
- </tc:box>
-
- <tc:script file="script/tobago-assert.js"/>
- <tc:script file="test/version/version.js"/>
-
- </tc:page>
-</f:view>
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 05fb690..d0fd84a 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
@@ -30,7 +30,7 @@
<tc:in value="#{info.version}" readonly="true" label="Tobago Version"/>
<tc:in value="#{manifestReader.buildTime}" readonly="true" label="Tobago Build Time">
- <f:convertDateTime type="both" />
+ <f:convertDateTime type="both"/>
</tc:in>
<tc:in value="#{info.jsfTitle}" readonly="true" label="JSF Implementation"/>
@@ -46,6 +46,18 @@
value="#{info.systemProperties['os.name']} - #{info.systemProperties['os.version']} - #{info.systemProperties['os.arch']}"
readonly="true" label="Operating System"/>
+ <tc:segmentLayout medium="6;6" large="4,4,4" extraLarge="3,3,3">
+ <tc:selectBooleanCheckbox value="#{version.version20}" readonly="true" label="Version 2.0"/>
+ <tc:selectBooleanCheckbox value="#{version.version21}" readonly="true" label="Version 2.1"/>
+ <tc:selectBooleanCheckbox value="#{version.version22}" readonly="true" label="Version 2.2"/>
+ <tc:selectBooleanCheckbox value="#{version.version23}" readonly="true" label="Version 2.3"/>
+ </tc:segmentLayout>
+
+ <tc:segmentLayout medium="6;6" large="4,4,4" extraLarge="3,3,3">
+ <tc:selectBooleanCheckbox value="#{version.mojarra}" readonly="true" label="Mojarra"/>
+ <tc:selectBooleanCheckbox value="#{version.myfaces}" readonly="true" label="MyFaces"/>
+ </tc:segmentLayout>
+
</tc:section>
<tc:section label="System Properties">
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.