Add karaf-logo, improve CSS styles, add table for better display in BasePage, Table Repositories is sortabel
git-svn-id: https://svn.apache.org/repos/asf/karaf/sandbox/pieber/karaf-webconsole/trunk@1157116 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java b/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java
index b0baefc..60e4f92 100644
--- a/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java
+++ b/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java
@@ -1,14 +1,23 @@
package org.apache.karaf.webconsole.core;
-import java.util.Collections;
-import java.util.List;
-
+import org.apache.wicket.ResourceReference;
+import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
+import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.markup.html.image.Image;
+import org.apache.wicket.markup.html.link.PageLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
import org.ops4j.pax.wicket.api.PaxWicketBean;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
public class BasePage extends WebPage {
@PaxWicketBean(name = "tabs")
@@ -18,6 +27,47 @@
add(CSSPackageResource.getHeaderContribution(BasePage.class, "style.css"));
add(new Label("footer", "Apache Karaf Console"));
+
+ add(new Image("karafLogo", new ResourceReference(BasePage.class,"images/karaf-logo.png")));
+
+ add(new ListView<ConsoleTab>("tabs", tabs) {
+ @Override
+ protected void populateItem(ListItem<ConsoleTab> item) {
+ final ConsoleTab tab = item.getModelObject();
+ item.add(new PageLink("moduleLink", tab.getModuleHomePage()).add(new Label("moduleLabel", tab.getLabel())));
+
+ List<String> subItems = new LinkedList<String>(tab.getItems().keySet());
+ item.add(new ListView<String>("topLinks", subItems) {
+ @Override
+ protected void populateItem(ListItem<String> item) {
+ String subItem = item.getModelObject();
+ item.add(new PageLink("topLink", tab.getItems().get(subItem)).add(new Label("linkLabel", subItem)));
+ }
+ });
+ }
+ });
+
+ List tabPanels = new ArrayList();
+ tabPanels.add(new AbstractTab(new Model("first tab")) {
+ public Panel getPanel(String panelId) {
+ return new TabPanel1(panelId);
+ }
+ });
+
+ add(new TabbedPanel("tabPanels", tabPanels));
+
+ }
+
+
+ }
+
+ class TabPanel1 extends Panel {
+ public TabPanel1(String id) {
+ super(id);
+ }
+ }
+
+ /*
add(new NavigationPanel("navigationPanel", new ListModel<ConsoleTab>(tabs)));
List<Class> subPages = getSubPages();
@@ -27,23 +77,13 @@
add(new Label("sidebar").setRenderBodyOnly(true));
}
-// List tabPanels = new ArrayList();
-// tabPanels.add(new AbstractTab(new Model("first tab")) {
-// public Panel getPanel(String panelId) {
-// return new TabPanel1(panelId);
-// }
-// });
-//
-// add(new TabbedPanel("tabPanels", tabPanels));
- }
-
-// class TabPanel1 extends Panel {
-// public TabPanel1(String id) {
-// super(id);
-// }
-// }
protected List<Class> getSubPages() {
return Collections.emptyList();
}
+
+ */
+
+
+
}
diff --git a/core/src/main/resources/org/apache/karaf/webconsole/core/BasePage.html b/core/src/main/resources/org/apache/karaf/webconsole/core/BasePage.html
index 2e1f816..c51e7bd 100644
--- a/core/src/main/resources/org/apache/karaf/webconsole/core/BasePage.html
+++ b/core/src/main/resources/org/apache/karaf/webconsole/core/BasePage.html
@@ -1,34 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
+
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Karaf wicket console</title>
</head>
+
<body>
-
<div id="container">
-
- <div id="header">
- <h2>Karaf administrator</h2>
-
+ <table>
+ <tr>
+ <td align="left"><img wicket:id="karafLogo" alt="karaf-logo" height="70" width="150"/></td>
+ <td align="right">Administration console</td>
+ </tr>
+ <!--
+ <tr>
<div wicket:id="navigationPanel">Navigation goes here</div>
- </div>
-
- <div id="wrapper">
-
<div wicket:id="sidebar">Sidebar goes here</div>
+ </tr>
+ -->
+ <tr>
+ <td colspan="2">
+ <div wicket:id="tabPanels" class="tabpanel">[tabbed panel will be here]</div>
- <div id="content">
- <wicket:child />
- </div>
- </div>
+ <div id="topmenu">
+ <ul>
+ <li wicket:id="tabs">
+ <a wicket:id="moduleLink">
+ <span wicket:id="moduleLabel">Category</span>
+ </a>
- <div id="footer">
- <div id="credits" wicket:id="footer">Footer</div>
- </div>
-
+ <ul>
+ <li wicket:id="topLinks">
+ <a wicket:id="topLink">
+ <span wicket:id="linkLabel">Label</span>
+ </a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div id="content">
+ <wicket:child/>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"> </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div id="footer" align="right">
+ <div wicket:id="footer">Footer</div>
+ </div>
+ </td>
+ </tr>
+ </table>
</div>
-
-
</body>
</html>
\ No newline at end of file
diff --git a/core/src/main/resources/org/apache/karaf/webconsole/core/images/karaf-logo.png b/core/src/main/resources/org/apache/karaf/webconsole/core/images/karaf-logo.png
new file mode 100644
index 0000000..066ab86
--- /dev/null
+++ b/core/src/main/resources/org/apache/karaf/webconsole/core/images/karaf-logo.png
Binary files differ
diff --git a/core/src/main/resources/org/apache/karaf/webconsole/core/style.css b/core/src/main/resources/org/apache/karaf/webconsole/core/style.css
index 1278e43..63e631b 100644
--- a/core/src/main/resources/org/apache/karaf/webconsole/core/style.css
+++ b/core/src/main/resources/org/apache/karaf/webconsole/core/style.css
@@ -7,10 +7,6 @@
background: #FFFFFF;
}
-#container {
- width: 1000px;
-}
-
a {
color: #0F3B5F;
}
@@ -24,13 +20,9 @@
width: 250px;
}
-#wrapper {
-
-}
-
-#content {
+#container {
float: left;
- width: 750px;
+ width: 1500px;
margin: 0 auto;
}
@@ -48,7 +40,7 @@
}
#topmenu {
- background: #CC9752;
+ background: #6f83ab;
}
#top-panel ul {
diff --git a/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/FeaturesConsoleTab.java b/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/FeaturesConsoleTab.java
index 017693e..7822fc7 100644
--- a/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/FeaturesConsoleTab.java
+++ b/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/FeaturesConsoleTab.java
@@ -19,8 +19,8 @@
public Map<String, Class> getItems() {
Map<String, Class> features = new HashMap<String, Class>();
- features.put("Features List", FeaturesPage.class);
- features.put("Feature repoz", RepositoriesPage.class);
+ features.put("Features list", FeaturesPage.class);
+ features.put("Features repositories", RepositoriesPage.class);
return features;
}
diff --git a/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/HomePage.java b/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/HomePage.java
index 0a8dd97..b3b4283 100644
--- a/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/HomePage.java
+++ b/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/HomePage.java
@@ -153,6 +153,7 @@
}
+ /*
@Override
protected List<Class> getSubPages() {
List<Class> subpages = new LinkedList<Class>();
@@ -160,4 +161,5 @@
subpages.add(EventsPage.class);
return subpages;
}
+ */
}
diff --git a/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.java b/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.java
index daf734b..fe47d59 100644
--- a/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.java
+++ b/osgi/src/main/java/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.java
@@ -1,22 +1,21 @@
package org.apache.karaf.webconsole.osgi.internal;
-import java.io.Serializable;
-import java.net.URI;
-import java.util.LinkedList;
-import java.util.List;
-
import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeaturesService;
import org.apache.karaf.features.Repository;
import org.apache.karaf.webconsole.core.BasePage;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.NavigationToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
-import org.apache.wicket.markup.repeater.data.ListDataProvider;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.ops4j.pax.wicket.api.PaxWicketBean;
+import java.io.Serializable;
+import java.net.URI;
+import java.util.*;
+
public class RepositoriesPage extends BasePage {
@PaxWicketBean(name = "featuresService")
@@ -34,12 +33,45 @@
new PropertyColumn<Repository>(Model.of("valid"), "valid", "valid"),
};
- ListDataProvider provider = new ListDataProvider(repos);
- DataTable<Repository> dataTable = new DataTable<Repository>("repositories", columns, provider, 10);
- dataTable.addTopToolbar(new NavigationToolbar(dataTable));
- add(dataTable);
+ add(new DefaultDataTable<ExtendedRepository>("repositories", columns, new RepositoriesProvider(repos), 20));
}
+ static class RepositoriesProvider extends SortableDataProvider<ExtendedRepository> {
+
+ List<ExtendedRepository> model;
+
+ public RepositoriesProvider(List model) {
+ this.model = model;
+ setSort("name", true);
+ }
+
+ public Iterator<? extends ExtendedRepository> iterator(int first, int count) {
+ List<ExtendedRepository> data = new ArrayList<ExtendedRepository>(model);
+ Collections.sort(data, new Comparator<ExtendedRepository>() {
+
+ public int compare(ExtendedRepository o1, ExtendedRepository o2) {
+ int dir = getSort().isAscending() ? 1 : -1;
+
+ if ("name".equals(getSort().getProperty())) {
+ return dir * (o1.getName().compareTo(o2.getName()));
+ } else {
+ return dir * (o1.getName().compareTo(o2.getName()));
+ }
+ }
+ });
+ return data.subList(first, Math.min(first + count, data.size()))
+ .iterator();
+ }
+
+ public int size() {
+ return model.size();
+ }
+
+ public IModel<ExtendedRepository> model(ExtendedRepository object) {
+ return Model.of(object);
+ }
+ }
+
class ExtendedRepository implements Repository, Serializable {
private final Repository repository;
@@ -67,6 +99,5 @@
public boolean isValid() {
return repository.isValid();
}
-
- }
+ }
}
diff --git a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/EventsPage.html b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/EventsPage.html
index 8dcb37a..5f05b55 100644
--- a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/EventsPage.html
+++ b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/EventsPage.html
@@ -7,8 +7,7 @@
<body>
<wicket:extend>
- <h1>Confgiration</h1>
-
+ <h1>Configuration</h1>
<p>
In this place you will be able to manage configurations.
</p>
diff --git a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/FeaturesPage.html b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/FeaturesPage.html
index 366eb8f..0c8cd87 100644
--- a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/FeaturesPage.html
+++ b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/FeaturesPage.html
@@ -1,58 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
<wicket:head>
-
<title>Karaf Wicket console - Features page</title>
-
- <!--
- <style type="text/css">
- tr.system {
- background-color: #CC6600;
- }
-
- tr.framework {
- background-color: #EAB988;
- }
-
- tr.blueprint {
- background-color: #FDF8F2;
- }
-
- tr.spring {
- background-color: #D5D50D;
- }
- </style>
- -->
</wicket:head>
<body>
-
- <wicket:extend>
-
+ <wicket:extend>
<h1>Features</h1>
-
- <!--
- <table>
- <tr>
- <th>State</th>
- <th>Version</th>
- <th>Name</th>
- <th>Repository</th>
- <th>Description</th>
- </tr>
-
- <tr wicket:id="features">
- <td wicket:id="state">State</td>
- <td wicket:id="version">Version</td>
- <td wicket:id="name">Name</td>
- <td wicket:id="repository">Repository</td>
- <td wicket:id="description">Description</td>
- <td>
- <a href="FeatureDetailsPage.html" wicket:id="featuresDetailsPageLink">details</a>
- </td>
- </tr>
- </table>
- -->
<table wicket:id="features" class="dataview"/>
</wicket:extend>
</body>
diff --git a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/HomePage.html b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/HomePage.html
index 3758f44..06b4ddc 100644
--- a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/HomePage.html
+++ b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/HomePage.html
@@ -1,35 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
<wicket:head>
-
<title>Karaf Wicket console</title>
-
- <style type="text/css">
- tr.system {
- background-color: #CC6600;
- }
-
- tr.framework {
- background-color: #EAB988;
- }
-
- tr.blueprint {
- background-color: #FDF8F2;
- }
-
- tr.spring {
- background-color: #D5D50D;
- }
- </style>
-
</wicket:head>
<body>
-
<wicket:extend>
-
<h1>Bundles</h1>
-
<table>
<tr>
<th>ID</th>
diff --git a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.html b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.html
index cf2fe54..16c92bb 100644
--- a/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.html
+++ b/osgi/src/main/resources/org/apache/karaf/webconsole/osgi/internal/RepositoriesPage.html
@@ -5,10 +5,8 @@
</wicket:head>
<body>
-
<wicket:extend>
<h1>Feature Repositories</h1>
-
<table wicket:id="repositories" class="dataview"/>
</wicket:extend>
</body>