You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2009/03/16 16:19:35 UTC
svn commit: r754912 - in /incubator/click/trunk/click/examples:
src/org/apache/click/examples/control/
src/org/apache/click/examples/page/panel/ webapp/WEB-INF/ webapp/panel/
Author: sabob
Date: Mon Mar 16 15:19:33 2009
New Revision: 754912
URL: http://svn.apache.org/viewvc?rev=754912&view=rev
Log:
Added reusable Panel demo
Added:
incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.htm
incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ReusablePanelDemo.java
incubator/click/trunk/click/examples/webapp/panel/reusable-panel-demo.htm
Modified:
incubator/click/trunk/click/examples/webapp/WEB-INF/menu.xml
Added: incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.htm
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.htm?rev=754912&view=auto
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.htm (added)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.htm Mon Mar 16 15:19:33 2009
@@ -0,0 +1,26 @@
+<!--
+ 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.
+-->
+
+#if ($msg)
+ <h3 style="color:#334ECF">$msg</h3>
+#end
+
+<div style="border: 1px solid #CCCCCC; float: left;">
+ $form
+</div>
Added: incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.java?rev=754912&view=auto
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.java (added)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/control/ClientPanel.java Mon Mar 16 15:19:33 2009
@@ -0,0 +1,68 @@
+/*
+ * 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.click.examples.control;
+
+import org.apache.click.control.Form;
+import org.apache.click.control.Panel;
+import org.apache.click.control.Submit;
+import org.apache.click.control.TextField;
+import org.apache.click.extras.control.DateField;
+import org.apache.click.extras.control.DoubleField;
+
+/**
+ * Provides a reusable Panel to capture Client details.
+ *
+ * @author Bob Schellink
+ */
+public class ClientPanel extends Panel {
+
+ private static final long serialVersionUID = 1L;
+
+ private Form form = new Form("form");
+
+ public ClientPanel(String name) {
+ super(name);
+ }
+
+ public void onInit() {
+ form.add(new TextField("name")).setRequired(true);
+ form.add(new DateField("dateJoined"));
+ form.add(new DoubleField("holdings"));
+
+ form.add(new Submit("submit", this, "onSubmit"));
+ form.add(new Submit("cancel", this, "onCancel"));
+
+ add(form);
+ }
+
+ public boolean onSubmit() {
+ if (form.isValid()) {
+ // In real app one would store client in database
+ addModel("msg", "Successfully created new Client: '"
+ + form.getFieldValue("name") + "'.");
+ }
+ return true;
+ }
+
+ public boolean onCancel() {
+ addModel("msg", "Cancelled.");
+
+ return true;
+ }
+}
Added: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ReusablePanelDemo.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ReusablePanelDemo.java?rev=754912&view=auto
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ReusablePanelDemo.java (added)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ReusablePanelDemo.java Mon Mar 16 15:19:33 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.click.examples.page.panel;
+
+import org.apache.click.examples.control.ClientPanel;
+import org.apache.click.examples.page.BorderPage;
+
+/**
+ * Provides example usage of a reusable ClientPanel, which contains a Form for
+ * capturing Client details.
+ *
+ * @author Bob Schellink
+ */
+public class ReusablePanelDemo extends BorderPage {
+
+ private ClientPanel customerPanel = new ClientPanel("panel");
+
+ public void onInit() {
+ // Invoke default onInit implementation
+ super.onInit();
+
+ // Add customer panel to Page
+ addControl(customerPanel);
+ }
+}
Modified: incubator/click/trunk/click/examples/webapp/WEB-INF/menu.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/WEB-INF/menu.xml?rev=754912&r1=754911&r2=754912&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/webapp/WEB-INF/menu.xml (original)
+++ incubator/click/trunk/click/examples/webapp/WEB-INF/menu.xml Mon Mar 16 15:19:33 2009
@@ -125,6 +125,7 @@
<menu label="Tabbed Panel" path="panel/tabbed-panel-demo.htm"/>
<menu label="Filter Panel" path="panel/filter-panel-demo.htm"/>
<menu label="Column Panel" path="panel/panel-column-demo.htm"/>
+ <menu label="Reusable Panel" path="panel/reusable-panel-demo.htm"/>
</menu>
<menu label=" Cayenne" path="#" imageSrc="/assets/images/cayenne.png">
Added: incubator/click/trunk/click/examples/webapp/panel/reusable-panel-demo.htm
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/panel/reusable-panel-demo.htm?rev=754912&view=auto
==============================================================================
--- incubator/click/trunk/click/examples/webapp/panel/reusable-panel-demo.htm (added)
+++ incubator/click/trunk/click/examples/webapp/panel/reusable-panel-demo.htm Mon Mar 16 15:19:33 2009
@@ -0,0 +1,26 @@
+<!--
+#* 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.*#
+-->
+
+This example demonstrates how to create a reusable Panel to capture Client
+details. The source for the ClientPanel can be found
+<a target="_blank" href="$context/source-viewer.htm?filename=WEB-INF/classes/org/apache/click/examples/control/CustomerPanel.java">here</a>.
+
+<p/>
+
+$panel
\ No newline at end of file