roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r538668 - in /roller/trunk/src/org/apache/roller/ui/core/util/menu: MenuHelper.java ParsedTab.java ParsedTabItem.java
Date Wed, 16 May 2007 17:48:52 GMT
Author: agilliland
Date: Wed May 16 10:48:51 2007
New Revision: 538668

URL: http://svn.apache.org/viewvc?view=rev&rev=538668
Log:
tidy up menu code a bit and add support for the 'disabledProperty' element which is used by
the pings code.


Modified:
    roller/trunk/src/org/apache/roller/ui/core/util/menu/MenuHelper.java
    roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTab.java
    roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTabItem.java

Modified: roller/trunk/src/org/apache/roller/ui/core/util/menu/MenuHelper.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/core/util/menu/MenuHelper.java?view=diff&rev=538668&r1=538667&r2=538668
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/core/util/menu/MenuHelper.java (original)
+++ roller/trunk/src/org/apache/roller/ui/core/util/menu/MenuHelper.java Wed May 16 10:48:51
2007
@@ -99,6 +99,8 @@
             boolean includeTab = true;
             if(configTab.getEnabledProperty() != null) {
                 includeTab = RollerConfig.getBooleanProperty(configTab.getEnabledProperty());
+            } else if(configTab.getDisabledProperty() != null) {
+                includeTab = ! RollerConfig.getBooleanProperty(configTab.getDisabledProperty());
             }
             
             if(includeTab) {
@@ -134,6 +136,8 @@
                     boolean includeItem = true;
                     if(configTabItem.getEnabledProperty() != null) {
                         includeItem = RollerConfig.getBooleanProperty(configTabItem.getEnabledProperty());
+                    } else if(configTabItem.getDisabledProperty() != null) {
+                        includeItem = ! RollerConfig.getBooleanProperty(configTabItem.getDisabledProperty());
                     }
                     
                     if(includeItem) {
@@ -245,50 +249,52 @@
         Iterator iter = menus.iterator();
         while (iter.hasNext()) {
             Element e = (Element) iter.next();
-            config.addTab(elementToConfigMenu(e));
+            config.addTab(elementToParsedTab(e));
         }
         
         return config;
     }
     
     
-    private static ParsedTab elementToConfigMenu(Element element) {
+    private static ParsedTab elementToParsedTab(Element element) {
         
-        ParsedTab menu = new ParsedTab();
+        ParsedTab tab = new ParsedTab();
         
-        menu.setName(element.getAttributeValue("name"));
-        menu.setPerm(element.getAttributeValue("perms"));
-        menu.setRole(element.getAttributeValue("roles"));
-        menu.setEnabledProperty(element.getAttributeValue("enabledProperty"));
+        tab.setName(element.getAttributeValue("name"));
+        tab.setPerm(element.getAttributeValue("perms"));
+        tab.setRole(element.getAttributeValue("roles"));
+        tab.setEnabledProperty(element.getAttributeValue("enabledProperty"));
+        tab.setDisabledProperty(element.getAttributeValue("disabledProperty"));
         
         List menuItems = element.getChildren("menu-item");
         Iterator iter = menuItems.iterator();
         while (iter.hasNext()) {
             Element e = (Element) iter.next();
-            menu.addItem(elementToConfigMenuItem(e));
+            tab.addItem(elementToParsedTabItem(e));
         }
         
-        return menu;
+        return tab;
     }
     
     
-    private static ParsedTabItem elementToConfigMenuItem(Element element) {
+    private static ParsedTabItem elementToParsedTabItem(Element element) {
         
-        ParsedTabItem menuItem = new ParsedTabItem();
+        ParsedTabItem tabItem = new ParsedTabItem();
         
-        menuItem.setName(element.getAttributeValue("name"));
-        menuItem.setAction(element.getAttributeValue("action"));
+        tabItem.setName(element.getAttributeValue("name"));
+        tabItem.setAction(element.getAttributeValue("action"));
         
         String subActions = element.getAttributeValue("subactions");
         if(subActions != null) {
-            menuItem.setSubActions(subActions.split(","));
+            tabItem.setSubActions(subActions.split(","));
         }
         
-        menuItem.setPerm(element.getAttributeValue("perms"));
-        menuItem.setRole(element.getAttributeValue("roles"));
-        menuItem.setEnabledProperty(element.getAttributeValue("enabledProperty"));
+        tabItem.setPerm(element.getAttributeValue("perms"));
+        tabItem.setRole(element.getAttributeValue("roles"));
+        tabItem.setEnabledProperty(element.getAttributeValue("enabledProperty"));
+        tabItem.setDisabledProperty(element.getAttributeValue("disabledProperty"));
         
-        return menuItem;
+        return tabItem;
     }
     
 }

Modified: roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTab.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTab.java?view=diff&rev=538668&r1=538667&r2=538668
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTab.java (original)
+++ roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTab.java Wed May 16 10:48:51
2007
@@ -31,6 +31,7 @@
     private String perm = null;
     private String role = null;
     private String enabledProperty = null;
+    private String disabledProperty = null;
     
     private List tabItems = new ArrayList();
     
@@ -78,6 +79,14 @@
 
     public void setTabItems(List tabItems) {
         this.tabItems = tabItems;
+    }
+
+    public String getDisabledProperty() {
+        return disabledProperty;
+    }
+
+    public void setDisabledProperty(String disabledProperty) {
+        this.disabledProperty = disabledProperty;
     }
     
 }

Modified: roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTabItem.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTabItem.java?view=diff&rev=538668&r1=538667&r2=538668
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTabItem.java (original)
+++ roller/trunk/src/org/apache/roller/ui/core/util/menu/ParsedTabItem.java Wed May 16 10:48:51
2007
@@ -30,6 +30,7 @@
     private String perm = null;
     private String role = null;
     private String enabledProperty = null;
+    private String disabledProperty = null;
     
     
     public String getName() {
@@ -78,6 +79,14 @@
 
     public void setEnabledProperty(String enabledProperty) {
         this.enabledProperty = enabledProperty;
+    }
+
+    public String getDisabledProperty() {
+        return disabledProperty;
+    }
+
+    public void setDisabledProperty(String disabledProperty) {
+        this.disabledProperty = disabledProperty;
     }
     
 }



Mime
View raw message