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/24 21:34:06 UTC

svn commit: r758004 - in /incubator/click/trunk/click/examples: src/org/apache/click/examples/page/general/ExcelExportPage.java webapp/general/excel-export.htm

Author: sabob
Date: Tue Mar 24 20:34:06 2009
New Revision: 758004

URL: http://svn.apache.org/viewvc?rev=758004&view=rev
Log:
added an ActionLink which exports the excel spreadsheet

Modified:
    incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java
    incubator/click/trunk/click/examples/webapp/general/excel-export.htm

Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java?rev=758004&r1=758003&r2=758004&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java Tue Mar 24 20:34:06 2009
@@ -24,8 +24,11 @@
 
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.click.ActionListener;
+import org.apache.click.Control;
+import org.apache.click.control.ActionLink;
 import org.apache.click.examples.domain.Customer;
-import org.apache.click.examples.page.SpringPage;
+import org.apache.click.examples.page.BorderPage;
 import org.apache.click.util.ClickUtils;
 
 import org.apache.poi.hssf.usermodel.HSSFCell;
@@ -41,14 +44,30 @@
  *
  * @author Malcolm Edgar
  */
-public class ExcelExportPage extends SpringPage {
+public class ExcelExportPage extends BorderPage {
 
     // -------------------------------------------------------- Event Handlers
 
+    public void onInit() {
+        super.onInit();
+
+        ActionLink link = new ActionLink("export");
+        link.setActionListener(new ActionListener() {
+
+            public boolean onAction(Control source) {
+                export();
+                return false;
+            }
+        });
+
+        addControl(link);
+    }
+
     /**
-     * @see org.apache.click.Page#onGet()
+     * Export the spreadsheet.
      */
-    public void onGet() {
+    public void export() {
+
         HttpServletResponse response = getContext().getResponse();
 
         HSSFWorkbook wb = createWorkbook();

Modified: incubator/click/trunk/click/examples/webapp/general/excel-export.htm
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/general/excel-export.htm?rev=758004&r1=758003&r2=758004&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/webapp/general/excel-export.htm (original)
+++ incubator/click/trunk/click/examples/webapp/general/excel-export.htm Tue Mar 24 20:34:06 2009
@@ -16,3 +16,10 @@
    specific language governing permissions and limitations
    under the License.*#
 -->
+
+This example demonstrates how to create and export an Excel spreadsheet with
+Click. Follow the link below to export the spreadsheet.
+
+<p/>
+
+$export
\ No newline at end of file