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 2010/07/09 02:16:47 UTC

svn commit: r962371 - in /click/trunk/click/examples: src/org/apache/click/examples/control/ajax/ src/org/apache/click/examples/control/ajax/CustomerPanel.java webapp/control/ajax/ webapp/control/ajax/ajax-customer.htm

Author: sabob
Date: Fri Jul  9 00:16:47 2010
New Revision: 962371

URL: http://svn.apache.org/viewvc?rev=962371&view=rev
Log:
added CustomerPanel for rendering customer via Partials

Added:
    click/trunk/click/examples/src/org/apache/click/examples/control/ajax/
    click/trunk/click/examples/src/org/apache/click/examples/control/ajax/CustomerPanel.java
    click/trunk/click/examples/webapp/control/ajax/
    click/trunk/click/examples/webapp/control/ajax/ajax-customer.htm

Added: click/trunk/click/examples/src/org/apache/click/examples/control/ajax/CustomerPanel.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/control/ajax/CustomerPanel.java?rev=962371&view=auto
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/control/ajax/CustomerPanel.java (added)
+++ click/trunk/click/examples/src/org/apache/click/examples/control/ajax/CustomerPanel.java Fri Jul  9 00:16:47 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.ajax;
+
+import java.util.Map;
+import org.apache.click.Context;
+import org.apache.click.Page;
+import org.apache.click.control.Panel;
+import org.apache.click.examples.domain.Customer;
+import org.apache.click.util.HtmlStringBuffer;
+
+public class CustomerPanel extends Panel {
+
+    private static final long serialVersionUID = 1L;
+
+    private Customer customer;
+
+    public CustomerPanel(Page page, Customer customer) {
+        this.customer = customer;
+        setParent(page);
+    }
+
+    @Override
+    public void render(HtmlStringBuffer buffer) {
+        Context context = getContext();
+        Map templateModel = createTemplateModel();
+        templateModel.put("customer", customer);
+        buffer.append(context.renderTemplate("/control/ajax/ajax-customer.htm", templateModel));
+    }
+}

Added: click/trunk/click/examples/webapp/control/ajax/ajax-customer.htm
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/webapp/control/ajax/ajax-customer.htm?rev=962371&view=auto
==============================================================================
--- click/trunk/click/examples/webapp/control/ajax/ajax-customer.htm (added)
+++ click/trunk/click/examples/webapp/control/ajax/ajax-customer.htm Fri Jul  9 00:16:47 2010
@@ -0,0 +1,47 @@
+<!--
+#* 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.*#
+-->
+
+<table border="0" cellspacing="2" cellpadding="2">
+#if ($customer)
+ <tr>
+  <td><b>Name</b></td>
+  <td>$format.string($customer.name)</td>
+ </tr>
+ <tr>
+  <td><b>Email</b></td>
+  <td>$format.email($customer.email, "style='{text-decoration:none;}'")</td>
+ </tr>
+ <tr>
+  <td><b>Age</b></td>
+   <td>$format.string($customer.age)</td>
+ </tr>
+ <tr>
+  <td><b>Investments</b></td>
+  <td>$format.string($customer.investments)</td>
+ </tr>
+ <tr>
+  <td><b>Holdings</b></td>
+  <td>$format.currency($customer.holdings)</td>
+ </tr>
+ <tr>
+  <td><b>Date Joined</b></td>
+  <td>$format.date($customer.dateJoined, "dd MMM yyyy")</td>
+ </tr>
+#end
+</table>