[portal-commits] JBoss Portal SVN: r8967 - in branches/JBoss_Portal_Branch_2_6: build/ide/intellij/idea60/modules/core-samples and 2 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Fri Nov 16 05:33:37 EST 2007


Author: julien at jboss.com
Date: 2007-11-16 05:33:37 -0500 (Fri, 16 Nov 2007)
New Revision: 8967

Added:
   branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java
Modified:
   branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
   branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml
   branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
   branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
   branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
added basic sample that show how the portlet window id

Modified: branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml	2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml	2007-11-16 10:33:37 UTC (rev 8967)
@@ -108,6 +108,15 @@
       </library>
     </orderEntry>
     <orderEntry type="module" module-name="server" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
     <orderEntryProperties />
   </component>
   <component name="VcsManagerConfiguration">

Modified: branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml	2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml	2007-11-16 10:33:37 UTC (rev 8967)
@@ -59,6 +59,15 @@
         <SOURCES />
       </library>
     </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
     <orderEntryProperties />
   </component>
   <component name="VcsManagerConfiguration">

Added: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java	                        (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java	2007-11-16 10:33:37 UTC (rev 8967)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.core.samples.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowIDPortlet extends GenericPortlet
+{
+
+   protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+   {
+      PortletSession session = request.getPortletSession();
+      WindowIDRetriever retriever = (WindowIDRetriever)session.getAttribute("retriever");
+      if (retriever == null)
+      {
+         retriever = new WindowIDRetriever();
+         session.setAttribute("retriever", retriever);
+      }
+      String windowID = retriever.getWindowID();
+
+      //
+      response.setContentType("text/html");
+      PrintWriter writer = response.getWriter();
+      writer.print("Window ID is equals to " + windowID);
+   }
+
+   public static class WindowIDRetriever implements HttpSessionBindingListener
+   {
+
+      /** . */
+      private String windowID;
+
+      public void valueBound(HttpSessionBindingEvent event)
+      {
+         String name = event.getName();
+         windowID = name.substring("javax.portlet.p.".length(), name.indexOf('?'));
+      }
+
+      public void valueUnbound(HttpSessionBindingEvent event)
+      {
+      }
+
+      public String getWindowID()
+      {
+         return windowID;
+      }
+   }
+}

Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml	2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml	2007-11-16 10:33:37 UTC (rev 8967)
@@ -308,6 +308,21 @@
                <height>0</height>
             </window>
          </page>
+         <page>
+            <page-name>window id test</page-name>
+            <window>
+               <window-name>CatalogPortletWindow</window-name>
+               <instance-ref>CatalogPortletInstance</instance-ref>
+               <region>left</region>
+               <height>0</height>
+            </window>
+            <window>
+               <window-name>WindowIDPortletWindow</window-name>
+               <instance-ref>WindowIDPortletInstance</instance-ref>
+               <region>center</region>
+               <height>0</height>
+            </window>
+         </page>
       </page>
    </deployment>
    <deployment>
@@ -591,6 +606,21 @@
                <height>0</height>
             </window>
          </page>
+         <page>
+            <page-name>window id test</page-name>
+            <window>
+               <window-name>CatalogPortletWindow</window-name>
+               <instance-ref>CatalogPortletInstance</instance-ref>
+               <region>left</region>
+               <height>0</height>
+            </window>
+            <window>
+               <window-name>WindowIDPortletWindow</window-name>
+               <instance-ref>WindowIDPortletInstance</instance-ref>
+               <region>center</region>
+               <height>0</height>
+            </window>
+         </page>
       </page>
    </deployment>
 </deployments>

Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml	2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml	2007-11-16 10:33:37 UTC (rev 8967)
@@ -151,4 +151,10 @@
          <portlet-ref>FormAutoSubmitPortlet</portlet-ref>
       </instance>
    </deployment>
+   <deployment>
+      <instance>
+         <instance-id>WindowIDPortletInstance</instance-id>
+         <portlet-ref>WindowIDPortlet</portlet-ref>
+      </instance>
+   </deployment>
 </deployments>
\ No newline at end of file

Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml	2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml	2007-11-16 10:33:37 UTC (rev 8967)
@@ -335,10 +335,24 @@
          <portlet-mode>VIEW</portlet-mode>
       </supports>
       <portlet-info>
-         <title>Auto submit</title>
+         <title>Auto submit Portlet</title>
          <keywords>sample,test</keywords>
       </portlet-info>
    </portlet>
+   <portlet>
+      <description>Portlet which displays the window ID</description>
+      <portlet-name>WindowIDPortlet</portlet-name>
+      <display-name>Window ID Portlet</display-name>
+      <portlet-class>org.jboss.portal.core.samples.basic.WindowIDPortlet</portlet-class>
+      <supports>
+         <mime-type>text/html</mime-type>
+         <portlet-mode>VIEW</portlet-mode>
+      </supports>
+      <portlet-info>
+         <title>Window ID Portlet</title>
+         <keywords>sample,test</keywords>
+      </portlet-info>
+   </portlet>
    <custom-portlet-mode>
       <name>ADMIN</name>
    </custom-portlet-mode>




More information about the portal-commits mailing list