You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2009/04/17 20:46:25 UTC

svn commit: r766113 - in /portals/jetspeed-2/applications/j2-admin/trunk/src: main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java webapp/WEB-INF/portlet.xml webapp/WEB-INF/view/selectors/category-portlet-header.vm

Author: woonsan
Date: Fri Apr 17 18:46:24 2009
New Revision: 766113

URL: http://svn.apache.org/viewvc?rev=766113&view=rev
Log:
APA-8: Now continuing to complete head contribution. Again using portlet 2.0 api only in j2-admin for dojo-enabled portlets.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java?rev=766113&r1=766112&r2=766113&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java Fri Apr 17 18:46:24 2009
@@ -23,10 +23,6 @@
 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;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
 import org.apache.portals.gems.dojo.DojoPortletHelper;
@@ -34,11 +30,10 @@
 /**
  * Extending AbstractDojoVelocityPortlet because admin portlets can use jetspeed-api
  * to detect the portal webapp context path.
- * FIXME: Use portlet 2.0 head contribution API only.
  * 
  * @version $Id$
  */
-public abstract class AbstractAdminDojoVelocityPortlet extends AbstractDojoVelocityPortlet implements SupportsHeaderPhase
+public abstract class AbstractAdminDojoVelocityPortlet extends AbstractDojoVelocityPortlet
 {
     
     protected static final String DOJO_JS_RELATIVE_URL_INIT_PARAM = "dojo.js.relative.url";
@@ -60,88 +55,45 @@
         this.dojoJsRelativeUrl = getInitParameter(DOJO_JS_RELATIVE_URL_INIT_PARAM);
     }
     
-    /**
-     * Include Dojo and Turbo header content using header resource component.
-     *
-     * @param request render request
-     * @param response render response
-     */
-    @Deprecated
-    public void doHeader( PortletHeaderRequest request, PortletHeaderResponse response )
-    throws PortletException
+    @Override
+    protected void doHeaders(RenderRequest request, RenderResponse response)
     {
-        // use header resource component to ensure header logic is included only once
-        HeaderResource headerResource = response.getHeaderResource();
+        if (this.dojoJsRelativeUrl != null)
+        {
+            RequestContext requestContext = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
+            String portalContextPath = requestContext.getRequest().getContextPath();
+            DojoPortletHelper.enableDojo(response, portalContextPath + this.dojoJsRelativeUrl);
+        }
+        else
+        {
+            DojoPortletHelper.enableDojo(response, this.dojoJsUrl);
+        }
+        
+        if (this.headerPage != null)
+        {
+            try
+            {
+                this.getPortletContext().getRequestDispatcher(this.headerPage).include(request, response);
+            }
+            catch (PortletException e)
+            {
+                throw new RuntimeException("Failed to include header page.", e);
+            }
+            catch (IOException e)
+            {
+                throw new RuntimeException("Failed to include header page.", e);
+            }
+        }
 
-        headerResource.dojoEnable();
-        includeHeaderContent( headerResource );
+        if (this.dojoRequiresCoreList != null)
+        {
+            DojoPortletHelper.contributeDojoRequires(response, this.dojoRequiresCoreList);
+        }
         
-        if ( this.headerPage != null )
+        if (this.dojoRequiresAddOnList != null)
         {
-            include( request, response, this.headerPage );
+            DojoPortletHelper.contributeDojoRequires(response, this.dojoRequiresAddOnList);
         }
     }
-    
-    @Deprecated
-    protected void includeHeaderContent( HeaderResource headerResource )
-    {
-        // do nothing - intended for derived classes
-    }
-    
-    @Deprecated
-    protected void include(PortletHeaderRequest request, PortletHeaderResponse response, String headerPagePath, StringBuffer headerText) throws PortletException
-    {
-        response.include(request, response, headerPagePath);
-        headerText.append(response.getContent());
-    }
-    
-    @Deprecated
-    protected void include(PortletHeaderRequest request, PortletHeaderResponse response, String headerPagePath) throws PortletException
-    {
-        response.include(request, response, headerPagePath);
-        response.getHeaderResource().addHeaderInfo(response.getContent());
-    }
-    
-    @Override
-    protected void doHeaders(RenderRequest request, RenderResponse response)
-    {
-        /* FIXME: enable the following by using portlet 2.0 head contribution API */
-//        if (this.dojoJsRelativeUrl != null)
-//        {
-//            RequestContext requestContext = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
-//            String portalContextPath = requestContext.getRequest().getContextPath();
-//            DojoPortletHelper.enableDojo(response, portalContextPath + this.dojoJsRelativeUrl);
-//        }
-//        else
-//        {
-//            DojoPortletHelper.enableDojo(response, this.dojoJsUrl);
-//        }
-//        
-//        if (this.headerPage != null)
-//        {
-//            try
-//            {
-//                this.getPortletContext().getRequestDispatcher(this.headerPage).include(request, response);
-//            }
-//            catch (PortletException e)
-//            {
-//                throw new RuntimeException("Failed to include header page.", e);
-//            }
-//            catch (IOException e)
-//            {
-//                throw new RuntimeException("Failed to include header page.", e);
-//            }
-//        }
-//
-//        if (this.dojoRequiresCoreList != null)
-//        {
-//            DojoPortletHelper.contributeDojoRequires(response, this.dojoRequiresCoreList);
-//        }
-//        
-//        if (this.dojoRequiresAddOnList != null)
-//        {
-//            DojoPortletHelper.contributeDojoRequires(response, this.dojoRequiresAddOnList);
-//        }
-    }
 
 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml?rev=766113&r1=766112&r2=766113&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml Fri Apr 17 18:46:24 2009
@@ -1449,7 +1449,11 @@
     <init-param>
         <name>dojo.requires.core</name>
         <value>dojo.lang.*;dojo.event.*;dojo.io.*;dojo.widget.*;dojo.widget.Tree;dojo.widget.Button;dojo.widget.Checkbox;dojo.widget.Dialog;dojo.widget.TabContainer;dojo.widget.ContentPane;dojo.widget.LayoutContainer</value>
-    </init-param>        
+    </init-param>
+    <init-param>
+        <name>dojo.requires.modules</name>
+        <value>jetspeed.common;jetspeed.selector</value>
+    </init-param>
     <init-param>
         <name>portlet-icon</name>
         <value>portlet-add.png</value>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm?rev=766113&r1=766112&r2=766113&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm Fri Apr 17 18:46:24 2009
@@ -14,124 +14,129 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 *#
-<style>
-.portlet-selector-title
-{    
-    font-size: 9pt;
-        color: blue;
-}
-.portlet-selector-text
-{    
-    font-size: 8pt;
-        color: green;
-}
-.dojoDialog {
-    background : #eee;
-    border : 1px solid #999;
-    -moz-border-radius : 5px;
-    padding : 4px;
-    width: 420px;
-}
-
-.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;
-}
-
-.constraints {
-    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;
-}
-
-.constraints td,
-.constraints th{
-    border-right: 1px solid #999;
-    padding: 2px;
-    font-weight: normal;
-    font-size: small;
-}
-
-.constraints thead td, .constraints thead th {
-    background-image:url(/j2-admin/images/st-head.gif);
-    background-repeat:no-repeat;
-    background-position:top right;
-    font-size: small;
-    font-weight: bold;
-    text-align: left;
-}
-.constraints thead td.selectedUp, .constraints thead th.selectedUp {
-    background-image:url(/j2-admin/images/st-headup.gif);
-}
-.constraints thead td.selectedDown, .constraints thead th.selectedDown {
-    background-image:url(/j2-admin/images/st-headdown.gif);
-}
-
-* 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;
-}
-
-</style>
+#set($styleTextContent = 
+  ".portlet-selector-title "
++ "{ "
++ "    font-size: 9pt; "
++ "        color: blue; "
++ "} "
++ ".portlet-selector-text "
++ "{ "
++ "    font-size: 8pt; "
++ "        color: green; "
++ "} "
++ ".dojoDialog { "
++ "    background : #eee; "
++ "    border : 1px solid #999; "
++ "    -moz-border-radius : 5px; "
++ "    padding : 4px; "
++ "    width: 420px; "
++ "} "
++ " "
++ ".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; "
++ "} "
++ " "
++ ".constraints { "
++ "    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; "
++ "} "
++ " "
++ ".constraints td, "
++ ".constraints th{ "
++ "    border-right: 1px solid #999; "
++ "    padding: 2px; "
++ "    font-weight: normal; "
++ "    font-size: small; "
++ "} "
++ " "
++ ".constraints thead td, .constraints thead th { "
++ "    background-image:url(/j2-admin/images/st-head.gif); "
++ "    background-repeat:no-repeat; "
++ "    background-position:top right; "
++ "    font-size: small; "
++ "    font-weight: bold; "
++ "    text-align: left; "
++ "} "
++ ".constraints thead td.selectedUp, .constraints thead th.selectedUp { "
++ "    background-image:url(/j2-admin/images/st-headup.gif); "
++ "} "
++ ".constraints thead td.selectedDown, .constraints thead th.selectedDown { "
++ "    background-image:url(/j2-admin/images/st-headdown.gif); "
++ "} "
++ " "
++ "* 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; "
++ "}"
+)
+#set($headElem = $renderResponse.createElement("style"))
+#set($headElemDoc = $headElem.ownerDocument)
+#set($styleTextNode = $headElemDoc.createTextNode($styleTextContent))
+#set($result = $headElem.appendChild($styleTextNode))
+#set($result = $headElem.setAttribute("id", "category-portlet-header.vm"))
+#set($result = $renderResponse.addProperty("javax.portlet.markup.head.element", $headElem))



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