Updated Branches: refs/heads/master 406e5c462 -> fb58108ed
DELTASPIKE-503 added basic tests for windowhandling Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/fb58108e Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/fb58108e Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/fb58108e Branch: refs/heads/master Commit: fb58108ed0952dac72c708cb54ed48779873cdf2 Parents: 406e5c4 Author: tandraschko <[email protected]> Authored: Sun Feb 2 22:00:14 2014 +0100 Committer: tandraschko <[email protected]> Committed: Sun Feb 2 22:00:14 2014 +0100 ---------------------------------------------------------------------- deltaspike/examples/jsf-playground/pom.xml | 7 +++ .../example/PlaygroundClientWindowConfig.java | 62 ++++++++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 5 ++ .../windowhandling/clientwindow/test.xhtml | 42 +++++++++++++ .../webapp/views/windowhandling/lazy/test.xhtml | 46 +++++++++++++++ .../windowhandling/lazy/testPrimeFaces.xhtml | 51 ++++++++++++++++ .../windowhandling/lazy/testWithoutJS.xhtml | 44 ++++++++++++++ 7 files changed, 257 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/pom.xml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/pom.xml b/deltaspike/examples/jsf-playground/pom.xml index e4cfb10..dd5dab0 100644 --- a/deltaspike/examples/jsf-playground/pom.xml +++ b/deltaspike/examples/jsf-playground/pom.xml @@ -106,8 +106,15 @@ <groupId>org.apache.deltaspike.modules</groupId> <artifactId>deltaspike-jsf-module-impl</artifactId> <scope>runtime</scope> + </dependency> + <!-- PF snapshots are not available + <dependency> + <groupId>org.primefaces</groupId> + <artifactId>primefaces</artifactId> + <version>5.0-SNAPSHOT</version> </dependency> + --> </dependencies> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/example/PlaygroundClientWindowConfig.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/example/PlaygroundClientWindowConfig.java b/deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/example/PlaygroundClientWindowConfig.java new file mode 100644 index 0000000..dc952ea --- /dev/null +++ b/deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/example/PlaygroundClientWindowConfig.java @@ -0,0 +1,62 @@ +/* + * 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. + */ +package org.apache.deltaspike.example; + +import javax.enterprise.inject.Specializes; +import javax.faces.context.FacesContext; +import org.apache.deltaspike.jsf.spi.scope.window.DefaultClientWindowConfig; + +@Specializes +public class PlaygroundClientWindowConfig extends DefaultClientWindowConfig +{ + @Override + public ClientWindowRenderMode getClientWindowRenderMode(FacesContext facesContext) + { + String path = facesContext.getExternalContext().getRequestPathInfo(); + if (path == null) + { + path = facesContext.getExternalContext().getRequestServletPath(); + } + + ClientWindowRenderMode mode; + + if (path.contains("/windowhandling/clientwindow/")) + { + mode = ClientWindowRenderMode.CLIENTWINDOW; + } + else if (path.contains("/windowhandling/lazy/")) + { + mode = ClientWindowRenderMode.LAZY; + } + else if (path.contains("/windowhandling/none/")) + { + mode = ClientWindowRenderMode.NONE; + } + else if (path.contains("/windowhandling/delegated/")) + { + mode = ClientWindowRenderMode.DELEGATED; + } + else + { + mode = ClientWindowRenderMode.CLIENTWINDOW; + } + + return mode; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/web.xml b/deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/web.xml index 8f43fff..e78882e 100644 --- a/deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/web.xml +++ b/deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/web.xml @@ -34,6 +34,11 @@ <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> + + <servlet-mapping> + <servlet-name>Faces Servlet</servlet-name> + <url-pattern>/faces/*</url-pattern> + </servlet-mapping> <welcome-file-list> <welcome-file>index.xhtml</welcome-file> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/clientwindow/test.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/clientwindow/test.xhtml b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/clientwindow/test.xhtml new file mode 100644 index 0000000..e6aca24 --- /dev/null +++ b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/clientwindow/test.xhtml @@ -0,0 +1,42 @@ +<?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. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ds="http://deltaspike.apache.org/jsf"> + +<h:head> + <title>DeltaSpike JSF Playground</title> +</h:head> + +<h:body> + <h:form> + <ds:windowId/> + + DS WindowId: #{dsWindowContext.currentWindowId} + <br /> + <h:link value="Simple Link" outcome="test.xhtml" /> <br/> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/test.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/test.xhtml b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/test.xhtml new file mode 100644 index 0000000..1643d21 --- /dev/null +++ b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/test.xhtml @@ -0,0 +1,46 @@ +<?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. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ds="http://deltaspike.apache.org/jsf"> + +<h:head> + <title>DeltaSpike JSF Playground</title> +</h:head> + +<h:body> + <h:form> + <ds:windowId/> + + DS WindowId: #{dsWindowContext.currentWindowId} + <br /> + <h:link value="Simple Link" outcome="test.xhtml" /> <br/> + <br /> + <ds:disableClientWindow> + <h:link value="Simple Link" outcome="test.xhtml" /> + </ds:disableClientWindow> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testPrimeFaces.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testPrimeFaces.xhtml b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testPrimeFaces.xhtml new file mode 100644 index 0000000..0028946 --- /dev/null +++ b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testPrimeFaces.xhtml @@ -0,0 +1,51 @@ +<?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. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:ds="http://deltaspike.apache.org/jsf" + xmlns:p="http://primefaces.org/ui"> + +<h:head> + <title>DeltaSpike JSF Playground</title> +</h:head> + +<h:body> + <h:form> + <ds:windowId/> + + DS WindowId: #{dsWindowContext.currentWindowId} + <br /> + <p:inputText id="input" /> + <p:commandButton process="@this" update="@form" value="Update Form" partialSubmit="true"> + </p:commandButton> + <br /> + <h:commandButton value="Update Form"> + <f:ajax execute="@this" render="@form" /> + </h:commandButton> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/fb58108e/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testWithoutJS.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testWithoutJS.xhtml b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testWithoutJS.xhtml new file mode 100644 index 0000000..f885439 --- /dev/null +++ b/deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testWithoutJS.xhtml @@ -0,0 +1,44 @@ +<?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. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ds="http://deltaspike.apache.org/jsf"> + +<h:head> + <title>DeltaSpike JSF Playground</title> +</h:head> + +<h:body> + <h:form> + DS WindowId: #{dsWindowContext.currentWindowId} + <br /> + <h:link value="Simple Link" outcome="testWithoutJS.xhtml" /> <br/> + <br /> + <ds:disableClientWindow> + <h:link value="Simple Link" outcome="testWithoutJS.xhtml" /> + </ds:disableClientWindow> + </h:form> + +</h:body> + +</html> \ No newline at end of file
