aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-gwt/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-06-08 23:17:39 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-06-08 23:18:05 +0200
commit88804cbff751b89ffb818daf5a99237e0d6f721b (patch)
tree79e3f759be63689845a21cf577f79898ce3c77a7 /plugins/sonar-core-gwt/src
parent2233993388ae63625d926099903a9b697a062409 (diff)
downloadsonarqube-88804cbff751b89ffb818daf5a99237e0d6f721b.tar.gz
sonarqube-88804cbff751b89ffb818daf5a99237e0d6f721b.zip
SONAR-2414 remove the Clouds page written in GWT
Diffstat (limited to 'plugins/sonar-core-gwt/src')
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/Clouds.java42
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/Calculator.java119
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/GwtClouds.java197
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/CloudElement.java53
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/Color.java50
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/ClassCloudsWidget.java146
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/TabWidget.java77
-rw-r--r--plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtClouds.gwt.xml11
-rw-r--r--plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtCloudsDev.gwt.xml6
-rw-r--r--plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/clouds.css29
-rw-r--r--plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/test.html39
11 files changed, 0 insertions, 769 deletions
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/Clouds.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/Clouds.java
deleted file mode 100644
index 946fb6a0b63..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/Clouds.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds;
-
-import org.sonar.api.resources.Resource;
-import org.sonar.api.web.GwtPage;
-import org.sonar.api.web.NavigationSection;
-import org.sonar.api.web.ResourceScope;
-import org.sonar.api.web.UserRole;
-import org.sonar.plugins.core.clouds.client.GwtClouds;
-
-@NavigationSection(NavigationSection.RESOURCE)
-@ResourceScope({Resource.SCOPE_SET, Resource.SCOPE_SPACE})
-@UserRole(UserRole.USER)
-public class Clouds extends GwtPage {
-
- public String getGwtId() {
- return GwtClouds.GWT_ID;
- }
-
- public String getTitle() {
- return "Clouds";
- }
-
-} \ No newline at end of file
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/Calculator.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/Calculator.java
deleted file mode 100644
index c63e667f989..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/Calculator.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds.client;
-
-import org.sonar.plugins.core.clouds.client.model.Color;
-
-public class Calculator {
-
- private Float minValue;
- private Float maxValue;
- private Float minPercent;
- private Float maxPercent;
-
- public Calculator(Float minPercent, Float maxPercent) {
- this.minPercent = minPercent;
- this.maxPercent = maxPercent;
- }
-
- public void updateMaxAndMin(Float value){
- updateMaxValue(value);
- updateMinValue(value);
- }
-
- public Integer getFontSizePercent(Integer value) {
- float divisor = getMaxValue() - getMinValue();
- float size = getMinPercent();
- if (divisor != 0) {
- float multiplier = (getMaxPercent() - getMinPercent()) / divisor;
- size = getMinPercent() +
- ((getMaxValue() - (getMaxValue() - (value - getMinValue()))) * multiplier);
- }
- return Float.valueOf(size).intValue();
- }
-
- public String getFontColor(float value) {
- float interval = (getMaxPercent() - getMinPercent()) / 2f;
- float mean = (getMinPercent() + getMaxPercent()) / 2f;
-
- Color minColor = new Color(191/255f, 0f, 21/255f); // red
- Color meanColor = new Color(77/255f, 5/255f, 177/255f); // purple
- Color maxColor = new Color(23/255f, 96/255f, 191/255f); // blue
-
- Color color;
- if (value > mean) {
- float valuePercent = ((value - mean) / interval) * 100f;
- color = mixColorWith(maxColor, meanColor, valuePercent);
- } else {
- float valuePercent = ((mean - value) / interval) * 100f;
- color = mixColorWith(minColor, meanColor, valuePercent);
- }
-
- int r = Float.valueOf(color.getRed()* 255f).intValue();
- int g = Float.valueOf(color.getGreen() * 255f).intValue();
- int b = Float.valueOf(color.getBlue() * 255f).intValue();
-
- return ("rgb("+ r +","+ g +","+ b +")");
- }
-
- private Color mixColorWith(Color currentColor, Color mask, float value){
- float opacity = value / 100f;
-
- float r = (currentColor.getRed() * opacity) + (mask.getRed() * (1f - opacity));
- float g = (currentColor.getGreen() * opacity) + (mask.getGreen() * (1f - opacity));
- float b = (currentColor.getBlue() * opacity) + (mask.getBlue() * (1f - opacity));
-
- return new Color(r, g, b);
- }
-
-
- private void updateMaxValue(Float value) {
- if (maxValue == null) {
- maxValue = value;
- } else if (value > maxValue) {
- maxValue = value;
- }
- }
-
- private void updateMinValue(Float value) {
- if (minValue == null) {
- minValue = value;
- } else if (value < minValue) {
- minValue = value;
- }
- }
-
-
- public Float getMinValue() {
- return minValue;
- }
-
- public Float getMaxValue() {
- return maxValue;
- }
-
- public Float getMinPercent() {
- return minPercent;
- }
-
- public Float getMaxPercent() {
- return maxPercent;
- }
-}
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/GwtClouds.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/GwtClouds.java
deleted file mode 100644
index 9b07b53d915..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/GwtClouds.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds.client;
-
-import com.google.gwt.core.client.JavaScriptException;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.ui.*;
-import org.sonar.api.web.gwt.client.AbstractPage;
-import org.sonar.api.web.gwt.client.ResourceDictionary;
-import org.sonar.api.web.gwt.client.webservices.*;
-import org.sonar.api.web.gwt.client.webservices.WSMetrics.Metric;
-import org.sonar.api.web.gwt.client.webservices.WSMetrics.MetricsList;
-import org.sonar.api.web.gwt.client.widgets.LoadingLabel;
-import org.sonar.plugins.core.clouds.client.widget.ClassCloudsWidget;
-import org.sonar.plugins.core.clouds.client.widget.TabWidget;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class GwtClouds extends AbstractPage {
-
- public static final String GWT_ID = "org.sonar.plugins.core.clouds.GwtClouds";
-
- private Panel cloudsPanel;
- private ListBox metricsListBox;
- private Label sizeAndColorLabel;
- private TabWidget sizeTabs;
- private Resources resources;
-
- private final List<SizeMetric> SIZE_METRICS = Arrays.asList(
- new SizeMetric("Quick Wins", WSMetrics.NCLOC),
- new SizeMetric("Top risk", WSMetrics.FUNCTION_COMPLEXITY));
-
- private final List<Metric> COLOR_METRICS = Arrays.asList(WSMetrics.COVERAGE, WSMetrics.VIOLATIONS_DENSITY);
-
- public void onModuleLoad() {
- cloudsPanel = new FlowPanel();
- displayView(cloudsPanel);
- loadClouds();
- }
-
- protected void loadClouds() {
- String projectKey = ResourceDictionary.getResourceKey();
- final List<Metric> metricsToGet = new ArrayList<Metric>();
- for (SizeMetric size : SIZE_METRICS) {
- metricsToGet.add(size.getSizeMetric());
- }
- for (Metric color : COLOR_METRICS) {
- metricsToGet.add(color);
- }
- if (projectKey != null) {
- cloudsPanel.add(new LoadingLabel());
-
- Query<Resources> resourcesQuery = ResourcesQuery.get(projectKey).setDepth(-1).setScopes(Resource.SCOPE_ENTITY).setMetrics(metricsToGet);
- QueryCallBack<Resources> resourcesCb = new BaseQueryCallback<Resources>() {
- public void onResponse(Resources response, JavaScriptObject jsonRawResponse) {
- resources = response;
- }
- };
- Query<MetricsList> metrics = MetricsQuery.get().setUserManaged(false);
- QueryCallBack<MetricsList> metricsCb = new BaseQueryCallback<MetricsList>() {
- public void onResponse(MetricsList response, JavaScriptObject jsonRawResponse) {
- // nothing to do WSMetrics.getUpdateMetricsFromServer will update the metrics labels
- }
- };
- metricsCb = WSMetrics.getUpdateMetricsFromServer(metricsCb);
-
- QueryCallBack<VoidResponse> updateCloudsCb = new BaseQueryCallback<VoidResponse>() {
- public void onResponse(VoidResponse response, JavaScriptObject jsonRawResponse) {
- updateClouds(resources);
- }
- };
-
- SequentialQueries.get().add(resourcesQuery, resourcesCb).add(metrics, metricsCb).execute(updateCloudsCb);
- }
- }
-
- private void updateClouds(Resources resources) {
- cloudsPanel.clear();
- Panel metricSelectPanel = getMetricColorSelectBox(resources);
- sizeTabs = new TabWidget(new SelectionHandler<Integer>() {
- public void onSelection(SelectionEvent<Integer> event) {
- renderClassCloudsForCurrentMetric();
- }
- });
- for (SizeMetric size : SIZE_METRICS) {
- ClassCloudsWidget classCloudsTab = new ClassCloudsWidget(resources.getResources(), size.getSizeMetric());
- sizeTabs.addTab(classCloudsTab, size.getTabName(), size.getTabNameId());
- }
-
- cloudsPanel.add(metricSelectPanel);
- cloudsPanel.add(sizeTabs);
- }
-
- private Panel getMetricColorSelectBox(Resources resources) {
- HTMLPanel metricSelectPanel = new HTMLPanel("<div id='select_metric' class='metricSelectBox small'> </div>");
- sizeAndColorLabel = new InlineLabel();
- sizeAndColorLabel.setStyleName("labelText gray");
- metricSelectPanel.add(sizeAndColorLabel, "select_metric");
- metricsListBox = new ListBox(false);
- for (Metric color : COLOR_METRICS) {
- if (resources.onceContainsMeasure(color)) {
- metricsListBox.addItem(color.getName(), color.getKey());
- }
- }
- metricSelectPanel.add(metricsListBox, "select_metric");
-
- metricsListBox.addChangeHandler(new ChangeHandler() {
- public void onChange(ChangeEvent event) {
- renderClassCloudsForCurrentMetric();
- }
- });
- return metricSelectPanel;
- }
-
- private void generateSizeAndColorLabel() {
- sizeAndColorLabel.setText("Size : " + getCurrentSizeMetric().getName() + ", color : ");
- }
-
- private void renderClassCloudsForCurrentMetric() {
- Widget widget = sizeTabs.getSelectedWidget();
- if (widget instanceof ClassCloudsWidget) {
- Metric current = getCurrentColorMetric();
- ClassCloudsWidget classCloudsWidget = (ClassCloudsWidget) widget;
- classCloudsWidget.generateCloud(current);
- generateSizeAndColorLabel();
- }
- }
-
- private Metric getCurrentColorMetric() {
- String metricKey = metricsListBox.getValue(metricsListBox.getSelectedIndex());
- for (Metric color : COLOR_METRICS) {
- if (color.getKey().equals(metricKey)) {
- return color;
- }
- }
- throw new JavaScriptException("Unable to find metric " + metricKey);
- }
-
- private Metric getCurrentSizeMetric() {
- String selectedTabId = sizeTabs.getSelectedTabId();
- for (SizeMetric size : SIZE_METRICS) {
- if (size.getTabNameId().equals(selectedTabId)) {
- return size.sizeMetric;
- }
- }
- throw new JavaScriptException("Unable to find metric for tab " + selectedTabId);
- }
-
-
- private class SizeMetric {
-
- private String tabName;
- private Metric sizeMetric;
-
- public SizeMetric(String tabName, Metric sizeMetric) {
- super();
- this.tabName = tabName;
- this.sizeMetric = sizeMetric;
- }
-
- public String getTabName() {
- return tabName;
- }
-
- public Metric getSizeMetric() {
- return sizeMetric;
- }
-
- public String getTabNameId() {
- return tabName.toLowerCase().replace(' ', '_');
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/CloudElement.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/CloudElement.java
deleted file mode 100644
index 08bcac836b0..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/CloudElement.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds.client.model;
-
-import org.sonar.api.web.gwt.client.webservices.Resource;
-
-
-public class CloudElement implements Comparable<CloudElement> {
-
- private Integer fontSize;
- private Float fontColor;
- private Resource resource;
-
- public CloudElement(Resource resource, Integer fontSize, Float fontColor) {
- this.resource = resource;
- this.fontSize = fontSize;
- this.fontColor = fontColor;
- }
-
- public Resource getResource() {
- return resource;
- }
-
- public Integer getFontSize() {
- return fontSize;
- }
-
- public Float getFontColor() {
- return fontColor;
- }
-
- public int compareTo(CloudElement cloudElement) {
- return resource.getName().compareTo(cloudElement.getResource().getName());
- }
-
-}
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/Color.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/Color.java
deleted file mode 100644
index d3f8f6f988e..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/model/Color.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds.client.model;
-
-public class Color {
-
- private float red;
- private float green;
- private float blue;
-
- public Color(float red, float green, float blue) {
- this.red = red;
- this.green = green;
- this.blue = blue;
- }
-
- public float getRed() {
- return red;
- }
-
- public float getGreen() {
- return green;
- }
-
- public float getBlue() {
- return blue;
- }
-
- @Override
- public String toString() {
- return ("red : "+ red + ", green : "+ green + ", blue : "+ blue );
- }
-}
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/ClassCloudsWidget.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/ClassCloudsWidget.java
deleted file mode 100644
index d3233fd8519..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/ClassCloudsWidget.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds.client.widget;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.*;
-import org.sonar.api.web.gwt.client.Utils;
-import org.sonar.api.web.gwt.client.webservices.Measure;
-import org.sonar.api.web.gwt.client.webservices.Resource;
-import org.sonar.api.web.gwt.client.webservices.WSMetrics.Metric;
-import org.sonar.api.web.gwt.client.widgets.LoadingLabel;
-import org.sonar.plugins.core.clouds.client.Calculator;
-import org.sonar.plugins.core.clouds.client.GwtClouds;
-import org.sonar.plugins.core.clouds.client.model.CloudElement;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class ClassCloudsWidget extends Composite {
-
- private Panel main;
- private Metric sizeMetric;
- private List<Resource> resources;
- private float minSizePercent = 60f;
- private float maxSizePercent = 240f;
-
- private Calculator sizeCalculator = new Calculator(minSizePercent, maxSizePercent);
- private Calculator colorCalculator = new Calculator(0f, 100f);
-
- public ClassCloudsWidget(List<Resource> resources, Metric sizeMetric) {
- this.sizeMetric = sizeMetric;
- this.main = new FlowPanel();
- this.resources = resources;
- initWidget(main);
- }
-
- public Metric getSizeMetric() {
- return sizeMetric;
- }
-
- public void generateCloud(Metric colorMetric) {
- main.clear();
- LoadingLabel loading = new LoadingLabel();
- main.add(loading);
- if (colorMetric.equals(colorMetric)) {
- List<CloudElement> cloudElements = getCloudElements(resources, colorMetric);
- createClouds(cloudElements, colorMetric);
- }
- main.remove(loading);
- }
-
- private List<CloudElement> getCloudElements(List<Resource> resources, Metric colorMetric) {
- List<CloudElement> tagList = new ArrayList<CloudElement>();
- for (Resource resource : resources) {
- Measure sizeMeasure = getMeasure(resource, sizeMetric);
- Measure colorMeasure = getMeasure(resource, colorMetric);
-
- if (sizeMeasure != null && colorMeasure != null) {
- Integer size = getMeasureValue(sizeMeasure.getValue());
- float color = colorMeasure.getValue().floatValue();
- tagList.add(new CloudElement(resource, size, color));
- sizeCalculator.updateMaxAndMin(Float.valueOf(size.toString()));
- }
- }
- Collections.sort(tagList);
- return tagList;
- }
-
- private Integer getMeasureValue(Double value) {
- Float floatValue = (value.floatValue() * 100.0f);
- return floatValue.intValue();
- }
-
- private Measure getMeasure(Resource project, Metric metricToFind) {
- return project.getMeasure(metricToFind);
- }
-
- private void createClouds(List<CloudElement> cloudElements, Metric colorMetric) {
- for (CloudElement tag : cloudElements) {
- HTML className = new HTML(
- "<span style=\"font-size:" + Integer.toString(sizeCalculator.getFontSizePercent(tag.getFontSize())) +
- "%; color:" + colorCalculator.getFontColor(tag.getFontColor()) + "\" >" +
- tag.getResource().getName() + "</span>\n");
- className.setStyleName("inline");
-
- Hyperlink link = createLink(tag, colorMetric);
- link.setHTML(className.getHTML());
- main.add(link);
- }
- }
-
- private Hyperlink createLink(CloudElement tag, final Metric colorMetric) {
- Hyperlink link = new Hyperlink();
- link.setStyleName("tag inline");
- String tooltip = getTooltip(tag.getResource(), colorMetric);
- link.getElement().setAttribute("title", tooltip);
- link.getElement().setAttribute("rel", tooltip);
-
- String sizeCss = Float.toString(maxSizePercent / 100f) + "em";
- link.setHeight(sizeCss);
- final Resource clickResource = tag.getResource();
- link.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent event) {
- if (clickResource.getCopy() != null) {
- Window.Location.assign(Utils.getServerUrl() + "/plugins/resource/" + clickResource.getCopy() + "?page=" + GwtClouds.GWT_ID);
- } else {
- Utils.openResourcePopup(clickResource, colorMetric.getKey());
- }
- }
- });
-
- return link;
- }
-
- private String getTooltip(Resource resource, Metric colorMetric) {
- Measure sizeMeasure = getMeasure(resource, sizeMetric);
- String sizeMetricName = sizeMetric.getName();
- String sizeMetricValue = sizeMeasure.getFormattedValue();
-
- Measure colorMeasure = getMeasure(resource, colorMetric);
- String colorMetricName = colorMetric.getName();
- String colorMetricValue = colorMeasure.getFormattedValue();
-
- return resource.getName(true) + ", " + sizeMetricName + " : " + sizeMetricValue + ", " + colorMetricName + " : " + colorMetricValue;
- }
-}
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/TabWidget.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/TabWidget.java
deleted file mode 100644
index ace9d651a01..00000000000
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/clouds/client/widget/TabWidget.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.clouds.client.widget;
-
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.TabPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class TabWidget extends Composite {
-
- private TabPanel tab = new TabPanel();
-
- private Integer nbTab;
- private final Integer defaultSelectedTabPosition = 0;
- private String selectedTabId;
- private int selectedIndex;
-
- public TabWidget(final SelectionHandler<Integer> selectionListener) {
- nbTab = 0;
- initWidget(tab);
- tab.setWidth("100%");
-
- tab.addSelectionHandler(new SelectionHandler<Integer>() {
- public void onSelection(SelectionEvent<Integer> event) {
- selectedTabId = tab.getWidget(event.getSelectedItem()).getElement().getId().replace("_tab_content", "");
- selectedIndex = event.getSelectedItem();
- selectionListener.onSelection(event);
- }
- });
-
- }
-
- public String getSelectedTabId() {
- return selectedTabId;
- }
-
- public Widget getSelectedWidget() {
- return tab.getWidget(selectedIndex);
- }
-
- public void addTab(Widget widget, String tabName, String id) {
- widget.getElement().setId(id + "_tab_content");
- tab.add(widget, createTabLabel(tabName, id));
- if (nbTab.equals(defaultSelectedTabPosition)) {
- tab.selectTab(defaultSelectedTabPosition);
- }
- nbTab++;
- }
-
- private Label createTabLabel(String tabName, String id) {
- Label tabLabel = new Label(tabName);
- tabLabel.getElement().setId(id + "_tab_title");
- tabLabel.addStyleName("tab_title");
- return tabLabel;
- }
-
-}
diff --git a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtClouds.gwt.xml b/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtClouds.gwt.xml
deleted file mode 100644
index cde524c0f66..00000000000
--- a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtClouds.gwt.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<module>
- <inherits name="com.google.gwt.user.User"/>
- <inherits name="com.google.gwt.json.JSON"/>
- <inherits name="com.google.gwt.http.HTTP"/>
- <inherits name="org.sonar.api.web.gwt.Sonar"/>
-
- <stylesheet src="clouds.css"/>
-
- <entry-point class="org.sonar.plugins.core.clouds.client.GwtClouds"/>
-
-</module>
diff --git a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtCloudsDev.gwt.xml b/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtCloudsDev.gwt.xml
deleted file mode 100644
index 9d3f64f412a..00000000000
--- a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/GwtCloudsDev.gwt.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<module rename-to="org.sonar.plugins.core.clouds.GwtClouds">
- <inherits name="org.sonar.plugins.core.clouds.GwtClouds"/>
- <inherits name="org.sonar.SonarDev"/>
-
- <entry-point class="org.sonar.plugins.core.clouds.client.GwtClouds"/>
-</module>
diff --git a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/clouds.css b/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/clouds.css
deleted file mode 100644
index c2790c3c95c..00000000000
--- a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/clouds.css
+++ /dev/null
@@ -1,29 +0,0 @@
-.tag {
- padding: 0px;
- cursor: pointer;
-}
-
-.inline{
- display: inline;
-}
-
-a {
- border-bottom: 0 none;
-}
-
-.tab_title {
- white-space: nowrap;
-}
-
-.metricSelectBox {
- float: right;
-}
-
-.metricSelectBox .labelText {
- padding-top: 2px;
- padding-right: 5px;
-
-}
-
-
-
diff --git a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/test.html b/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/test.html
deleted file mode 100644
index c4292e18121..00000000000
--- a/plugins/sonar-core-gwt/src/main/resources/org/sonar/plugins/core/clouds/public/test.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Clouds xxx</title>
- <link href="http://localhost:9000/dev/stylesheets/yui-2.6.0.css" media="all" rel="Stylesheet" type="text/css"/>
- <link href="http://localhost:9000/dev/stylesheets/style.css" media="all" rel="Stylesheet" type="text/css"/>
- <script src="http://localhost:9000/dev/javascripts/application.js" type="text/javascript"></script>
- <script src="http://localhost:9000/dev/javascripts/prototype.js" type="text/javascript"></script>
- <script src="http://localhost:9000/dev/javascripts/scriptaculous.js" type="text/javascript"></script>
-</head>
-
-<body>
-<script type="text/javascript">
- var config = {
- "sonar_url": "http://localhost:9000/dev",
- "resource_key" : "org.codehaus.sonar:sonar-plugin-api",
- "permalink_url_base" : "http://localhost:9000/dev/views/project/org.codehaus.sonar:sonar/org.sonar.plugins.core.clouds.GwtClouds?foo=bar"
- };
-</script>
-
-<div class="error" id="error" style="display:none"><span id="errormsg"></span> &nbsp;&nbsp;[<a href="#"
- onclick="javascript:$('error').hide();return false;">hide</a>]
-</div>
-<div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#"
- onclick="javascript:$('warning').hide();return false;">hide</a>]
-</div>
-<div class="notice" id="info" style="display:none"><span id="infomsg"></span> &nbsp;&nbsp;[<a href="#"
- onclick="javascript:$('info').hide();return false;">hide</a>]
-</div>
-
-<div id="gwtpage">
-</div>
-
-<script type="text/javascript" language="javascript" src="org.sonar.plugins.core.clouds.GwtClouds.nocache.js"></script>
-</body>
-</html> \ No newline at end of file