Author: ldywicki
Date: Thu Aug 30 19:58:58 2012
New Revision: 1379102

URL: http://svn.apache.org/viewvc?rev=1379102&view=rev
Log:
KARAF-1783 - Support for additional actions in bundles list

Signed-off-by: Lukasz Dywicki <l...@code-house.org>

Added:
    
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java
    
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html
      - copied, changed from r1379101, 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
    
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html
      - copied, changed from r1379101, 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
Modified:
    
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
    
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
    
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java

Modified: 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html?rev=1379102&r1=1379101&r2=1379102&view=diff
==============================================================================
--- 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
 (original)
+++ 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
 Thu Aug 30 19:58:58 2012
@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <wicket:panel 
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
-    <div class="actions">
+    <div class="actions pull-right">
         <ul>
             <li wicket:id="actions">
                 <a wicket:id="action">

Modified: 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java?rev=1379102&r1=1379101&r2=1379102&view=diff
==============================================================================
--- 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
 (original)
+++ 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
 Thu Aug 30 19:58:58 2012
@@ -28,7 +28,6 @@ import org.apache.karaf.webconsole.osgi.
 import org.apache.karaf.webconsole.osgi.core.bundle.list.link.UninstallLink;
 import org.apache.karaf.webconsole.osgi.core.bundle.list.link.UpdateLink;
 import org.apache.karaf.webconsole.osgi.core.shared.State;
-import org.apache.karaf.webconsole.osgi.core.spi.IActionProvider;
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.link.Link;
@@ -43,17 +42,10 @@ public class BundleActionsPanel extends 
 
     private static final long serialVersionUID = 1L;
 
-    public BundleActionsPanel(String componentId, final IModel<Bundle> model, 
List<IActionProvider> actionProviders) {
+    public BundleActionsPanel(String componentId, final IModel<Bundle> model) {
         super(componentId, model);
 
-        /*
-        add(new ListView<IActionProvider>("extensions", new 
ListModel<IActionProvider>(actionProviders)) {
-            @Override
-            protected void populateItem(ListItem<IActionProvider> item) {
-                item.add(item.getModelObject().create("extension", 
model.getObject()));
-            }
-        });
-        */
+        add(new ExtensionsPanel("extend", model));
     }
 
     @Override

Modified: 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java?rev=1379102&r1=1379101&r2=1379102&view=diff
==============================================================================
--- 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java
 (original)
+++ 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java
 Thu Aug 30 19:58:58 2012
@@ -26,7 +26,6 @@ import org.apache.karaf.webconsole.osgi.
 import org.apache.karaf.webconsole.osgi.core.shared.BundleDataProvider;
 import org.apache.karaf.webconsole.osgi.core.shared.OsgiPage;
 import org.apache.karaf.webconsole.osgi.core.shared.State;
-import org.apache.karaf.webconsole.osgi.core.spi.IActionProvider;
 import org.apache.karaf.webconsole.osgi.core.spi.IColumnProvider;
 import org.apache.karaf.webconsole.osgi.core.spi.IDecorationProvider;
 import org.apache.wicket.Page;
@@ -55,9 +54,6 @@ public class BundlePage extends OsgiPage
     @PaxWicketBean(name = "columnProviders")
     private List<IColumnProvider> columnProviders;
 
-    @PaxWicketBean(name = "actionProviders")
-    private List<IActionProvider> actionProviders;
-
     @PaxWicketBean(name = "decorationProviders")
     private List<IDecorationProvider> decorationProviders;
 
@@ -101,7 +97,7 @@ public class BundlePage extends OsgiPage
             private static final long serialVersionUID = 1L;
 
             public void populateItem(Item<ICellPopulator<Bundle>> cellItem, 
final String componentId, final IModel<Bundle> rowModel) {
-                cellItem.add(new BundleActionsPanel(componentId, rowModel, 
actionProviders));
+                cellItem.add(new BundleActionsPanel(componentId, rowModel));
             }
         });
 

Added: 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java?rev=1379102&view=auto
==============================================================================
--- 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java
 (added)
+++ 
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java
 Thu Aug 30 19:58:58 2012
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+package org.apache.karaf.webconsole.osgi.core.bundle.list;
+
+import java.util.List;
+
+import org.apache.karaf.webconsole.osgi.core.spi.IActionProvider;
+import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.markup.repeater.RepeatingView;
+import org.apache.wicket.model.IModel;
+import org.ops4j.pax.wicket.api.PaxWicketBean;
+import org.osgi.framework.Bundle;
+
+public class ExtensionsPanel extends Panel {
+
+    private static final long serialVersionUID = 1L;
+
+    @PaxWicketBean(name = "actionProviders")
+    private List<IActionProvider> actionProviders;
+
+    public ExtensionsPanel(String id, IModel<Bundle> model) {
+        super(id, model);
+
+        int visibleExtensions = 0;
+        RepeatingView view = new RepeatingView("extensions");
+        for (IActionProvider provider : actionProviders) {
+            String childId = view.newChildId();
+            Component extension = provider.create(childId, model.getObject());
+            view.add(extension);
+            if (extension != null && extension.isVisible()) {
+                visibleExtensions++;
+            }
+        }
+
+        add(view);
+        if (visibleExtensions == 0) {
+            setVisible(false);
+        }
+
+    }
+
+}

Copied: 
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html
 (from r1379101, 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html)
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html?p2=karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html&p1=karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html&r1=1379101&r2=1379102&rev=1379102&view=diff
==============================================================================
--- 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
 (original)
+++ 
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html
 Thu Aug 30 19:58:58 2012
@@ -15,16 +15,6 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<wicket:panel 
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
-    <div class="actions">
-        <ul>
-            <li wicket:id="actions">
-                <a wicket:id="action">
-                    <span wicket:id="label"></span>
-                </a>
-            </li>
-        </ul>
-    </div>
-
-    <wicket:child />
-</wicket:panel>
\ No newline at end of file
+<wicket:extend 
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
+    <div class="dropdown active pull-left" wicket:id="extend"></div>
+</wicket:extend>
\ No newline at end of file

Copied: 
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html
 (from r1379101, 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html)
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html?p2=karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html&p1=karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html&r1=1379101&r2=1379102&rev=1379102&view=diff
==============================================================================
--- 
karaf/webconsole/trunk/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
 (original)
+++ 
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html
 Thu Aug 30 19:58:58 2012
@@ -16,15 +16,11 @@
    limitations under the License.
 -->
 <wicket:panel 
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
-    <div class="actions">
-        <ul>
-            <li wicket:id="actions">
-                <a wicket:id="action">
-                    <span wicket:id="label"></span>
-                </a>
-            </li>
-        </ul>
-    </div>
-
-    <wicket:child />
+    <a href="#" data-toggle="dropdown" class="dropdown-toggle" 
title="Additional actions available">
+        <i class="icon-arrow-down"></i>
+    </a>
+    <ul class="dropdown-menu">
+        <li wicket:id="extensions">
+        </li>
+    </ul>
 </wicket:panel>
\ No newline at end of file


Reply via email to