portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r393251 - in /portals/jetspeed-2/trunk/applications/demo/src: java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java webapp/WEB-INF/demo/simple/PickANumber.jsp webapp/WEB-INF/jetspeed-portlet.xml webapp/WEB-INF/portlet.xml
Date Tue, 11 Apr 2006 15:50:57 GMT
Author: ate
Date: Tue Apr 11 08:50:52 2006
New Revision: 393251

URL: http://svn.apache.org/viewcvs?rev=393251&view=rev
Log:
JS2-524: Providing a "print" custom PortletMode and a "solo" custom WindowState
Showcase implementation using the PickANumberPortlet from the demo application.
See: http://issues.apache.org/jira/browse/JS2-524

Modified:
    portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/simple/PickANumber.jsp
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml

Modified: portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java?rev=393251&r1=393250&r2=393251&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java
(original)
+++ portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java
Tue Apr 11 08:50:52 2006
@@ -20,11 +20,13 @@
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
 import javax.portlet.PortletPreferences;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletSession;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
 
 import org.apache.portals.bridges.common.GenericServletPortlet;
 
@@ -38,6 +40,8 @@
  */
 public class PickANumberPortlet extends GenericServletPortlet
 {
+    private static final PortletMode PRINT_MODE = new PortletMode("print");
+    
     /**
      * Default action page when preference does not exist
      *
@@ -112,6 +116,24 @@
     }
 
             
+    protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException,
IOException
+    {
+        if ( !request.getWindowState().equals(WindowState.MINIMIZED))
+        {
+            // Handle custom PRINT_MODE ourselves as GenericPortlet nor GenericServletPortlet
do
+            if (PRINT_MODE.equals(request.getPortletMode()))
+            {
+                // simply delegate to doView rendering
+                doView(request, response);
+            }
+            else
+            {
+                super.doDispatch(request, response);
+            }
+        }
+    }
+
+
     public void doView(RenderRequest request, RenderResponse response) throws PortletException,
IOException
     {
         PortletSession session = request.getPortletSession();

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/simple/PickANumber.jsp
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/simple/PickANumber.jsp?rev=393251&r1=393250&r2=393251&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/simple/PickANumber.jsp
(original)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/simple/PickANumber.jsp
Tue Apr 11 08:50:52 2006
@@ -107,6 +107,8 @@
 
 <a href='<%=helpMe%>'>Help</a>
 <a href='<%=editMe%>'>Edit</a>
-<a href='<%=maxMe%>'>Max</a>
-<a href='<%=minMe%>'>Min</a>
-<a href='<%=normalMe%>'>Normal</a>
+<c:if test="${renderRequest.windowState != 'popup'}">
+  <a href='<%=maxMe%>'>Max</a>
+  <a href='<%=minMe%>'>Min</a>
+  <a href='<%=normalMe%>'>Normal</a>
+</c:if>

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml?rev=393251&r1=393250&r2=393251&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml (original)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml Tue
Apr 11 08:50:52 2006
@@ -37,6 +37,11 @@
     <dc:type>Default Type</dc:type>
     <js:metadata name="my_metadata" xml:lang="en">English My_Metadata</js:metadata>
     
+    <!--  map custom "popup" window state to Jetspeed-2 internal "solo" state -->
+    <custom-window-state>
+      <name>popup</name>
+      <mapped-name>solo</mapped-name> 
+    </custom-window-state>
 
     <portlet id="HelloPortlet">
         <portlet-name>HelloPortlet</portlet-name>
@@ -219,4 +224,4 @@
 	    <js:service name='SSO'/>
 	</js:services>
 	
-</portlet-app>
\ No newline at end of file
+</portlet-app>

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml?rev=393251&r1=393250&r2=393251&view=diff
==============================================================================
--- 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 Tue Apr 11 08:50:52
2006
@@ -16,6 +16,16 @@
 -->
 <portlet-app id="demo" version="1.0">
 
+  <custom-window-state>
+    <!--  the custom "popup" window state is mapped to the Jetspeed-2 solo" window state
in jetspeed-portlet.xml --> 
+    <name>popup</name>
+    <description>a Custom Popup State</description> 
+  </custom-window-state>
+  <custom-portlet-mode>
+    <name>print</name>
+    <description>a Custom Print Mode</description> 
+  </custom-portlet-mode>
+
 <portlet id="HelloPortlet">
     <init-param>
       <description>test init param</description>
@@ -206,6 +216,8 @@
       <portlet-mode>VIEW</portlet-mode>
       <portlet-mode>HELP</portlet-mode>
       <portlet-mode>EDIT</portlet-mode>
+      <!--  support custom print mode --> 
+      <portlet-mode>print</portlet-mode>
     </supports>
     <supported-locale>en</supported-locale>
     <supported-locale>fr</supported-locale>



---------------------------------------------------------------------
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