portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r552596 - in /portals/jetspeed-2/trunk: applications/demo/src/webapp/WEB-INF/ applications/demo/src/webapp/WEB-INF/demo/groovy/ applications/demo/src/webapp/css/ src/webapp/WEB-INF/pages/
Date Mon, 02 Jul 2007 21:06:59 GMT
Author: ate
Date: Mon Jul  2 14:06:58 2007
New Revision: 552596

URL: http://svn.apache.org/viewvc?view=rev&rev=552596
Log:
JS2-741: More GroovyPortlet demos using the new Portals Bridges GroovyPortlet
See: https://issues.apache.org/jira/browse/JS2-741
Another great contribution from Woonsan!

Added:
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/CustomerPortlet.groovy
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoCustomerPortlet.groovy
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoPage1.gsp
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1.gsp
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1Edit.groovy
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2.gsp
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2Edit.groovy
    portals/jetspeed-2/trunk/applications/demo/src/webapp/css/
    portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css   (with props)
Modified:
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/web.xml
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/CustomerPortlet.groovy
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/CustomerPortlet.groovy?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/CustomerPortlet.groovy
(added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/CustomerPortlet.groovy
Mon Jul  2 14:06:58 2007
@@ -0,0 +1,171 @@
+/*
+ * 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.jetspeed.demo.customerInfo;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
+ * @version $Id: CustomerPortlet.java 516448 2007-03-09 16:25:47Z ate $
+ */
+public class CustomerPortlet extends org.apache.portals.bridges.common.GenericServletPortlet
+{
+    
+    private List defaultCustomers = new ArrayList();
+    
+    /** Creates a new instance of CustomerPortlet */
+    public CustomerPortlet()
+    {
+    }
+    
+    
+    public void init()
+    {
+        CustomerInfo newCustomer = null;
+        Address newAddress = null;
+        
+        // Initialize the defaultCustomer
+        newCustomer = new CustomerInfo();
+        newCustomer.setName("Jane Doe");
+        
+        newCustomer.setLastOrdered(new GregorianCalendar(2002,05,15));
+        newAddress = new Address();
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("124 Main Street");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setBillingAddress(newAddress);
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("1862 Elm Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setShippingAddress(newAddress);
+        this.defaultCustomers.add(newCustomer);
+        
+        newCustomer = new CustomerInfo();
+        newCustomer.setName("Fred Smith");
+        newCustomer.setLastOrdered(new GregorianCalendar(2002,9,15));
+        newAddress = new Address();
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("1 Bearch Way");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setBillingAddress(newAddress);
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("1862 Elm Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setShippingAddress(newAddress);
+        this.defaultCustomers.add(newCustomer);
+
+        newCustomer = new CustomerInfo();
+        newCustomer.setName("Wallace George");
+        newCustomer.setLastOrdered(new GregorianCalendar(2003,1,1));
+        newAddress = new Address();
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("73 Wamack Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setBillingAddress(newAddress);
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("73 Wamack Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setShippingAddress(newAddress);
+        this.defaultCustomers.add(newCustomer);
+}
+    
+    /**
+     * Execute the servlet as define by the init parameter or preference PARAM_ACTION_PAGE.
 The value
+     * if the parameter is a relative URL, i.e. /actionPage.jsp will execute the
+     * JSP editPage.jsp in the portlet application's web app.  The action should
+     * not generate any content.  The content will be generate by doCustom(),
+     * doHelp() , doEdit(), or doView().
+     *
+     * See section PLT.16.2 of the JSR 168 Portlet Spec for more information
+     * around executing a servlet or JSP in processAction()
+     *
+     * @see javax.portlet.GenericPortlet#processAction
+     *
+     * @task Need to be able to execute a servlet for the action
+     * @task Need to set current customer and customer detail item
+     *       in the session.
+     *
+     */
+    public void processAction(ActionRequest request, ActionResponse actionResponse)
+    {
+
+    }
+    
+    
+    /**
+     * Execute the servlet as define by the init parameter or preference PARAM_VIEW_PAGE.
+     * The value if the parameter is a relative URL, i.e. /viewPage.jsp will execute the
+     * JSP viewPage.jsp in the portlet application's web app.
+     *
+     * @see javax.portlet.GenericPortlet#doView
+     *
+     */
+    public void doView(RenderRequest request, RenderResponse response)
+    {
+        List customerList = null;
+        // Get the current customer list from the session
+        PortletSession portletSession = request.getPortletSession();
+        if (portletSession != null)
+        {
+            customerList = (List) portletSession.getAttribute("CustomerList", PortletSession.APPLICATION_SCOPE);
+            if (customerList == null)
+            {
+                customerList = this.defaultCustomers;
+                portletSession.setAttribute("CustomerList", this.defaultCustomers, PortletSession.APPLICATION_SCOPE);
   
+            }
+        }
+        
+        else
+        {
+            // TODO:  the portletSession == null?
+            System.out.println("In org.apache.demo.customerInfo.CustomerPortlet.doView()
- The portletSession == null !!!!");
+        }
+        
+        // If no customer list exists, use the default.
+        if (customerList == null)
+        {
+            customerList = this.defaultCustomers;
+        }
+        
+        // Place the customer list in the request context.
+        request.setAttribute("CustomerList", customerList);
+        super.doView(request, response);
+    }
+    
+}

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoCustomerPortlet.groovy
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoCustomerPortlet.groovy?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoCustomerPortlet.groovy
(added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoCustomerPortlet.groovy
Mon Jul  2 14:06:58 2007
@@ -0,0 +1,198 @@
+/*
+ * 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.jetspeed.demo.customerInfo;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.portlet.PortletHeaderResponse;
+import org.apache.jetspeed.portlet.SupportsHeaderPhase;
+
+/**
+ * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
+ * @version $Id: CustomerPortlet.java 516448 2007-03-09 16:25:47Z ate $
+ */
+public class DojoCustomerPortlet extends org.apache.portals.bridges.common.GenericServletPortlet
+    implements SupportsHeaderPhase
+{
+    
+    private List defaultCustomers = new ArrayList();
+    
+    /** Creates a new instance of CustomerPortlet */
+    public DojoCustomerPortlet()
+    {
+    }
+    
+    
+    public void init()
+    {
+        CustomerInfo newCustomer = null;
+        Address newAddress = null;
+        
+        // Initialize the defaultCustomer
+        newCustomer = new CustomerInfo();
+        newCustomer.setName("Jane Doe");
+        
+        newCustomer.setLastOrdered(new GregorianCalendar(2002,05,15));
+        newAddress = new Address();
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("124 Main Street");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setBillingAddress(newAddress);
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("1862 Elm Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setShippingAddress(newAddress);
+        this.defaultCustomers.add(newCustomer);
+        
+        newCustomer = new CustomerInfo();
+        newCustomer.setName("Fred Smith");
+        newCustomer.setLastOrdered(new GregorianCalendar(2002,9,15));
+        newAddress = new Address();
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("1 Bearch Way");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setBillingAddress(newAddress);
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("1862 Elm Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setShippingAddress(newAddress);
+        this.defaultCustomers.add(newCustomer);
+
+        newCustomer = new CustomerInfo();
+        newCustomer.setName("Wallace George");
+        newCustomer.setLastOrdered(new GregorianCalendar(2003,1,1));
+        newAddress = new Address();
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("73 Wamack Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setBillingAddress(newAddress);
+        newAddress.setName(newCustomer.getName());
+        newAddress.setStreet("73 Wamack Drive");
+        newAddress.setCity("AnyTown");
+        newAddress.setState("ME");
+        newAddress.setCountry("U.S.A.");
+        newCustomer.setShippingAddress(newAddress);
+        this.defaultCustomers.add(newCustomer);
+    }
+
+    public void doHeader(PortletHeaderRequest request, PortletHeaderResponse response)
+    {
+        // use header resource component to ensure header logic is included only once
+        HeaderResource headerResource = response.getHeaderResource();
+        headerResource.dojoEnable();
+        
+        headerResource.dojoAddCoreLibraryRequire( "dojo.lang.*" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.event.*" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.io.*" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.*" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.LayoutContainer" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.ContentPane" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.SplitContainer" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.TabContainer" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.Checkbox" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.Dialog" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.Button" );
+        headerResource.dojoAddCoreLibraryRequire( "dojo.widget.Menu2" );
+        headerResource.dojoAddModuleLibraryRequire( "jetspeed.widget.EditorTable" );
+    }
+     
+    /**
+     * Execute the servlet as define by the init parameter or preference PARAM_ACTION_PAGE.
 The value
+     * if the parameter is a relative URL, i.e. /actionPage.jsp will execute the
+     * JSP editPage.jsp in the portlet application's web app.  The action should
+     * not generate any content.  The content will be generate by doCustom(),
+     * doHelp() , doEdit(), or doView().
+     *
+     * See section PLT.16.2 of the JSR 168 Portlet Spec for more information
+     * around executing a servlet or JSP in processAction()
+     *
+     * @see javax.portlet.GenericPortlet#processAction
+     *
+     * @task Need to be able to execute a servlet for the action
+     * @task Need to set current customer and customer detail item
+     *       in the session.
+     *
+     */
+    public void processAction(ActionRequest request, ActionResponse actionResponse)
+    {
+
+    }
+    
+    
+    /**
+     * Execute the servlet as define by the init parameter or preference PARAM_VIEW_PAGE.
+     * The value if the parameter is a relative URL, i.e. /viewPage.jsp will execute the
+     * JSP viewPage.jsp in the portlet application's web app.
+     *
+     * @see javax.portlet.GenericPortlet#doView
+     *
+     */
+    public void doView(RenderRequest request, RenderResponse response)
+    {
+        List customerList = null;
+        // Get the current customer list from the session
+        PortletSession portletSession = request.getPortletSession();
+        if (portletSession != null)
+        {
+            customerList = (List) portletSession.getAttribute("CustomerList", PortletSession.APPLICATION_SCOPE);
+            if (customerList == null)
+            {
+                customerList = this.defaultCustomers;
+                portletSession.setAttribute("CustomerList", this.defaultCustomers, PortletSession.APPLICATION_SCOPE);
   
+            }
+        }
+        
+        else
+        {
+            // TODO:  the portletSession == null?
+            System.out.println("In org.apache.demo.customerInfo.CustomerPortlet.doView()
- The portletSession == null !!!!");
+        }
+        
+        // If no customer list exists, use the default.
+        if (customerList == null)
+        {
+            customerList = this.defaultCustomers;
+        }
+        
+        // Place the customer list in the request context.
+        request.setAttribute("CustomerList", customerList);
+        super.doView(request, response);
+    }
+    
+}

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoPage1.gsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoPage1.gsp?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoPage1.gsp
(added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/DojoPage1.gsp
Mon Jul  2 14:06:58 2007
@@ -0,0 +1,104 @@
+<%/*
+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.
+*/%>
+<%
+import java.text.DateFormat
+
+def renderRequest = request.getAttribute("javax.portlet.request")
+def renderResponse = request.getAttribute("javax.portlet.response")
+
+def bundle = ResourceBundle.getBundle("org.apache.jetspeed.demo.customerInfo.resources.CustomerListResources")
+def df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, request.locale);
+%>
+
+<div dojoType="LayoutContainer" layoutChildPriority="left-right" style="width: 100%">
+
+  <%=bundle.getString("page1.label.HelloFromPage1WithTaglib")%><br>
+
+  <div id="mainTabContainer" dojoType="TabContainer" selectedChild="customers-renderRequest"
doLayout="false">
+
+    <div id="customers-renderRequest" dojoType="ContentPane" label="List 1">
+
+      <div class="tableContainer">
+        <table dojoType="SortableTable" widgetId="customersTable1" headClass="fixedHeader"
tbodyClass="scrollContent" enableMultipleSelect="true" enableAlternateRows="true" rowAlternateClass="alternateRow"
templateCssPath="/demo/css/demo.css" cellpadding="0" cellspacing="0" border="0">
+          <col width="40%"></col>
+          <col width="60%"></col>
+          <thead>
+            <tr>
+              <th field="custName" dataType="String"><%=bundle.getString("page1.label.CustomerName")%></th>
+              <th field="orderDate" dataType="String"><%=bundle.getString("page1.label.DateOfLastOrder")%></th>
+            </tr>
+          </thead>
+          <tbody>
+            <%
+            def customerList = renderRequest.getAttribute("CustomerList")
+            for (customer in customerList)
+            {
+            %>
+            <tr>
+              <td>${customer.name}</td>
+              <td><%=df.format(customer.lastOrderedAsDate)%></td>
+            </tr>
+            <%
+            }
+            %>
+          </tbody>
+        </table>
+        
+      </div>
+      
+    </div>
+    
+    <div id="customers-request" dojoType="ContentPane" label="List 2">
+
+      <div class="tableContainer">
+
+        <table dojoType="SortableTable" widgetId="customersTable2" headClass="fixedHeader"
tbodyClass="scrollContent" enableMultipleSelect="true" enableAlternateRows="true" rowAlternateClass="alternateRow"
templateCssPath="/demo/css/demo.css" cellpadding="0" cellspacing="0" border="0">
+          <col width="40%"></col>
+          <col width="60%"></col>
+          <thead>
+            <tr>
+              <th field="custName" dataType="String"><%=bundle.getString("page1.label.CustomerName")%></th>
+              <th field="orderDate" dataType="String"><%=bundle.getString("page1.label.DateOfLastOrder")%></th>
+            </tr>
+          </thead>
+          <tbody>
+            <%
+            customerList = request.getAttribute("CustomerList");
+            for (customer in customerList)
+            {
+            %>
+            <tr>
+              <td>${customer.name}</td>
+              <td><%=df.format(customer.lastOrderedAsDate)%></td>
+            </tr>
+            <%
+            }
+            %>          
+          </tbody>
+        </table>
+        
+      </div>
+      
+    </div>
+    
+  </div>
+  
+  <p>
+    <%=bundle.getString("page1.label.NoteTheAboveListShouldMatch")%>
+  </p>
+  
+</div>

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1.gsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1.gsp?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1.gsp (added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1.gsp Mon
Jul  2 14:06:58 2007
@@ -0,0 +1,70 @@
+<%/*
+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.
+*/%>
+<%
+import java.text.DateFormat
+
+def renderRequest = request.getAttribute("javax.portlet.request")
+def renderResponse = request.getAttribute("javax.portlet.response")
+
+def bundle = ResourceBundle.getBundle("org.apache.jetspeed.demo.customerInfo.resources.CustomerListResources")
+def df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, request.locale);
+%>
+
+<div>
+  <%=bundle.getString("page1.label.HelloFromPage1WithTaglib")%><br>
+  <table width="100%">
+    <tr bgcolor="lightgray">
+      <th><%=bundle.getString("page1.label.CustomerName")%></th>
+      <th><%=bundle.getString("page1.label.DateOfLastOrder")%></th>
+    </tr>
+    <%
+    def customerList = renderRequest.getAttribute("CustomerList")
+    for (customer in customerList)
+    {
+    %>
+    <tr>
+      <td>${customer.name}</td>
+      <td><%=df.format(customer.lastOrderedAsDate)%></td>
+    </tr>
+    <%
+    }
+    %>
+    <tr>
+      <td colspan="2" align="center"><%=bundle.getString("page1.label.EndOfListInRequest")%></td>
+    </tr>
+    
+    <%
+    customerList = request.getAttribute("CustomerList");
+    for (customer in customerList)
+    {
+    %>
+    <tr>
+      <td>${customer.name}</td>
+      <td><%=df.format(customer.lastOrderedAsDate)%></td>
+    </tr>
+    <%
+    }
+    %>    
+    
+    <tr>
+      <td colspan="2" align="center"><%=bundle.getString("page1.label.EndOfListInRenderRequest")%></td>
+    </tr>
+  </table>
+  <p>
+    <%=bundle.getString("page1.label.NoteTheAboveListShouldMatch")%>
+  </p>
+</div>

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1Edit.groovy
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1Edit.groovy?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1Edit.groovy
(added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page1Edit.groovy
Mon Jul  2 14:06:58 2007
@@ -0,0 +1,25 @@
+/*
+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.
+*/
+def bundle = ResourceBundle.getBundle("org.apache.jetspeed.demo.customerInfo.resources.CustomerListResources")
+
+def message = bundle.getString("page1Edit.label.ThisWillBeEditMode")
+
+println """
+<div>
+${message}<br>
+</div>
+"""

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2.gsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2.gsp?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2.gsp (added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2.gsp Mon
Jul  2 14:06:58 2007
@@ -0,0 +1,57 @@
+<%/*
+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.
+*/%>
+<%
+import java.text.DateFormat
+
+def renderRequest = request.getAttribute("javax.portlet.request")
+def renderResponse = request.getAttribute("javax.portlet.response")
+
+def bundle = ResourceBundle.getBundle("org.apache.jetspeed.demo.customerInfo.resources.CustomerInfoResources")
+def df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, request.locale);
+%>
+
+<div>
+  <%=bundle.getString("page2.label.HelloFromPage2")%><br>
+  <%
+  def customerList = renderRequest.getAttribute("CustomerList")
+  def currentCustomer = renderRequest.getAttribute("CurrentCustomer")
+  
+  if (currentCustomer == null) {
+    currentCustomer = customerList.get(0)
+  }
+  %>
+  <table>
+    <tr>
+      <td><%=bundle.getString("page2.label.CustomerName")%></td>
+      <td><%=bundle.getString("page2.label.sepa")%></td>
+      <td>${currentCustomer.name}</td>
+    </tr>
+    <tr>
+      <td><%=bundle.getString("page2.label.LastOrdered")%></td>
+      <td><%=bundle.getString("page2.label.sepa")%></td>
+      <td><%=df.format(currentCustomer.lastOrderedAsDate)%></td>
+    </tr>
+  </table>
+  <ul>
+    <% if (currentCustomer.billingAddress != null) { %>
+    <li><%=bundle.getString("page2.label.ShowBillingAddressInCustomerDetailWindow")%></li>
+    <% } %>
+    <% if (currentCustomer.shippingAddress != null) { %>
+    <li><%=bundle.getString("page2.label.ShowShippingAddressInCustomerDetailWindow")%></li>
+    <% } %>
+  </ul> 
+ </div>

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2Edit.groovy
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2Edit.groovy?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2Edit.groovy
(added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/Page2Edit.groovy
Mon Jul  2 14:06:58 2007
@@ -0,0 +1,25 @@
+/*
+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.
+*/
+def bundle = ResourceBundle.getBundle("org.apache.jetspeed.demo.customerInfo.resources.CustomerInfoResources")
+
+def message = bundle.getString("page2Edit.label.ThisWillBeEditModeForTheCustomerInfoPortlet")
+
+println """
+<div>
+${message}<br>
+</div>
+"""

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml?view=diff&rev=552596&r1=552595&r2=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml Mon Jul  2 14:06:58
2007
@@ -1148,6 +1148,141 @@
         </portlet-preferences>
     </portlet>
 
+    <portlet id="GroovyCustomerList">
+        <description>Custom List is a part of a simple tutorial for inter-portlet
+            communication using the portlet session. Use with Customer Detail and Customer
+            Info portlets</description>
+        <portlet-name>GroovyCustomerList</portlet-name>
+        <display-name>Groovy Customer List</display-name>
+        <portlet-class>
+            org.apache.portals.bridges.groovy.GroovyPortlet</portlet-class>
+        <init-param>
+            <name>script-source</name>
+            <value>/WEB-INF/demo/groovy/CustomerPortlet.groovy</value>
+        </init-param>
+        <init-param>
+            <name>auto-refresh</name>
+            <value>true</value>
+        </init-param>
+        <init-param>
+            <name>ViewPage</name>
+            <value>/WEB-INF/demo/groovy/Page1.gsp</value>
+        </init-param>
+        <init-param>
+            <name>EditPage</name>
+            <value>/WEB-INF/demo/groovy/Page1Edit.groovy</value>
+        </init-param>
+        <init-param>
+            <name>portlet-icon</name>
+            <value>x-office-spreadsheet.png</value>
+        </init-param>
+        <expiration-cache>0</expiration-cache>
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+            <portlet-mode>EDIT</portlet-mode>
+        </supports>
+        <supported-locale>en</supported-locale>
+        <supported-locale>ja</supported-locale>
+        <resource-bundle>
+            org.apache.jetspeed.demo.customerInfo.resources.CustomerListResources</resource-bundle>
+        <portlet-info>
+            <title>Groovy Customer List</title>
+            <short-title>List</short-title>
+            <keywords>demo,tutorial,programming,customer,session</keywords>
+        </portlet-info>
+    </portlet>
+    
+    <portlet id="GroovyCustomerInfo">
+        <description>Custom Info is a part of a simple tutorial for inter-portlet
+            communication using the portlet session. Use with Customer List and Customer
+            Info portlets.</description>
+        <portlet-name>GroovyCustomerInfo</portlet-name>
+        <display-name>Groovy Customer Information</display-name>
+        <portlet-class>
+            org.apache.portals.bridges.groovy.GroovyPortlet</portlet-class>
+        <init-param>
+            <name>script-source</name>
+            <value>/WEB-INF/demo/groovy/CustomerPortlet.groovy</value>
+        </init-param>
+        <init-param>
+            <name>auto-refresh</name>
+            <value>true</value>
+        </init-param>
+        <init-param>
+            <name>ViewPage</name>
+            <value>/WEB-INF/demo/groovy/Page2.gsp</value>
+        </init-param>
+        <init-param>
+            <name>EditPage</name>
+            <value>/WEB-INF/demo/groovy/Page2Edit.groovy</value>
+        </init-param>
+        <init-param>
+            <name>portlet-icon</name>
+            <value>x-office-spreadsheet.png</value>
+        </init-param>
+        <expiration-cache>0</expiration-cache>
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+            <portlet-mode>EDIT</portlet-mode>
+        </supports>
+        <supported-locale>en</supported-locale>
+        <supported-locale>ja</supported-locale>
+        <resource-bundle>
+            org.apache.jetspeed.demo.customerInfo.resources.CustomerInfoResources</resource-bundle>
+        <portlet-info>
+            <title>Groovy Customer Information</title>
+            <short-title>Info</short-title>
+            <keywords>demo,tutorial,programming,customer</keywords>
+        </portlet-info>
+    </portlet>
+    
+    <portlet id="GroovyDojoCustomerList">
+        <description>Custom List is a part of a simple tutorial for inter-portlet
+            communication using the portlet session. Use with Customer Detail and Customer
+            Info portlets</description>
+        <portlet-name>GroovyDojoCustomerList</portlet-name>
+        <display-name>Groovy Dojo Customer List</display-name>
+        <portlet-class>
+            org.apache.portals.bridges.groovy.GroovyPortletHeaderPhaseSupport</portlet-class>
+        <init-param>
+            <name>script-source</name>
+            <value>/WEB-INF/demo/groovy/DojoCustomerPortlet.groovy</value>
+        </init-param>
+        <init-param>
+            <name>auto-refresh</name>
+            <value>true</value>
+        </init-param>
+        <init-param>
+            <name>ViewPage</name>
+            <value>/WEB-INF/demo/groovy/DojoPage1.gsp</value>
+        </init-param>
+        <init-param>
+            <name>EditPage</name>
+            <value>/WEB-INF/demo/groovy/Page1Edit.groovy</value>
+        </init-param>
+        <init-param>
+            <name>portlet-icon</name>
+            <value>x-office-spreadsheet.png</value>
+        </init-param>
+        <expiration-cache>0</expiration-cache>
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+            <portlet-mode>EDIT</portlet-mode>
+        </supports>
+        <supported-locale>en</supported-locale>
+        <supported-locale>ja</supported-locale>
+        <resource-bundle>
+            org.apache.jetspeed.demo.customerInfo.resources.CustomerListResources</resource-bundle>
+        <portlet-info>
+            <title>Groovy Dojo Customer List</title>
+            <short-title>List</short-title>
+            <keywords>demo,tutorial,programming,customer,session</keywords>
+        </portlet-info>
+    </portlet>
+    
     <portlet id="NoopPortlet">
         <description>This is a "do nothing" portlet, primarily for test and profiling
purposes</description>
         <portlet-name>NoopPortlet</portlet-name>

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/web.xml?view=diff&rev=552596&r1=552595&r2=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/web.xml (original)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/web.xml Mon Jul  2 14:06:58
2007
@@ -51,6 +51,18 @@
 		</init-param>
 		<load-on-startup>10</load-on-startup>
 	</servlet>
+    
+    <!-- Define Groovlet Servlet -->
+    <servlet>
+      <servlet-name>Groovlet</servlet-name>
+      <servlet-class>groovy.servlet.GroovyServlet</servlet-class>
+    </servlet>
+    
+    <!-- Define Groovy Template Servlet -->
+    <servlet>
+        <servlet-name>Template</servlet-name>
+        <servlet-class>groovy.servlet.TemplateServlet</servlet-class>
+    </servlet>
 
   <servlet>
     <servlet-name>SSODemo</servlet-name>
@@ -92,6 +104,18 @@
 		<servlet-name>velocity</servlet-name>
 		<url-pattern>*.vm</url-pattern>
 	</servlet-mapping>	
+    
+    <!-- Map *.groovy to Groovlet -->
+    <servlet-mapping>
+        <servlet-name>Groovlet</servlet-name>
+        <url-pattern>*.groovy</url-pattern>
+    </servlet-mapping>
+    
+    <!-- Map *.gsp to Groovy Template -->
+    <servlet-mapping>
+        <servlet-name>Template</servlet-name>
+        <url-pattern>*.gsp</url-pattern>
+    </servlet-mapping>
 
   <servlet-mapping>
      <servlet-name>

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css?view=auto&rev=552596
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css (added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css Mon Jul  2 14:06:58
2007
@@ -0,0 +1,101 @@
+/*
+* 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.
+*/
+        .dojoDialog {
+            background : #eee;
+            border : 1px solid #999;
+            -moz-border-radius : 5px;
+            padding : 4px;
+            width: 320px;
+        }
+
+        .buttonbox {
+            display: block;
+            text-align: center;
+        }
+        .buttonbox .dojoButton {
+            float: left;
+            margin-right: 10px;
+            margin-bottom: 6px;
+		}
+
+        .buttonboxright {
+            display: block;
+            text-align: center;
+        }
+        .buttonboxright .dojoButton {
+            float: right;
+            margin-left: 10px;
+            margin-bottom: 6px;
+		}
+
+		.permissions {
+			font-family:Lucida Grande, Verdana;
+			font-size:0.8em;
+			width:100%;
+			border:1px solid #ccc;
+			cursor:default;
+		}
+
+        #mainTabContainer {
+            width: 100%;
+            height: 304px;
+        }
+
+		* html div.tableContainer {	/* IE only hack */
+			width: 95%;
+			border: 1px solid #ccc;
+			height: 285px;
+			overflow-x: hidden;
+			overflow-y: auto;
+		}
+		
+		* html div.tableContainer table thead tr td,
+		* html div.tableContainer table thead tr th{
+			/* IE Only hacks */
+			position:relative;
+			top:expression(dojo.html.getFirstAncestorByTag(this,'table').parentNode.scrollTop-2);
+		}
+		
+        
+		html>body tbody.scrollContent {
+			height: 262px;
+			overflow-x: hidden;
+			overflow-y: auto;
+		}
+
+		tbody.scrollContent td, tbody.scrollContent tr td {
+			background: #FFF;
+			padding: 2px;
+		}
+
+		tbody.scrollContent tr.alternateRow td {
+			background: #e3edfa;
+			padding: 2px;
+		}
+
+		tbody.scrollContent tr.selected td {
+			background: yellow;
+			padding: 2px;
+		}
+		tbody.scrollContent tr:hover td {
+			background: #a6c2e7;
+			padding: 2px;
+		}
+		tbody.scrollContent tr.selected:hover td {
+			background: #ff3;
+			padding: 2px;
+		}

Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/css/demo.css
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml?view=diff&rev=552596&r1=552595&r2=552596
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml Mon Jul  2 14:06:58 2007
@@ -28,6 +28,18 @@
       <property layout="TwoColumns" name="row" value="0" />
       <property layout="TwoColumns" name="column" value="0" />
     </fragment>
+    <fragment id="groovy-3" type="portlet" name="demo::GroovyCustomerList" >
+      <property layout="TwoColumns" name="row" value="0" />
+      <property layout="TwoColumns" name="column" value="1" />
+    </fragment>
+    <fragment id="groovy-4" type="portlet" name="demo::GroovyCustomerInfo" >
+      <property layout="TwoColumns" name="row" value="1" />
+      <property layout="TwoColumns" name="column" value="1" />
+    </fragment>
+    <fragment id="groovy-5" type="portlet" name="demo::GroovyDojoCustomerList" >
+      <property layout="TwoColumns" name="row" value="1" />
+      <property layout="TwoColumns" name="column" value="0" />
+    </fragment>
   </fragment>
   
   <security-constraints>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message