geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r992979 - in /geronimo/server/trunk/plugins: console/console-portal-driver/src/main/i18n-resources/ console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/ console/console-portal-driver/src/main/webapp/WEB-INF/th...
Date Mon, 06 Sep 2010 09:18:00 GMT
Author: genspring
Date: Mon Sep  6 09:17:58 2010
New Revision: 992979

URL: http://svn.apache.org/viewvc?rev=992979&view=rev
Log:
GERONIMO-5516 Add isAdvanced properties to AdminConsoleExtensionGBean.  Patch from janel with
modifications.

Added:
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/js/navigation.js
Modified:
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_en.properties
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_zh.properties
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
    geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
    geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PageConfig.java

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_en.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_en.properties?rev=992979&r1=992978&r2=992979&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_en.properties
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_en.properties
Mon Sep  6 09:17:58 2010
@@ -30,3 +30,5 @@ console.login.welcome                   
 console.login_error.invalid               = Invalid User Name and/or Password!
 console.login_success.loginSuccessful     = Login Successful
 console.login_success.returnToPortalTests = Click here to return to the portal tests.
+console.mode.basic                        = Basic
+console.mode.advanced                     = Advanced

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_zh.properties?rev=992979&r1=992978&r2=992979&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_zh.properties
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/i18n-resources/portaldriver_zh.properties
Mon Sep  6 09:17:58 2010
@@ -30,3 +30,5 @@ console.login.welcome                   
 console.login_error.invalid               = 无效的用户名或密码!
 console.login_success.loginSuccessful     = 登录成功
 console.login_success.returnToPortalTests = 点击这里返回到portal测试页面。
+console.mode.basic                        = 普通
+console.mode.advanced                     = 高级 

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java?rev=992979&r1=992978&r2=992979&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
Mon Sep  6 09:17:58 2010
@@ -86,13 +86,50 @@ public class NavigationJsonGenerator {
             }
 
         }
+        
         //remove the extra ','
-        sb.deleteCharAt(sb.length()-1);
+        if(navigationTree.values().size()>0){
+            sb.deleteCharAt(sb.length()-1);
+        }
+
+        sb.append("\n]");
+        return sb.toString();
+    }
+    public String generateTreeJSON(List<PageConfig> pageConfigList, String contextPath,
String DefaultIcon, String mode) {
+        
+        Map<String, TreeNode> navigationTree = new TreeMap<String, TreeNode>();
+        
+        for (PageConfig pc : pageConfigList) {
+            if(pc.getMode()!=null&&mode.equals(pc.getMode())){
+                try {
+                    new TreeNode(pc).populateTree(navigationTree);
+                } catch (Exception e) {
+                    log.error(e.getMessage(),e);
+                    continue;
+                }
+            }
+        }
+
+        StringBuffer sb = new StringBuffer(10);
+        sb.append("[");
+        
+        
+        for (TreeNode node : navigationTree.values()) {
+
+            if (node.isTopNode()) {
+                sb.append("\n");
+                appendNodeToTreeJSON(sb, node, contextPath, DefaultIcon);
+            }
+
+        }
+        //remove the extra ','
+        if(navigationTree.values().size()>0){
+            sb.deleteCharAt(sb.length()-1);
+        }
 
         sb.append("\n]");
         return sb.toString();
     }
-    
     private void appendNodeToTreeJSON(StringBuffer sb, TreeNode node, String contextPath,
String DefaultIcon) {
 
         sb.append("{");
@@ -158,6 +195,37 @@ public class NavigationJsonGenerator {
         return sb.toString();
     }
 
+    public String generateQuickLauncherJSON(List<PageConfig> pageConfigList, String
contextPath, String DefaultIcon,String mode) {
+        
+        Map<String, TreeNode> navigationTree = new TreeMap<String, TreeNode>();
+        
+        for (PageConfig pc : pageConfigList) {
+            if(pc.getMode()!=null&&mode.equals(pc.getMode())){
+                try {
+                    new TreeNode(pc).populateTree(navigationTree);
+                } catch (Exception e) {
+                    log.error(e.getMessage(),e);
+                    continue;
+                }
+            }
+        }
+
+        StringBuffer sb = new StringBuffer(10);
+        sb.append("[\n");
+        
+        for (TreeNode node : navigationTree.values()) {
+
+            if (node.isTopNode()) {
+                appendNodeToQuickLauncherJSON(sb, node, contextPath, DefaultIcon);
+            }
+
+        }
+        //remove the extra ','
+        sb.deleteCharAt(sb.length()-1);
+
+        sb.append("\n]");
+        return sb.toString();
+    }
     private void appendNodeToQuickLauncherJSON(StringBuffer sb, TreeNode node, String contextPath,
String DefaultIcon) {
 
         if (node.isLeafNode()) {

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp?rev=992979&r1=992978&r2=992979&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
Mon Sep  6 09:17:58 2010
@@ -40,35 +40,43 @@ limitations under the License.
 <%
     NavigationJsonGenerator generator = new NavigationJsonGenerator(request.getLocale());
     String treeJson = generator.generateTreeJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif");
+    String treeJsonBasic = generator.generateTreeJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif","basic");
     String listJson = generator.generateQuickLauncherJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif");
+    String listJsonBasic = generator.generateQuickLauncherJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif","basic");
 %>
 
 <table class="tundra" width="200px" border="0" cellpadding="0" cellspacing="0">
     <tr>
-        <td CLASS="ReallyDarkBackground"><strong>&nbsp;<fmt:message  
 key="Console Navigation" /></strong></td>
+        <td CLASS="ReallyDarkBackground"><strong>&nbsp;<fmt:message  
 key="Console Navigation"/></strong></td>
     </tr>
     <tr>
-        <td>&nbsp;</td>
+        <td>&nbsp;<input type="radio" name="mode" id ="mode" checked="checked"
onclick="changeMode()"/><fmt:bundle basename="portaldriver"><fmt:message key="console.mode.basic"/></fmt:bundle>
+                  <input type="radio"  name="mode" id ="mode" onclick="changeMode()"/><fmt:bundle
basename="portaldriver"><fmt:message key="console.mode.advanced"/></fmt:bundle>
+        </td>
     </tr>
-    <tr>
+    <tr><td>&nbsp;&nbsp;</td></tr>
+    <tr id="tquickLauncher" style="display:none;">
         <td>&nbsp;&nbsp;<input id="quickLauncher"></td>
     </tr>
     <tr>
-        <td>&nbsp;&nbsp;<div id="navigationTree"></div>
+        <td>&nbsp;&nbsp;<div id="navigationTreeBasic"></div><div
id="navigationTreeAdvanced"></div>
         </td>
     </tr>
 </table>
-
-<script type="text/javascript">
-
-<%-- scripts to create the navigation tree--%>
-
+<script language="Javascript" src="<%=request.getContextPath()%>/js/navigation.js"
type="text/javascript"></script>
+<script language="Javascript">
    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dijit.form.FilteringSelect");
    dojo.require("dijit.Tree");
-
    var treeData = <%=treeJson%>;
+   var treeDataBasic =<%=treeJsonBasic%>;
    var listData = <%=listJson%>;
+   var listDataBasic = <%=listJsonBasic%>;
+   var treeModel="";
+   var navigationTreeBasic="";
+   var navigationTreeAdvanced="";
+   var filterSelect="";
+   
    var treeStore = new dojo.data.ItemFileReadStore
     ({
          data: {
@@ -77,6 +85,14 @@ limitations under the License.
              items: treeData
              }
      });
+   var treeStoreBasic = new dojo.data.ItemFileReadStore
+    ({
+         data: {
+             identifier: 'id',
+             label: 'label',
+             items: treeDataBasic
+             }
+     });
     var listStore = new dojo.data.ItemFileReadStore({
        data: {
            identifier: 'name',
@@ -84,169 +100,12 @@ limitations under the License.
            items: listData
            }
     });
-function load() {
-      
-   var treeModel = new dijit.tree.ForestStoreModel({
-       store: treeStore
-   });
-       
-   var navigationTree = new dijit.Tree
-           (
-         {  model: treeModel,
-            showRoot: false,
-            openOnClick: true,
-            onClick: function(treeNodeItem,treeNode) {
-            
-            var anchorNode=treeNode.labelNode.childNodes[2];
-
-             if(anchorNode)
-                {
-                 displayPortlets(anchorNode.href);
-                }                     
-            },
-            _createTreeNode: function(args) {
-                    var tnode = new dijit._TreeNode(args);
-                    tnode.labelNode.innerHTML = args.label;
-                    return tnode;
-                }
-         },
-         dojo.byId("navigationTree")
-       );
-
-
-   var filterSelect = new dijit.form.FilteringSelect
-       (
-          {
-           id: "quickLauncher",
-           store: listStore,
-           searchAttr: "name",
-           name: "quickLauncher",
-           promptMessage: "type and press enter to quick launch",
-           labelAttr: "label",
-           labelType: "html",
-           onKeyPress: function(event){        
-               if(event.charCode!=dojo.keys.ENTER) return;
-                   quickLaunchPortlets(this.value);      
-           },
-           onChange: function(event){
-               quickLaunchPortlets(this.value);
-           }
-         },
-         dojo.byId("quickLauncher")
-         );
-  }
-
-    function quickLaunchPortlets(portalPageName){
-        listStore.fetchItemByIdentity({identity:portalPageName,
-            onItem:function(item){
-                var iframeHref = listStore.getValue(item,"href");
-                displayPortlets(iframeHref);
+    var listStoreBasic = new dojo.data.ItemFileReadStore({
+        data: {
+            identifier: 'name',
+            label: 'label',
+            items: listDataBasic
             }
-        });
-        if(dijit.byId("navigationTree")){
-            findAndSelect(portalPageName,dijit.byId("navigationTree").rootNode);
-        }
-    }
-
-    function displayPortlets(iframeHref){
-    
-        //var iframeHref = anchor.href;
-
-        if(document.location.href.indexOf(iframeHref)==0){      
-            iframeHref=document.location.href.substring(0,document.location.href.indexOf("?"));
-        }
-        
-        dojo.io.iframe.setSrc(document.getElementById("portletsFrame"), iframeHref+"?formId="+formID,
true);
-               
-         try {
-            objToResize=getIframeObjectToResize();
-            <%-- reset the height of iframe page each time the new portlet is loaded--%>
-            objToResize.height = 400;
-              }
-          catch(err){
-            window.status = err.message;
-          }
-          
-        setTimeout('returnToTop()', 30);      
-     }
-     
-    function returnToTop(){
-        window.scrollTo(0,0);
-        return false;
-     }
-     
-       
-
-    dojo.addOnLoad(load);
-   
-
-<%-- scripts to expand  and select tree node automatically when open menu item from quick
launcher --%>
-
-   
-function findAndSelect(key, rootNode)
-    {
-        
-        var pathToExpandItems = [];
-
-        if(findRecur(rootNode.item.children, key, pathToExpandItems))
-        {
-            select(pathToExpandItems);
-        } 
-    }
-
-
-function findRecur(items, key, pathToExpandItems) 
-    {
-        for (var child = 0; child < items.length; child++) {
-
-            pathToExpandItems.push(items[child]);
-            var label = treeStore.getLabel(items[child]);
-            if (label && label.indexOf(key) != -1)
-                return true;
-
-            if (items[child].children && findRecur(items[child].children, key, pathToExpandItems))
-                return true;
-            pathToExpandItems.pop();
-        }
-        return false;
-    }
-    
-function select(pathToExpandItems)
-    {
-    
-    var navigationTree=dijit.byId("navigationTree");
-        var i;
-        function expandParent(node)
-        {
-            if(node && !node.isExpanded)
-            {
-                expandParent(node.getParent());
-                navigationTree._expandNode(node);
-            }
-        }
-        //make sure the ancestor node expanded before
-         var firstNode = getTreeNode(navigationTree,pathToExpandItems[0],treeStore);    

-         expandParent(firstNode.getParent());
-        
-        for (i = 0;;i++) {
-            node  = getTreeNode(navigationTree,pathToExpandItems[i],treeStore);
-            if(i < pathToExpandItems.length-1)
-                navigationTree._expandNode(node);
-            else 
-            {
-                navigationTree.focusNode(node);
-                return node;
-            }
-        }
-    }
-    
-   function getTreeNode(tree,item,treeStore){
-   
-        var wrapperNode =tree._itemNodesMap[treeStore.getIdentity(item)];
-        return wrapperNode[0];
-   } 
- 
-        
+     });
+    dojo.addOnLoad(function() { createNavigationTree(treeStoreBasic,listStoreBasic,"basic");
});
 </script>
-
-

Added: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/js/navigation.js
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/js/navigation.js?rev=992979&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/js/navigation.js
(added)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/js/navigation.js
Mon Sep  6 09:17:58 2010
@@ -0,0 +1,218 @@
+//======================================================================
+//   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.
+//======================================================================
+
+// $Rev: 753156 $ $Date: 2009-03-13 16:21:04 +0800 (Fri, 13 Mar 2009) $
+  function createNavigationTree(treeStore1,listStore1,showMode) {
+         treeModel = new dijit.tree.ForestStoreModel({
+              store: treeStore1
+          });  
+         if(showMode=="basic"){
+               dojo.byId("navigationTreeAdvanced").style.display="none"; 
+               dojo.byId("navigationTreeBasic").style.display="block"; 
+               if(dijit.byId("navigationTreeBasic")==null){
+                 navigationTreeBasic = new dijit.Tree(
+                  {  model: treeModel,
+                     showRoot: false,
+                     openOnClick: true,
+                     autoExpand: true,
+                     onClick: function(treeNodeItem,treeNode) {
+                     
+                     var anchorNode=treeNode.labelNode.childNodes[2];
+    
+                      if(anchorNode)
+                         {
+                          displayPortlets(anchorNode.href,"navigationTreeBasic");
+                         }                     
+                     },
+                     _createTreeNode: function(args) {
+                             var tnode = new dijit._TreeNode(args);
+                             tnode.labelNode.innerHTML = args.label;
+                             return tnode;
+                         }
+                   },
+                   dojo.byId("navigationTreeBasic")
+                 );
+               }
+          }else{
+                 dojo.byId("navigationTreeBasic").style.display="none"; 
+                 dojo.byId("navigationTreeAdvanced").style.display="block"; 
+               if(dijit.byId("navigationTreeAdvanced")==null){
+               navigationTreeAdvanced = new dijit.Tree(
+               {  model: treeModel,
+                  showRoot: false,
+                  openOnClick: true,
+                  autoExpand: false,
+                  onClick: function(treeNodeItem,treeNode) {
+                  var anchorNode=treeNode.labelNode.childNodes[2];
+                  if(anchorNode){
+                     displayPortlets(anchorNode.href,"navigationTreeAdvanced");
+                  }                     
+                },
+                _createTreeNode: function(args) {
+                        var tnode = new dijit._TreeNode(args);
+                        tnode.labelNode.innerHTML = args.label;
+                        return tnode;
+                    }
+                },
+                dojo.byId("navigationTreeAdvanced")
+              );
+            }
+          }
+          if(showMode=="basic"){
+              dojo.byId("tquickLauncher").style.display="none"; 
+              return;
+          }else{
+              dojo.byId("tquickLauncher").style.display="block"; 
+          }
+           if(dijit.byId("quickLauncher")!=null){
+              dijit.byId("quickLauncher").store=listStore1;
+           }else{
+                filterSelect = new dijit.form.FilteringSelect
+                (
+                   {
+                    store: listStore1,
+                    searchAttr: "name",
+                    promptMessage: "type and press enter to quick launch",
+                    labelAttr: "label",
+                    labelType: "html",
+                    onKeyPress: function(event){        
+                        if(event.charCode!=dojo.keys.ENTER) return;
+                            quickLaunchPortlets(this.value);      
+                    },
+                    onChange: function(event){
+                        quickLaunchPortlets(this.value);
+                    }
+                  },
+                  dojo.byId("quickLauncher")
+                  );
+            }
+     }
+
+    function quickLaunchPortlets(portalPageName,navigationTree){
+        listStore.fetchItemByIdentity({identity:portalPageName,
+            onItem:function(item){
+                var iframeHref = listStore.getValue(item,"href");
+                displayPortlets(iframeHref);
+            }
+        });
+        if(dijit.byId(navigationTree)){
+            findAndSelect(portalPageName,navigationTree);
+        }
+    }
+
+    function displayPortlets(iframeHref){
+    
+        //var iframeHref = anchor.href;
+
+        if(document.location.href.indexOf(iframeHref)==0){      
+            iframeHref=document.location.href.substring(0,document.location.href.indexOf("?"));
+        }
+        
+        dojo.io.iframe.setSrc(document.getElementById("portletsFrame"), iframeHref+"?formId="+formID,
true);
+               
+         try {
+            objToResize=getIframeObjectToResize();
+             //reset the height of iframe page each time the new portlet is loaded
+            objToResize.height = 400;
+              }
+          catch(err){
+            window.status = err.message;
+          }
+          
+        setTimeout('returnToTop()', 30);      
+     }
+     
+    function returnToTop(){
+        window.scrollTo(0,0);
+        return false;
+     }
+    function changeMode(){
+        var rmode=document.getElementsByName("mode");
+        if(rmode[0].checked){
+           createNavigationTree(treeStoreBasic,listStoreBasic,"basic");
+           return;
+        }else{
+             createNavigationTree(treeStore,listStore,"advanced");
+             return;
+        }
+          
+    }
+   //scripts to expand  and select tree node automatically when open menu item from quick
launcher
+
+   
+function findAndSelect(key,navigationTree)
+    {
+        rootNode=dijit.byId(navigationTree).rootNode
+        var pathToExpandItems = [];
+
+        if(findRecur(rootNode.item.children, key, pathToExpandItems))
+        {
+            select(pathToExpandItems,navigationTree);
+        } 
+    }
+
+
+function findRecur(items, key, pathToExpandItems) 
+    {
+        for (var child = 0; child < items.length; child++) {
+
+            pathToExpandItems.push(items[child]);
+            var label = treeStore.getLabel(items[child]);
+            if (label && label.indexOf(key) != -1)
+                return true;
+
+            if (items[child].children && findRecur(items[child].children, key, pathToExpandItems))
+                return true;
+            pathToExpandItems.pop();
+        }
+        return false;
+    }
+    
+function select(pathToExpandItems,navigationTree)
+    {
+    
+    var navigationTree=dijit.byId(navigationTree);
+        var i;
+        function expandParent(node)
+        {
+            if(node && !node.isExpanded)
+            {
+                expandParent(node.getParent());
+                navigationTree._expandNode(node);
+            }
+        }
+        //make sure the ancestor node expanded before
+         var firstNode = getTreeNode(navigationTree,pathToExpandItems[0],treeStore);    

+         expandParent(firstNode.getParent());
+        
+        for (i = 0;;i++) {
+            node  = getTreeNode(navigationTree,pathToExpandItems[i],treeStore);
+            if(i < pathToExpandItems.length-1)
+                navigationTree._expandNode(node);
+            else 
+            {
+                navigationTree.focusNode(node);
+                return node;
+            }
+        }
+    }
+    
+   function getTreeNode(tree,item,treeStore){
+   
+        var wrapperNode =tree._itemNodesMap[treeStore.getIdentity(item)];
+        return wrapperNode[0];
+   } 

Modified: geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java?rev=992979&r1=992978&r2=992979&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
(original)
+++ geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
Mon Sep  6 09:17:58 2010
@@ -18,7 +18,9 @@ package org.apache.geronimo.pluto;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,19 +50,29 @@ public class AdminConsoleExtensionGBean 
     private final ArrayList<String> portletList;
     private final String icon;
     private final PortalContainerServices portletContainerServices;
-
-    /* Constructor for GBean */
-    public AdminConsoleExtensionGBean(String pageTitle, String portletContext, ArrayList<String>
portletList, PortalContainerServices portalContainerServices) {
-        this(pageTitle, portletContext, portletList, null, portalContainerServices);
+    private final String mode;
+    private final static Set modes=new HashSet();
+    static{
+        modes.add("advanced");
+        modes.add("basic");
     }
-
-    public AdminConsoleExtensionGBean(String pageTitle, String portletContext, ArrayList<String>
portletList, String icon, PortalContainerServices portalContainerServices) {
+    /* Constructor for GBean */
+    public AdminConsoleExtensionGBean(String pageTitle, String portletContext, ArrayList<String>
portletList, String icon, PortalContainerServices portalContainerServices,String mode) {
         super();
         this.pageTitle = pageTitle;
         this.portletContext = portletContext;
         this.portletList = portletList;
         this.icon = icon;
         this.portletContainerServices = portalContainerServices;
+        if(mode==null){
+            log.debug("you did not specifiy a mode for GBean "+pageTitle+",  the system will
use advanced as the default mode ");
+            this.mode="advanced";
+        }else if(modes.contains(mode)){
+            this.mode=mode;
+        }else{
+            log.warn("when create GBean "+pageTitle+" error :your mode " + mode +" is illegal,
the system will use advanced as the default mode ");
+            this.mode="advanced";
+        }
     }
 
     /*
@@ -145,6 +157,7 @@ public class AdminConsoleExtensionGBean 
         pageConfig.setName(pageTitle);
         pageConfig.setUri("/WEB-INF/themes/default-theme.jsp");
         pageConfig.setIcon(icon);
+        pageConfig.setMode(mode);
         return pageConfig;
     }
 
@@ -256,13 +269,14 @@ public class AdminConsoleExtensionGBean 
         infoFactory.addAttribute("portletContext", String.class, true, true);
         infoFactory.addAttribute("portletList", ArrayList.class, true, true);
         infoFactory.addAttribute("icon", String.class, true, true);
+        infoFactory.addAttribute("mode", String.class, true, true);
         infoFactory.addReference("PortalContainerServices", PortalContainerServices.class,
"GBean");
         infoFactory.setConstructor(new String[]{
                 "pageTitle",
                 "portletContext",
                 "portletList",
                 "icon", 
-                "PortalContainerServices"});
+                "PortalContainerServices","mode"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PageConfig.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PageConfig.java?rev=992979&r1=992978&r2=992979&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PageConfig.java
(original)
+++ geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PageConfig.java
Mon Sep  6 09:17:58 2010
@@ -26,7 +26,7 @@ package org.apache.geronimo.pluto.impl;
 public class PageConfig extends org.apache.pluto.driver.services.portal.PageConfig {
 
     private String icon;
-
+    private String mode;
     public String getIcon() {
         return icon;
     }
@@ -34,4 +34,13 @@ public class PageConfig extends org.apac
     public void setIcon(String icon) {
         this.icon = icon;
     }
+
+    public String getMode() {
+        return mode;
+    }
+
+    public void setMode(String mode) {
+        this.mode = mode;
+    }
+    
 }



Mime
View raw message