Author: rich
Date: Tue May 24 23:04:38 2005
New Revision: 178383
URL: http://svn.apache.org/viewcvs?rev=178383&view=rev
Log:
Added a sample to demonstrate the Page Flow lifecycle.
tests: build.dist (WinXP)
BB (and run.tests): self (linux)
Added:
incubator/beehive/trunk/samples/netui-samples/lifecycle/
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/BasePageFlow.java
(with props)
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/template.jsp
(with props)
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/LongLivedPageFlow.java
(with props)
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/index.jsp
(with props)
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/NormalPageFlow.java
(with props)
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/index.jsp
(with props)
Modified:
incubator/beehive/trunk/samples/netui-samples/index.jsp
Modified: incubator/beehive/trunk/samples/netui-samples/index.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/index.jsp?rev=178383&r1=178382&r2=178383&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/index.jsp (original)
+++ incubator/beehive/trunk/samples/netui-samples/index.jsp Tue May 24 23:04:38
2005
@@ -35,6 +35,11 @@
<dd>Demonstrates Page Flow declarative exception handling.</dd>
</dl>
<dl>
+ <dt><netui:anchor href="lifecycle/normal/NormalPageFlow.jpf"
value="Lifecycle"/></dt>
+ <dd>Demonstrates the lifecycle (creation/destruction) of "normal"
and "long-lived" page
+ flows. Also demonstrates inheritance of actions.</dd>
+ </dl>
+ <dl>
<dt><netui:anchor href="loginexample/start/Controller.jpf"
value="Login"/></dt>
<dd>Demonstrates defining your own LoginHandler, as well as nested
page flows and Page Flow
inheritance.</dd>
Added:
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/BasePageFlow.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/lifecycle/base/BasePageFlow.java?rev=178383&view=auto
==============================================================================
---
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/BasePageFlow.java
(added)
+++
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/BasePageFlow.java
Tue May 24 23:04:38 2005
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+package lifecycle.base;
+
+import java.io.Serializable;
+
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+
+
+/**
+ * This page flow contains an integer variable and an action to increment it,
as well as some
+ * common actions and lifecycle methods. It's extended by the other page
flows in this sample, and
+ * can't be hit directly.
+ */
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp"),
+ @Jpf.SimpleAction(name="goNormal",
path="/lifecycle/normal/NormalPageFlow.jpf"),
+ @Jpf.SimpleAction(name="goLongLived",
path="/lifecycle/longlived/LongLivedPageFlow.jpf")
+ }
+)
+public abstract class BasePageFlow
+ extends PageFlowController
+{
+ private int _num = 0;
+
+ public int getNum()
+ {
+ return _num;
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="current", navigateTo=Jpf.NavigateTo.currentPage)
+ }
+ )
+ public Forward increment()
+ {
+ _num++;
+ return new Forward("current");
+ }
+
+ protected void onCreate()
+ {
+ System.out.println( "**** in onCreate for " + getClass().getName() );
+ }
+
+ protected void onDestroy()
+ {
+ System.out.println( "**** in onDestroy for " + getClass().getName() );
+ }
+}
Propchange:
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/BasePageFlow.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-samples/lifecycle/base/template.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/lifecycle/base/template.jsp?rev=178383&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/lifecycle/base/template.jsp
(added)
+++ incubator/beehive/trunk/samples/netui-samples/lifecycle/base/template.jsp
Tue May 24 23:04:38 2005
@@ -0,0 +1,74 @@
+<%--
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed 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.
+
+ $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0"
prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0"
prefix="netui-template"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+
+<netui-data:declareBundle
bundlePath="org.apache.beehive.samples.netui.resources.site" name="site"/>
+
+<netui:html>
+ <head>
+ <title>
+ ${bundle.site.browserTitle} -- NetUI Feature Samples: Page Flow
Lifecycle
+ </title>
+ <link rel="stylesheet"
href="${pageContext.request.contextPath}/resources/css/style.css"
type="text/css"/>
+ </head>
+ <netui:body>
+ <div>
+ <div id="header">
+ <table style="background-color:#FFE87C;width:100%;">
+ <tr>
+ <td style="font-size:x-large;">NetUI Feature Samples: Page
Flow Lifecycle</td>
+ <td style="text-align:right;"><a
href="${pageContext.request.contextPath}" target="_top">Samples Home</a></td>
+ </tr>
+ </table><br/>
+ </div>
+
+ <div id="main">
+ <h3>Page Flow ${pageFlow.URI}</h3>
+ <p>
+ <netui-template:includeSection name="notes"/>
+ </p>
+ <table>
+ <tr>
+ <td>Current integer value: <b>${pageFlow.num}</b></td>
+ <td>
+ <netui:form action="increment">
+ <netui:button value="increment"/>
+ </netui:form>
+ </td>
+ </tr>
+ </table>
+ <p>
+ <netui-template:includeSection name="links"/>
+ </p>
+ </div>
+
+ <div id="footer">
+ <table style="background-color:#FFE87C;width:100%;">
+ <tr>
+ <td> </td>
+ <td style="text-align:right;"><a
href="${pageContext.request.contextPath}">Samples Home</a></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </netui:body>
+</netui:html>
Propchange:
incubator/beehive/trunk/samples/netui-samples/lifecycle/base/template.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/LongLivedPageFlow.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/LongLivedPageFlow.java?rev=178383&view=auto
==============================================================================
---
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/LongLivedPageFlow.java
(added)
+++
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/LongLivedPageFlow.java
Tue May 24 23:04:38 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+package lifecycle.longlived;
+
+import java.io.Serializable;
+
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+
+import lifecycle.base.BasePageFlow;
+
+
+/**
+ * This is a "long-lived" page flow. It is not "destroyed" (released) when
you hit another page
+ * flow. It inherits everythign else from BaseFlow, which contains an action
for incrementing a
+ * member variable.
+ */
[EMAIL PROTECTED](
+ longLived=true
+)
+public class LongLivedPageFlow
+ extends BasePageFlow
+{
+}
Propchange:
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/LongLivedPageFlow.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/index.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/index.jsp?rev=178383&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/index.jsp
(added)
+++ incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/index.jsp
Tue May 24 23:04:38 2005
@@ -0,0 +1,35 @@
+<%--
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed 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.
+
+ $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+<netui-template:template templatePage="../base/template.jsp">
+
+ <netui-template:section name="notes">
+ This is a "long-lived" page flow. When you hit another page flow,
this one is <i>not</i>
+ "destroyed" (released). Increment the variable a few times, then
leave the page flow and
+ come back; the value will be retained.
+ </netui-template:section>
+
+ <netui-template:section name="links">
+ <netui:anchor action="goNormal">Go to the "normal" page
flow</netui:anchor>
+ </netui-template:section>
+
+</netui-template:template>
Propchange:
incubator/beehive/trunk/samples/netui-samples/lifecycle/longlived/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/NormalPageFlow.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/NormalPageFlow.java?rev=178383&view=auto
==============================================================================
---
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/NormalPageFlow.java
(added)
+++
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/NormalPageFlow.java
Tue May 24 23:04:38 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+package lifecycle.normal;
+
+import java.io.Serializable;
+
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+
+import lifecycle.base.BasePageFlow;
+
+
+/**
+ * This page flow simply inherits everything from BaseFlow, which contains an
action for
+ * incrementing a member variable. When you leave this page flow, it is
"destroyed" (released).
+ */
[EMAIL PROTECTED]()
+public class NormalPageFlow
+ extends BasePageFlow
+{
+}
Propchange:
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/NormalPageFlow.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/index.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/index.jsp?rev=178383&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/index.jsp
(added)
+++ incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/index.jsp
Tue May 24 23:04:38 2005
@@ -0,0 +1,35 @@
+<%--
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed 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.
+
+ $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+<netui-template:template templatePage="../base/template.jsp">
+
+ <netui-template:section name="notes">
+ This is a "normal" page flow. When you hit another page flow, this
one is "destroyed"
+ (released). Increment the variable a few times, then leave the page
flow and come back;
+ the value will be reset to zero.
+ </netui-template:section>
+
+ <netui-template:section name="links">
+ <netui:anchor action="goLongLived">Go to the "long-lived" page
flow</netui:anchor>
+ </netui-template:section>
+
+</netui-template:template>
Propchange:
incubator/beehive/trunk/samples/netui-samples/lifecycle/normal/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native