portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r469352 - in /portals/jetspeed-2/trunk/applications/demo/src: java/org/apache/portals/applications/desktop/ webapp/SWF/ webapp/WEB-INF/ webapp/WEB-INF/view/
Date Tue, 31 Oct 2006 03:12:27 GMT
Author: taylor
Date: Mon Oct 30 19:12:26 2006
New Revision: 469352

URL: http://svn.apache.org/viewvc?view=rev&rev=469352
Log:
flash/flex portlet demos

Added:
    portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/portals/applications/desktop/FlashPortlet.java
    portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/
    portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Clock.swf   (with props)
    portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Paycheck_calculator.swf   (with
props)
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/view/flash-demo.vm
Modified:
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml

Added: portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/portals/applications/desktop/FlashPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/portals/applications/desktop/FlashPortlet.java?view=auto&rev=469352
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/portals/applications/desktop/FlashPortlet.java
(added)
+++ portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/portals/applications/desktop/FlashPortlet.java
Mon Oct 30 19:12:26 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.portals.applications.desktop;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
+import org.apache.velocity.context.Context;
+
+public class FlashPortlet extends GenericVelocityPortlet
+{
+    public static final String HEIGHT = "HEIGHT";
+    public static final String WIDTH = "WIDTH";
+    public static final String SRC = "SRC";
+    public static final String MAX_SRC = "MAX-SRC";
+    public static final String MAX_HEIGHT = "MAX-HEIGHT";
+    public static final String MAX_WIDTH = "MAX-WIDTH";
+        
+    public void doView(RenderRequest request, RenderResponse response)
+            throws PortletException, IOException
+    {
+        Context context = super.getContext(request);
+        PortletPreferences prefs = request.getPreferences();        
+        if (request.getWindowState().toString().equals(WindowState.MAXIMIZED.toString()))
+        {
+            context.put(HEIGHT, prefs.getValue(MAX_HEIGHT, "800"));
+            context.put(WIDTH, prefs.getValue(MAX_WIDTH, "600"));
+            String src = prefs.getValue(MAX_SRC, "");
+            if (src.equals(""))
+            {
+                src = prefs.getValue(SRC, "");
+            }
+            context.put(SRC, src);
+            
+        }
+        else
+        {
+            context.put(HEIGHT, prefs.getValue(HEIGHT, "250"));
+            context.put(WIDTH, prefs.getValue(WIDTH, "250"));
+            context.put(SRC, prefs.getValue(SRC, ""));
+                        
+        }
+        super.doView(request, response);
+    }
+    
+    public void doEdit(RenderRequest request, RenderResponse response) throws PortletException,
IOException
+    {
+        response.setContentType("text/html");        
+        doPreferencesEdit(request, response);
+    }    
+
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.bridges.velocity.GenericVelocityPortlet#processAction(javax.portlet.ActionRequest,
javax.portlet.ActionResponse)
+     */
+    public void processAction(ActionRequest request, ActionResponse response) throws PortletException,
IOException
+    {
+        String source = request.getParameter(SRC);
+        String height = request.getParameter(HEIGHT);
+        String width = request.getParameter(WIDTH);
+        String maxSource = request.getParameter(MAX_SRC);
+        String maxHeight = request.getParameter(MAX_HEIGHT);
+        String maxWidth = request.getParameter(MAX_WIDTH);
+        
+        PortletPreferences prefs = request.getPreferences();
+        prefs.setValue(SRC, source);
+        prefs.setValue(HEIGHT, height);
+        prefs.setValue(WIDTH, width);
+        prefs.setValue(MAX_SRC, maxSource);
+        prefs.setValue(MAX_HEIGHT, maxHeight);
+        prefs.setValue(MAX_WIDTH, maxWidth);        
+        prefs.store();
+        super.processAction(request, response);
+    }    
+}
+    
\ No newline at end of file

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Clock.swf
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Clock.swf?view=auto&rev=469352
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Clock.swf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Paycheck_calculator.swf
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Paycheck_calculator.swf?view=auto&rev=469352
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/SWF/Paycheck_calculator.swf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=469352&r1=469351&r2=469352
==============================================================================
--- 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 Oct 30 19:12:26
2006
@@ -869,6 +869,58 @@
 		</preference>
 		</portlet-preferences>
 	</portlet>         
-        
+
+  	<portlet id="flash">
+		<description>Flash and Flex generic portlet</description>
+		<portlet-name>FlashPortlet</portlet-name>
+		<display-name>Flash and Flex</display-name>
+		<portlet-class>org.apache.portals.applications.desktop.FlashPortlet</portlet-class>
+        <init-param>
+            <name>ViewPage</name>
+            <value>/WEB-INF/view/flash-demo.vm</value>
+        </init-param>		        
+        <init-param>
+            <name>EditPage</name>
+            <value>/WEB-INF/view/edit-prefs.vm</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>        
+        <portlet-info>
+           <title>Flash Demo</title>
+           <short-title>Flash</short-title>
+           <keywords>flash,flex,SWF,FLA</keywords>
+        </portlet-info>        
+        <portlet-preferences>
+         <preference>
+            <name>SRC</name>
+            <value>/demo/WEB-INF/SWF/Clock.swf</value>
+         </preference>
+         <preference>
+            <name>HEIGHT</name>
+            <value>305</value>
+         </preference>
+         <preference>
+            <name>WIDTH</name>
+            <value>303</value>
+         </preference>
+         <preference>
+            <name>MAX-SRC</name>
+            <value>/demo/WEB-INF/SWF/Paycheck_calculator.swf</value>
+         </preference>            
+         <preference>
+            <name>MAX-HEIGHT</name>
+            <value>400</value>
+         </preference>
+         <preference>
+            <name>MAX-WIDTH</name>
+            <value>502</value>
+         </preference>          
+      </portlet-preferences>            
+	</portlet>                     
 </portlet-app>
 

Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/view/flash-demo.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/view/flash-demo.vm?view=auto&rev=469352
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/view/flash-demo.vm (added)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/view/flash-demo.vm Mon Oct
30 19:12:26 2006
@@ -0,0 +1,7 @@
+<center>
+    <object width="$!WIDTH" height="$!HEIGHT">
+        <param name="movie" value="$!SRC"/>
+        <embed src="$!SRC" width="$!WIDTH" height="$!HEIGHT"/>
+    </object>
+</center>
+



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