felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1426555 - in /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole: AbstractWebConsolePlugin.java internal/servlet/OsgiManager.java internal/servlet/PluginHolder.java
Date Fri, 28 Dec 2012 15:59:05 GMT
Author: fmeschbe
Date: Fri Dec 28 15:59:05 2012
New Revision: 1426555

URL: http://svn.apache.org/viewvc?rev=1426555&view=rev
Log:
FELIX-3833 Need also the structured map as an internal request attribute for the AbstractWebConsole
to properly render the navigation

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java?rev=1426555&r1=1426554&r2=1426555&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
Fri Dec 28 15:59:05 2012
@@ -29,6 +29,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.*;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.felix.webconsole.internal.servlet.OsgiManager;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
@@ -637,8 +638,8 @@ public abstract class AbstractWebConsole
         current = current.substring( 1, slash );
 
         String appRoot = ( String ) request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT
);
-    	Map menuMap = ( Map ) request.getAttribute( WebConsoleConstants.ATTR_LABEL_MAP );
 
+        Map menuMap = ( Map ) request.getAttribute( OsgiManager.ATTR_LABEL_MAP_CATEGORIZED
);
         this.renderMenu( menuMap, appRoot, pw );
 
         // render lang-box

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java?rev=1426555&r1=1426554&r2=1426555&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
Fri Dec 28 15:59:05 2012
@@ -92,7 +92,7 @@ public class OsgiManager extends Generic
 
     /**
      * Old name of the request attribute providing the mappings from label to
-     * page title. This attribute is no deprecated and replaced by
+     * page title. This attribute is now deprecated and replaced by
      * {@link WebConsoleConstants#ATTR_LABEL_MAP}.
      *
      * @deprecated use {@link WebConsoleConstants#ATTR_LABEL_MAP} instead
@@ -101,6 +101,12 @@ public class OsgiManager extends Generic
         + ".labelMap";
 
     /**
+     * The name of the (internal) request attribute providing the categorized
+     * label map structure.
+     */
+    public static final String ATTR_LABEL_MAP_CATEGORIZED = WebConsoleConstants.ATTR_LABEL_MAP
+ ".categorized";
+
+    /**
      * The name and value of a parameter which will prevent redirection to a
      * render after the action has been executed (value is "_noredir_"). This
      * may be used by programmatic action submissions.
@@ -484,19 +490,20 @@ public class OsgiManager extends Generic
         AbstractWebConsolePlugin plugin = getConsolePlugin(label);
         if (plugin != null)
         {
-            final Map labelMap = holder.getLocalizedLabelMap( resourceBundleManager, locale
);
+            final Map labelMap = holder.getLocalizedLabelMap( resourceBundleManager, locale,
"Main" );
             final Object flatLabelMap = labelMap.remove( WebConsoleConstants.ATTR_LABEL_MAP
);
 
             // the official request attributes
             request.setAttribute(WebConsoleConstants.ATTR_LANG_MAP, getLangMap());
             request.setAttribute(WebConsoleConstants.ATTR_LABEL_MAP, flatLabelMap);
+            request.setAttribute( ATTR_LABEL_MAP_CATEGORIZED, labelMap );
             request.setAttribute(WebConsoleConstants.ATTR_APP_ROOT,
                 request.getContextPath() + request.getServletPath());
             request.setAttribute(WebConsoleConstants.ATTR_PLUGIN_ROOT,
                 request.getContextPath() + request.getServletPath() + '/' + label);
 
             // deprecated request attributes
-            request.setAttribute(ATTR_LABEL_MAP_OLD, labelMap);
+            request.setAttribute(ATTR_LABEL_MAP_OLD, flatLabelMap);
             request.setAttribute(ATTR_APP_ROOT_OLD,
                 request.getContextPath() + request.getServletPath());
 

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java?rev=1426555&r1=1426554&r2=1426555&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
Fri Dec 28 15:59:05 2012
@@ -236,7 +236,7 @@ class PluginHolder implements ServiceLis
      *
      * @return The localized map of labels to titles
      */
-    Map getLocalizedLabelMap( final ResourceBundleManager resourceBundleManager, final Locale
locale )
+    Map getLocalizedLabelMap( final ResourceBundleManager resourceBundleManager, final Locale
locale, final String defaultCategory )
     {
         final Map map = new HashMap();
         final Map flatMap = new HashMap();
@@ -255,8 +255,8 @@ class PluginHolder implements ServiceLis
             String category = plugin.getCategory();
             if ( category == null || category.trim().length() == 0 )
             {
-                // TODO: FELIX-3769; decide whether hard code or configurable
-                category = "Main";
+                // FELIX-3798 configured default category
+                category = defaultCategory;
             }
 
             // TODO: FELIX-3769; translate the Category



Mime
View raw message