From ccf7a7dec709978abe21faba5bed51697f67df64 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Sat, 8 Jun 2013 14:15:23 +0200 Subject: [PATCH] Updated some libs; Added the remaining charts to a XYPLot display --- ...i-2.1.7.LICENSE => jsf-api-2.1.22.LICENSE} | 0 ...-2.1.7.LICENSE => jsf-impl-2.1.22.LICENSE} | 0 Kieker.WebGUI/pom.xml | 4 +- .../web/beans/view/CurrentCockpitBean.java | 55 ++++++++----------- Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml | 2 +- .../src/main/webapp/pages/CockpitPage.xhtml | 2 +- .../webgui/web/utility/CockpitLayoutTest.java | 2 +- 7 files changed, 28 insertions(+), 37 deletions(-) rename Kieker.WebGUI/lib/{jsf-api-2.1.7.LICENSE => jsf-api-2.1.22.LICENSE} (100%) rename Kieker.WebGUI/lib/{jsf-impl-2.1.7.LICENSE => jsf-impl-2.1.22.LICENSE} (100%) diff --git a/Kieker.WebGUI/lib/jsf-api-2.1.7.LICENSE b/Kieker.WebGUI/lib/jsf-api-2.1.22.LICENSE similarity index 100% rename from Kieker.WebGUI/lib/jsf-api-2.1.7.LICENSE rename to Kieker.WebGUI/lib/jsf-api-2.1.22.LICENSE diff --git a/Kieker.WebGUI/lib/jsf-impl-2.1.7.LICENSE b/Kieker.WebGUI/lib/jsf-impl-2.1.22.LICENSE similarity index 100% rename from Kieker.WebGUI/lib/jsf-impl-2.1.7.LICENSE rename to Kieker.WebGUI/lib/jsf-impl-2.1.22.LICENSE diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index 07a17f9b..5a634ebb 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -138,12 +138,12 @@ <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-api</artifactId> - <version>2.1.7</version> + <version>2.1.22</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> - <version>2.1.7</version> + <version>2.1.22</version> </dependency> <dependency> <groupId>junit</groupId> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java index cac899a9..4d72e91e 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java @@ -25,10 +25,8 @@ import java.util.concurrent.atomic.AtomicLong; import javax.faces.application.Application; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; -import javax.faces.component.UISelectItem; import javax.faces.component.html.HtmlOutputText; import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; import kieker.analysis.AnalysisController; import kieker.analysis.model.analysisMetaModel.MIDisplayConnector; @@ -50,7 +48,6 @@ import org.primefaces.component.chart.line.LineChart; import org.primefaces.component.chart.metergauge.MeterGaugeChart; import org.primefaces.component.dashboard.Dashboard; import org.primefaces.component.panel.Panel; -import org.primefaces.component.selectcheckboxmenu.SelectCheckboxMenu; import org.primefaces.component.tagcloud.TagCloud; import org.primefaces.model.DashboardColumn; import org.primefaces.model.DashboardModel; @@ -476,6 +473,7 @@ public class CurrentCockpitBean { // Add the corresponding model tagCloudModel = new DefaultTagCloudModel(); tagCloud.setModel(tagCloudModel); + tagCloud.setStyle("width: 100%; Height: 100%;"); component.getChildren().clear(); component.getChildren().add(tagCloud); @@ -485,7 +483,6 @@ public class CurrentCockpitBean { final Object displayObj = this.projectService.getDisplay(this.projectName, this.activeView.getName(), displayConnectorName); final Map<String, AtomicLong> counters = (Map<String, AtomicLong>) new Mirror().on(displayObj).invoke().method("getCounters").withoutArgs(); - System.out.println(counters); tagCloudModel.clear(); for (final Map.Entry<String, AtomicLong> counter : counters.entrySet()) { tagCloudModel.addTag(new DefaultTagCloudItem(counter.getKey(), (int) counter.getValue().get())); @@ -574,60 +571,54 @@ public class CurrentCockpitBean { private void updateXYPlotDisplay(final UIComponent component, final String displayConnectorName) { final boolean isAlreadyCorrectlyInitialized = (component.getChildCount() == 1) && (component.getChildren().get(0) instanceof LineChart); - final LineChartSeries lineChartSeries; - final SelectCheckboxMenu selectCheckboxMenu; + final LineChart lineChart; + final CartesianChartModel linearModel; // Avoid unnecessary component creation. Use the existing components if they are already existing and from the correct type. if (isAlreadyCorrectlyInitialized) { - final LineChart lineChart = (LineChart) component.getChildren().get(0); - lineChartSeries = (LineChartSeries) ((CartesianChartModel) lineChart.getValue()).getSeries().get(0); - selectCheckboxMenu = (SelectCheckboxMenu) component.getChildren().get(1); + lineChart = (LineChart) component.getChildren().get(0); + linearModel = (CartesianChartModel) lineChart.getValue(); } else { final FacesContext facesContext = FacesContext.getCurrentInstance(); final Application application = facesContext.getApplication(); // Create the Primefaces chart component - final LineChart lineChart = (LineChart) application.createComponent(facesContext, "org.primefaces.component.chart.LineChart", + lineChart = (LineChart) application.createComponent(facesContext, "org.primefaces.component.chart.LineChart", "org.primefaces.component.chart.LineChartRenderer"); lineChart.setTitle(displayConnectorName); + lineChart.setLegendPosition("e"); // Add the corresponding model - final CartesianChartModel linearModel = new CartesianChartModel(); - lineChartSeries = new LineChartSeries(); - lineChartSeries.setLabel("Series"); - - linearModel.addSeries(lineChartSeries); + linearModel = new CartesianChartModel(); lineChart.setValue(linearModel); - // Create the Primefaces drop box - selectCheckboxMenu = (SelectCheckboxMenu) application.createComponent(facesContext, "org.primefaces.component.SelectCheckboxMenu", - "org.primefaces.component.SelectCheckboxMenuRenderer"); - component.getChildren().clear(); component.getChildren().add(lineChart); - component.getChildren().add(selectCheckboxMenu); } try { final Object displayObj = this.projectService.getDisplay(this.projectName, this.activeView.getName(), displayConnectorName); final Set<String> keys = (Set<String>) new Mirror().on(displayObj).invoke().method("getKeys").withoutArgs(); - selectCheckboxMenu.getChildren().clear(); - for (final String key : keys) { - final UISelectItem item = new UISelectItem(); - item.setValue(new SelectItem(key)); - selectCheckboxMenu.getChildren().add(item); - } + lineChart.setLegendCols((int) (Math.ceil(keys.size() / 10.0))); + linearModel.clear(); if (keys.isEmpty()) { - lineChartSeries.set(0, 0); + final LineChartSeries series = new LineChartSeries(); + series.set(0, 0); + linearModel.addSeries(series); } else { - final Map<Object, Number> entries = (Map<Object, Number>) new Mirror().on(displayObj).invoke().method("getEntries").withArgs(keys.iterator().next()); + for (final String key : keys) { + final Map<Object, Number> entries = (Map<Object, Number>) new Mirror().on(displayObj).invoke().method("getEntries").withArgs(key); + final LineChartSeries lineChartSeries = new LineChartSeries(); + lineChartSeries.setLabel(key); - if (entries.isEmpty()) { - lineChartSeries.set(0, 0); - } else { - lineChartSeries.setData(entries); + if (entries.isEmpty()) { + lineChartSeries.set(0, 0); + } else { + lineChartSeries.setData(entries); + } + linearModel.addSeries(lineChartSeries); } } } catch (final DisplayNotFoundException ex) { diff --git a/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml b/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml index 720357f1..e71dd05d 100644 --- a/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml +++ b/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml @@ -13,7 +13,7 @@ <!-- This parameter determines the current stage of the project. --> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> - <param-value>Development</param-value> + <param-value>Production</param-value> </context-param> <!-- This parameter makes sure that the primefaces theme chooser will work. --> diff --git a/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml index a82251cd..8180cc7f 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml @@ -15,7 +15,7 @@ <ui:param name="projectName" value="#{currentCockpitBean.projectName}"/> <ui:param name="pagename" value="cockpit"/> <ui:param name="showProjectName" value="true"/> - + <ui:define name="metaData"> <f:metadata> <f:viewParam name="projectName" value="#{currentCockpitBean.projectName}"/> diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/web/utility/CockpitLayoutTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/web/utility/CockpitLayoutTest.java index fec1607d..bb2ae998 100644 --- a/Kieker.WebGUI/src/test/java/kieker/webgui/web/utility/CockpitLayoutTest.java +++ b/Kieker.WebGUI/src/test/java/kieker/webgui/web/utility/CockpitLayoutTest.java @@ -367,6 +367,6 @@ public class CockpitLayoutTest { Assert.assertEquals("Invalid layout", displayConnector2, layout1.get(0).get(1)); Assert.assertEquals("Invalid layout", displayConnector3, layout1.get(0).get(2)); Assert.assertEquals("Invalid layout", displayConnector4, layout2.get(0).get(0)); - } + } -- GitLab