KARAF-1783 - Support for additional actions in bundles list
Signed-off-by: Lukasz Dywicki <luke@code-house.org>
git-svn-id: https://svn.apache.org/repos/asf/karaf/webconsole/trunk@1379102 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html b/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
index 81bb5f3..54e8c22 100644
--- a/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
+++ b/core/src/main/resources/org/apache/karaf/webconsole/core/table/ActionsPanel.html
@@ -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">
diff --git a/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java b/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
index e7233d1..f466275 100644
--- a/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
+++ b/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.java
@@ -28,7 +28,6 @@
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 @@
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
diff --git a/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java b/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java
index 81fce1d..33e9ad7 100644
--- a/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java
+++ b/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/BundlePage.java
@@ -26,7 +26,6 @@
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 @@
@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 @@
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));
}
});
diff --git a/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java b/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java
new file mode 100644
index 0000000..a5e154f
--- /dev/null
+++ b/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.java
@@ -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);
+ }
+
+ }
+
+}
diff --git a/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html b/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html
new file mode 100644
index 0000000..7817aea
--- /dev/null
+++ b/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/BundleActionsPanel.html
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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
diff --git a/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html b/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html
new file mode 100644
index 0000000..4650966
--- /dev/null
+++ b/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/ExtensionsPanel.html
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<wicket:panel xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
+ <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