Permalink
Browse files

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
  • Loading branch information...
1 parent 83b4919 commit e48a9d683dd8d442c3ef586df0ce4e20c882b22f @splatch splatch committed Aug 30, 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">
@@ -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
@@ -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 @@ public void populateItem(Item<ICellPopulator<Bundle>> cellItem, final String com
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));
}
});
@@ -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);
+ }
+
+ }
+
+}
@@ -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>
@@ -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>

0 comments on commit e48a9d6

Please sign in to comment.