<execution>
<configuration>
<modules>
- <module>org.sonar.plugins.core.clouds.GwtClouds${gwt.permutationSuffix}</module>
<module>org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer${gwt.permutationSuffix}</module>
<module>org.sonar.plugins.core.testdetailsviewer.TestsViewer${gwt.permutationSuffix}</module>
<module>org.sonar.plugins.core.hotspots.GwtHotspots${gwt.permutationSuffix}</module>
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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());
- }
-
-}
+++ /dev/null
-/*
- * 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 );
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-
-}
+++ /dev/null
-<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>
+++ /dev/null
-<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>
+++ /dev/null
-.tag {\r
- padding: 0px;\r
- cursor: pointer;\r
-}\r
-\r
-.inline{\r
- display: inline;\r
-}\r
-\r
-a {\r
- border-bottom: 0 none;\r
-}\r
-\r
-.tab_title {\r
- white-space: nowrap;\r
-}\r
-\r
-.metricSelectBox {\r
- float: right;\r
-}\r
-\r
-.metricSelectBox .labelText {\r
- padding-top: 2px;\r
- padding-right: 5px;\r
- \r
-}\r
-\r
-\r
-\r
+++ /dev/null
-<!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> [<a href="#"
- onclick="javascript:$('error').hide();return false;">hide</a>]
-</div>
-<div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> [<a href="#"
- onclick="javascript:$('warning').hide();return false;">hide</a>]
-</div>
-<div class="notice" id="info" style="display:none"><span id="infomsg"></span> [<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
import org.sonar.plugins.core.charts.DistributionAreaChart;
import org.sonar.plugins.core.charts.DistributionBarChart;
import org.sonar.plugins.core.charts.XradarChart;
-import org.sonar.plugins.core.clouds.Clouds;
import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
import org.sonar.plugins.core.duplicationsviewer.DuplicationsViewerDefinition;
import org.sonar.plugins.core.hotspots.Hotspots;
// pages
extensions.add(DuplicationsViewerDefinition.class);
extensions.add(TestsViewerDefinition.class);
- extensions.add(Clouds.class);
extensions.add(Hotspots.class);
// widgets
<packaging>jar</packaging>
<name>Sonar :: Plugin API</name>
<build>
- <resources>
- <!-- sources of Sonar GWT library -->
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**/org/sonar/api/web/gwt/**/*</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
-
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-incubator</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-lgpl</artifactId>
+++ /dev/null
-/*
- * 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.api.web.gwt.client;
-
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * @deprecated since 2.0, use the lib sonar-gwt-api
- */
-@Deprecated
-public abstract class AbstractPage implements EntryPoint {
-
- protected void displayView(Widget widget) {
- Element loading = DOM.getElementById("loading");
- if (loading != null) {
- DOM.removeChild(getRootPanel().getElement(), loading);
- }
- getRootPanel().add(widget);
- }
-
- protected RootPanel getRootPanel() {
- RootPanel rootPanel = RootPanel.get("gwtpage-" + GWT.getModuleName());
- if (rootPanel == null) {
- rootPanel = RootPanel.get("gwtpage");
- }
- return rootPanel;
- }
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client;
-
-import com.google.gwt.i18n.client.Dictionary;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public final class ResourceDictionary {
-
- public final static String CONF_PERMALINK_BASE = "permalink_url_base";
- public final static String CONF_RESOURCE_KEY = "resource_key";
- public final static String CONF_V_RESOURCE_KEY = "viewer_resource_key";
- public final static String CONF_V_PLUGIN_KEY = "viewer_plugin_key";
- public final static String CONF_V_METRIC_KEY = "metric";
-
- private ResourceDictionary() {
- }
-
- public static String getPermaLinkURLBase() {
- return Utils.getConfiguration(CONF_PERMALINK_BASE);
- }
-
- public static String getResourceKey() {
- return Utils.getConfiguration(CONF_RESOURCE_KEY);
- }
-
- public static String getViewerResourceKey() {
- return Utils.getConfiguration(CONF_V_RESOURCE_KEY);
- }
-
- public static String getViewerPluginKey() {
- return Utils.getConfiguration(CONF_V_PLUGIN_KEY);
- }
-
- public static String getViewerMetricKey() {
- return Utils.getConfiguration(CONF_V_METRIC_KEY);
- }
-
- public static Dictionary getResourceViewers() {
- return Dictionary.getDictionary("resource_viewers");
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client;
-
-import com.google.gwt.i18n.client.Dictionary;
-import com.google.gwt.i18n.client.NumberFormat;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Window;
-import org.sonar.api.web.gwt.client.webservices.Resource;
-
-import java.util.Set;
-
-/**
- * A class of web utility
- *
- * @since 1.10
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public final class Utils {
- private Utils() {
- }
-
- public static String getConfiguration(String key) {
- return getConfiguration(key, null);
- }
-
- public static String getConfiguration(String key, String defaultValue) {
- String result = getDictionaryEntry("config", key);
- if (result == null) {
- result = defaultValue;
- }
- return result;
- }
-
- public static native void setConfiguration(String key, String val) /*-{
- $wnd.config[key] = val;
- }-*/;
-
- public static String getRequestParameter(String key) {
- return getDictionaryEntry("request_parameters", key);
- }
-
- public static Set<String> getConfigurationKeys() {
- return getDictionaryKeys("config");
- }
-
- public static Set<String> getRequestParameterNames() {
- return getDictionaryKeys("request_parameters");
- }
-
- private static String getDictionaryEntry(String dictionaryName, String key) {
- try {
- Dictionary dic = Dictionary.getDictionary(dictionaryName);
- if (dic != null) {
- return dic.get(key);
- }
- return null;
-
- } catch (Exception e) {
- return null;
- }
- }
-
- private static Set<String> getDictionaryKeys(String dictionaryName) {
- Dictionary dic = Dictionary.getDictionary(dictionaryName);
- if (dic != null) {
- return dic.keySet();
- }
- return null;
- }
-
- public static String widgetGWTIdJSEncode(String widgetGWTId) {
- return widgetGWTId.replace('.', '_');
- }
-
- public static String getServerUrl() {
- return getConfiguration("sonar_url");
- }
-
- public static String getServerApiUrl() {
- return getServerUrl() + "/api";
- }
-
- public static String escapeHtml(String maybeHtml) {
- final Element div = DOM.createDiv();
- DOM.setInnerText(div, maybeHtml);
- return DOM.getInnerHTML(div);
- }
-
- public static String formatPercent(String percentage) {
- return percentage == null || percentage.equals("") ? "" : formatPercent(new Double(percentage));
- }
-
- public static String formatPercent(double percentage) {
- return NumberFormat.getFormat("0.0").format(percentage) + "%";
- }
-
- public static String formatNumber(String number) {
- return number == null || number.equals("") ? "" : formatNumber(new Double(number));
- }
-
- public static String formatNumber(double number) {
- return NumberFormat.getDecimalFormat().format(number);
- }
-
- public static native void showError(String message) /*-{
- $wnd.error(message);
- }-*/;
-
- public static native void showWarning(String message) /*-{
- $wnd.warning(message);
- }-*/;
-
- public static native void showInfo(String message) /*-{
- $wnd.info(message);
- }-*/;
-
- /**
- * Display the resource in a popup.
- *
- * @param resource the resource to display, not null
- * @param metricKey the metric to highlight (optional : can be null)
- */
- public static void openResourcePopup(final Resource resource, final String metricKey) {
- String url = Utils.getServerUrl() + "/resource/index/" + resource.getId();
- if (metricKey != null) {
- url += "?" + ResourceDictionary.CONF_V_METRIC_KEY + "=" + metricKey;
- }
- Window.open(url, "resource", "height=800,width=900,scrollbars=1,resizable=1");
- }
-
- public static String getUrlToRuleDescription(final String ruleKey, final boolean showLayout) {
- return Utils.getServerUrl() + "/rules/show/" + ruleKey + "?layout=" + showLayout;
- }
-}
-
-
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-/**
- * @deprecated since 2.5
- */
-@Deprecated
-public abstract class AbstractResourceQuery<R extends ResponsePOJO> extends Query<R> {
-
- private String resourceKey;
-
- protected AbstractResourceQuery(String resourceKey) {
- super();
- this.resourceKey = resourceKey;
- }
-
- public String getResourceKey() {
- return resourceKey;
- }
-
- public void setResourceKey(String resourceKey) {
- this.resourceKey = resourceKey;
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import org.sonar.api.web.gwt.client.Utils;
-import org.sonar.api.web.gwt.client.widgets.LoadingLabel;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public abstract class BaseQueryCallback<P extends ResponsePOJO> implements QueryCallBack<P> {
-
- private LoadingLabel loading;
-
- public BaseQueryCallback() {
- this(null);
- }
-
- public BaseQueryCallback(LoadingLabel loading) {
- super();
- this.loading = loading;
- }
-
- public void onError(int errorCode, String errorMessage) {
- Utils.showError("Error received from server : " + errorCode + " - " + errorMessage);
- if (loading != null) {
- loading.removeFromParent();
- }
- }
-
- public void onTimeout() {
- Utils.showWarning("JSON query response timeout");
- if (loading != null) {
- loading.removeFromParent();
- }
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public abstract class JSONHandlerDispatcher<P extends ResponsePOJO> implements JsonUtils.JSONHandler {
-
- private QueryCallBack<P> callBack;
-
- public JSONHandlerDispatcher(QueryCallBack<P> callBack) {
- super();
- this.callBack = callBack;
- }
-
- public abstract P parseResponse(JavaScriptObject obj);
-
- public void onError(int errorCode, String errorMessage) {
- callBack.onError(errorCode, errorMessage);
- }
-
- public void onResponse(JavaScriptObject obj) {
- P responseObj = parseResponse(obj);
- callBack.onResponse(responseObj, obj);
- }
-
- public void onTimeout() {
- callBack.onTimeout();
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import java.util.Date;
-
-import com.google.gwt.core.client.JavaScriptException;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.json.client.JSONArray;
-import com.google.gwt.json.client.JSONBoolean;
-import com.google.gwt.json.client.JSONNumber;
-import com.google.gwt.json.client.JSONObject;
-import com.google.gwt.json.client.JSONString;
-import com.google.gwt.json.client.JSONValue;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public final class JsonUtils {
- private static int requestId = 0;
-
- private JsonUtils() {
-
- }
-
- public interface JSONHandler {
- void onResponse(JavaScriptObject obj);
-
- void onTimeout();
-
- void onError(int errorCode, String errorMessage);
- }
-
- public static void requestJson(String url, JSONHandler handler) {
- if (!url.endsWith("&") && !url.endsWith("?")) {
- url += "&";
- }
- if (!url.contains("format=json")) {
- url += "format=json&";
- }
- if (!url.contains("callback=")) {
- //IMPORTANT : the url should ended with ?callback= or &callback= for JSONP calls
- url += "callback=";
- }
- makeJSONRequest(requestId++, URL.encode(url), handler);
- }
-
- public static native void makeJSONRequest(int requestId, String url, JSONHandler handler) /*-{
- var callback = "callback" + requestId;
-
- // create SCRIPT tag, and set SRC attribute equal to JSON feed URL + callback function name
- var script = document.createElement("script");
- script.setAttribute("src", url+callback);
- script.setAttribute("type", "text/javascript");
-
- window[callback] = function(jsonObj) {
- @org.sonar.api.web.gwt.client.webservices.JsonUtils::dispatchJSON(Lcom/google/gwt/core/client/JavaScriptObject;Lorg/sonar/api/web/gwt/client/webservices/JsonUtils$JSONHandler;)(jsonObj, handler);
- window[callback + "done"] = true;
- }
-
- setTimeout(function() {
- if (!window[callback + "done"]) {
- handler.@org.sonar.api.web.gwt.client.webservices.JsonUtils.JSONHandler::onTimeout();
- }
-
- // cleanup
- document.body.removeChild(script);
- if (window[callback]) {
- delete window[callback];
- }
- if (window[callback + "done"]) {
- delete window[callback + "done"];
- }
- }, 120000);
-
- document.body.appendChild(script);
- }-*/;
-
- public static void dispatchJSON(JavaScriptObject jsonObj, JSONHandler handler) {
- JSONObject obj = new JSONObject(jsonObj);
- if (obj.isObject() != null) {
- if (obj.containsKey("err_code")) {
- handler.onError(new Double(obj.get("err_code").isNumber().doubleValue()).intValue(),
- obj.get("err_msg").isString().stringValue());
- return;
- }
- }
- handler.onResponse(jsonObj);
- }
-
- public static String getString(JSONObject json, String field) {
- JSONValue jsonValue;
- JSONString jsonString;
- if ((jsonValue = json.get(field)) == null) {
- return null;
- }
- if ((jsonString = jsonValue.isString()) == null) {
- JSONNumber jsonNumber = jsonValue.isNumber();
- return jsonNumber != null ? jsonNumber.toString() : null;
- }
- return jsonString.stringValue();
- }
-
- public static Date getDate(JSONObject json, String field) {
- DateTimeFormat frmt = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ssZ");
- String date = getString(json, field);
- if (date!=null && date.endsWith("Z") && date.length()>2) {
- // see SONAR-1182
- date = date.substring(0, date.length()-2) + "+00:00";
- }
- return frmt.parse(date);
- }
-
- public static Boolean getBoolean(JSONObject json, String field) {
- JSONValue jsonValue;
- JSONBoolean jsonBoolean;
- if ((jsonValue = json.get(field)) == null) {
- return null;
- }
- if ((jsonBoolean = jsonValue.isBoolean()) == null) {
- return null;
- }
- return jsonBoolean.booleanValue();
- }
-
- public static Double getDouble(JSONObject json, String field) {
- JSONValue jsonValue;
- JSONNumber jsonNumber;
- if ((jsonValue = json.get(field)) == null) {
- return null;
- }
- if ((jsonNumber = jsonValue.isNumber()) == null) {
- return null;
- }
- return jsonNumber.doubleValue();
- }
-
- public static Integer getInteger(JSONObject json, String field) {
- final Double d = getDouble(json, field);
- if (d != null) {
- return d.intValue();
- }
- return null;
- }
-
- public static JSONObject getArray(JSONValue json, int i) {
- if (json instanceof JSONArray) {
- return ((JSONArray) json).get(i).isObject();
- }
- if (json instanceof JSONObject) {
- return ((JSONObject) json).get(Integer.toString(i)).isObject();
- }
- throw new JavaScriptException("Not implemented");
- }
-
- public static int getArraySize(JSONValue array) {
- if (array instanceof JSONArray) {
- return ((JSONArray) array).size();
- }
- if (array instanceof JSONObject) {
- return ((JSONObject) array).size();
- }
- throw new JavaScriptException("Not implemented");
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * @deprecated since 2.5, use {@link org.sonar.wsclient.services.Measure} instead.
- */
-@Deprecated
-public class Measure {
- private String metric;
- private String metricName;
- private Double value;
- private String formattedValue;
- private String data;
-
- private String ruleKey;
- private String ruleName;
- private String rulePriority;
-
- private Date date;
-
- public Measure() {
- }
-
- public Measure(String metric, Double value, String formattedValue) {
- this.metric = metric;
- this.value = value;
- this.formattedValue = formattedValue;
- }
-
- public String getMetric() {
- return metric;
- }
-
- public void setMetric(String metric) {
- this.metric = metric;
- }
-
- public Double getValue() {
- return value;
- }
-
- public void setValue(Double value) {
- this.value = value;
- }
-
- public String getFormattedValue() {
- return formattedValue;
- }
-
- public void setFormattedValue(String formattedValue) {
- this.formattedValue = formattedValue;
- }
-
- public String getData() {
- return data;
- }
-
- public Map<String, String> getDataAsMap() {
- Map<String, String> map = new TreeMap<String, String>();
- if (data != null) {
- String[] strings = data.split(";");
- for (String string : strings) {
- String[] keyValue = string.split("=");
- map.put(keyValue[0], keyValue[1]);
- }
- }
- return map;
-
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
- public String getMetricName() {
- return metricName;
- }
-
- public void setMetricName(String metricName) {
- this.metricName = metricName;
- }
-
- public String getRuleKey() {
- return ruleKey;
- }
-
- public void setRuleKey(String s) {
- this.ruleKey = s;
- }
-
- public String getRuleName() {
- return ruleName;
- }
-
- public void setRuleName(String ruleName) {
- this.ruleName = ruleName;
- }
-
- /**
- * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
- */
- @Deprecated
- public String getRuleCategory() {
- return null;
- }
-
- public String getRulePriority() {
- return rulePriority;
- }
-
- public void setRulePriority(String rulePriority) {
- this.rulePriority = rulePriority;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- @Override
- public String toString() {
- return "Measure{" +
- "metric='" + metric + '\'' +
- ", metric_name='" + metricName + '\'' +
- ", val='" + value + '\'' +
- ", f_val='" + formattedValue + '\'' +
- '}';
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.json.client.JSONArray;
-import com.google.gwt.json.client.JSONObject;
-import org.sonar.api.web.gwt.client.Utils;
-import org.sonar.api.web.gwt.client.webservices.WSMetrics.MetricsList;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated since 2.5, use {@link org.sonar.wsclient.services.MetricQuery} instead.
- */
-@Deprecated
-public final class MetricsQuery extends Query<MetricsList> {
-
- private Boolean userManaged;
- private List<WSMetrics.Metric.ValueType> excludedTypes = new ArrayList<WSMetrics.Metric.ValueType>();
-
- public static MetricsQuery get() {
- return new MetricsQuery();
- }
-
- private MetricsQuery() {
- super();
- }
-
- public Boolean isUserManaged() {
- return userManaged;
- }
-
- public MetricsQuery setUserManaged(Boolean userManaged) {
- this.userManaged = userManaged;
- return this;
- }
-
- public MetricsQuery excludeTypes(WSMetrics.Metric.ValueType... types) {
- for (WSMetrics.Metric.ValueType valueType : types) {
- excludedTypes.add(valueType);
- }
- return this;
- }
-
- @Override
- public String toString() {
- return Utils.getServerApiUrl() + "/metrics?";
- }
-
- @Override
- public void execute(QueryCallBack<MetricsList> callback) {
- JsonUtils.requestJson(this.toString(), new JSONHandlerDispatcher<MetricsList>(callback) {
- @Override
- public MetricsList parseResponse(JavaScriptObject obj) {
- return parseMetrics(obj);
- }
- });
- }
-
- private MetricsList parseMetrics(JavaScriptObject json) {
- JSONArray array = new JSONArray(json);
- MetricsList list = new MetricsList();
- for (int i = 0; i < array.size(); i++) {
- JSONObject jsStock = array.get(i).isObject();
- if (jsStock != null) {
- WSMetrics.Metric m = parseMetric(jsStock);
- boolean skip = (isUserManaged() != null && (!isUserManaged() && m.isUserManaged())) || excludedTypes.contains(m.getType());
- if (!skip) {
- list.getMetrics().add(m);
- }
- }
- }
- return list;
- }
-
- private WSMetrics.Metric parseMetric(JSONObject json) {
- String key = JsonUtils.getString(json, "key");
- String name = JsonUtils.getString(json, "name");
- String description = JsonUtils.getString(json, "description");
- String domain = JsonUtils.getString(json, "domain");
- String type = JsonUtils.getString(json, "val_type");
- boolean qualitative = JsonUtils.getBoolean(json, "qualitative");
- boolean userManaged = JsonUtils.getBoolean(json, "user_managed");
- Integer direction = JsonUtils.getInteger(json, "direction");
- return new WSMetrics.Metric(key, name, description, domain, qualitative, userManaged, direction,
- WSMetrics.Metric.ValueType.valueOf(type));
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public abstract class Query<R extends ResponsePOJO> {
-
- public abstract void execute(final QueryCallBack<R> callback);
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public interface QueryCallBack<RESPONSE_POJO extends ResponsePOJO> {
-
- void onResponse(RESPONSE_POJO response, JavaScriptObject jsonRawResponse);
-
- void onTimeout();
-
- void onError(int errorCode, String errorMessage);
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import java.util.List;
-
-/**
- * @deprecated since 2.5, use {@link org.sonar.wsclient.services.Resource} instead.
- */
-@Deprecated
-public class Resource extends ResponsePOJO {
- public static final String SCOPE_SET = "PRJ";
- public static final String SCOPE_SPACE = "DIR";
- public static final String SCOPE_ENTITY = "FIL";
-
- @Deprecated
- public static final String SCOPE_PROJECT = SCOPE_SET;
- @Deprecated
- public static final String SCOPE_DIRECTORY = SCOPE_SPACE;
- @Deprecated
- public static final String SCOPE_FILE = SCOPE_ENTITY;
-
- public static final String QUALIFIER_PROJECT = "TRK";
- public static final String QUALIFIER_MODULE = "BRC";
- @Deprecated
- public static final String QUALIFIER_PROJECT_TRUNK = QUALIFIER_PROJECT;
- @Deprecated
- public static final String QUALIFIER_PROJECT_BRANCH = QUALIFIER_MODULE;
- public static final String QUALIFIER_PACKAGE = "PAC";
- public static final String QUALIFIER_DIRECTORY = "DIR";
- public static final String QUALIFIER_FILE = "FIL";
- public static final String QUALIFIER_CLASS = "CLA";
- public static final String QUALIFIER_UNIT_TEST = "UTS";
-
- private Integer id;
- private String key;
- private String name;
- private String longName;
- private String qualifier;
- private String scope;
- private String language;
- private Integer copy;
- private List<Measure> measures;
-
- public Resource() {
- }
-
- public Resource(Integer id, String key, String name, String scope, String qualifier, String language, Integer copy, List<Measure> measures) {
- this.id = id;
- this.key = key;
- this.name = name;
- this.qualifier = qualifier;
- this.scope = scope;
- this.language = language;
- this.measures = measures;
- this.copy = copy;
- }
-
- public Integer getId() {
- return id;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getName() {
- return name;
- }
-
- public String getName(boolean longFormatIfDefined) {
- if (longFormatIfDefined && longName != null && !"".equals(longName)) {
- return longName;
- }
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getLongName() {
- return longName;
- }
-
- public void setLongName(String longName) {
- this.longName = longName;
- }
-
- public String getQualifier() {
- return qualifier;
- }
-
- public void setQualifier(String qualifier) {
- this.qualifier = qualifier;
- }
-
- public String getScope() {
- return scope;
- }
-
- public void setScope(String scope) {
- this.scope = scope;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public void setLanguage(String language) {
- this.language = language;
- }
-
- public Integer getCopy() {
- return copy;
- }
-
- public void setCopy(Integer copy) {
- this.copy = copy;
- }
-
- public List<Measure> getMeasures() {
- return measures;
- }
-
- public Measure getMeasure(WSMetrics.Metric metric) {
- if (measures != null) {
- for (Measure measure : measures) {
- if (measure.getMetric().equals(metric.getKey())) {
- return measure;
- }
- }
- }
- return null;
- }
-
- public boolean hasMeasure(WSMetrics.Metric metric) {
- return getMeasure(metric) != null;
- }
-
- public String getMeasureFormattedValue(WSMetrics.Metric metric, String defaultValue) {
- Measure measure = getMeasure(metric);
- if (measure != null) {
- return measure.getFormattedValue();
- }
- return defaultValue;
- }
-
- public void setMeasures(List<Measure> measures) {
- this.measures = measures;
- }
-
- public boolean matchesKey(String resourceKey) {
- return resourceKey != null && (getId().toString().equals(resourceKey) || getKey().equals(resourceKey));
- }
-
- @Override
- public String toString() {
- return "Resource{" +
- "id='" + id + '\'' +
- ", key='" + key + '\'' +
- ", name='" + name + '\'' +
- ", longName='" + longName + '\'' +
- ", scope='" + scope + '\'' +
- ", qualifier='" + qualifier + '\'' +
- ", language='" + language + '\'' +
- ", measures=" + measures +
- '}';
- }
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import java.util.List;
-
-/**
- * @deprecated since 2.5
- */
-@Deprecated
-public class Resources extends ResponsePOJO {
-
- private List<Resource> resources;
-
- public Resources(List<Resource> resources) {
- super();
- this.resources = resources;
- }
-
- public List<Resource> getResources() {
- return resources;
- }
-
- public Resource firstResource() {
- return resources.size() > 0 ? resources.get(0) : null;
- }
-
- public boolean onceContainsMeasure(WSMetrics.Metric metric) {
- for (Resource resource : resources) {
- if (resource.getMeasure(metric) != null) {
- return true;
- }
- }
- return false;
- }
-
- public boolean allContainsMeasure(WSMetrics.Metric metric) {
- for (Resource resource : resources) {
- if (resource.getMeasure(metric) == null) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isEmpty() {
- return resources == null || resources.isEmpty();
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.json.client.JSONArray;
-import com.google.gwt.json.client.JSONObject;
-import com.google.gwt.json.client.JSONValue;
-import org.sonar.api.web.gwt.client.Utils;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @deprecated since 2.5, use {@link org.sonar.wsclient.services.ResourceQuery} instead
- */
-@Deprecated
-public final class ResourcesQuery extends AbstractResourceQuery<Resources> {
-
- public final static int DEPTH_UNLIMITED = -1;
-
- private Integer depth;
- private Integer limit;
- private String scopes;
- private String qualifiers;
- private String metrics;
- private String rules;
- private String rulePriorities;
- private boolean verbose = false;
-
- /**
- * Alias for build()
- */
- public static ResourcesQuery get(String resourceKey) {
- return new ResourcesQuery(resourceKey);
- }
-
- public static ResourcesQuery build(String resourceKey) {
- return new ResourcesQuery(resourceKey);
- }
-
- public static ResourcesQuery build() {
- return new ResourcesQuery(null);
- }
-
- private ResourcesQuery(String resourceKey) {
- super(resourceKey);
- }
-
- public ResourcesQuery setDepth(Integer depth) {
- this.depth = depth;
- return this;
- }
-
- public ResourcesQuery setRules(String s) {
- this.rules = s;
- return this;
- }
-
- public ResourcesQuery filterOnRules(boolean b) {
- return setRules(b ? "true" : "false");
- }
-
- public ResourcesQuery filterOnRulePriorities(boolean b) {
- return setRulePriorities(b ? "true" : "false");
- }
-
- /**
- * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
- */
- @Deprecated
- public ResourcesQuery filterOnRuleCategories(boolean b) {
- return this;
- }
-
- public ResourcesQuery setRulePriorities(String s) {
- this.rulePriorities = s;
- return this;
- }
-
- /**
- * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
- */
- @Deprecated
- public ResourcesQuery setRuleCategories(String s) {
- return this;
- }
-
- public ResourcesQuery setLimit(Integer limit) {
- this.limit = limit;
- return this;
- }
-
- public ResourcesQuery setScopes(String scopes) {
- this.scopes = scopes;
- return this;
- }
-
- public ResourcesQuery setVerbose(boolean verbose) {
- this.verbose = verbose;
- return this;
- }
-
- public ResourcesQuery setQualifiers(String qualifiers) {
- this.qualifiers = qualifiers;
- return this;
- }
-
- public ResourcesQuery setMetrics(List<WSMetrics.Metric> metrics) {
- this.metrics = getMetricsWSRequest(metrics);
- return this;
- }
-
- public ResourcesQuery setMetric(WSMetrics.Metric m) {
- this.metrics = m.getKey();
- return this;
- }
-
- public ResourcesQuery setMetric(String metricKey) {
- this.metrics = metricKey;
- return this;
- }
-
- private String getMetricsWSRequest(List<WSMetrics.Metric> metrics) {
- StringBuilder metricsDelimByComma = new StringBuilder(64);
- for (WSMetrics.Metric metric : metrics) {
- metricsDelimByComma.append(metric.getKey()).append(",");
- }
- return metricsDelimByComma.substring(0, metricsDelimByComma.length() - 1);
- }
-
- @Override
- public String toString() {
- String url = Utils.getServerApiUrl() + "/resources?";
- if (getResourceKey() != null) {
- url += "resource=" + getResourceKey() + "&";
- }
- if (metrics != null) {
- url += "metrics=" + metrics + "&";
- }
- if (scopes != null) {
- url += "scopes=" + scopes + "&";
- }
- if (qualifiers != null) {
- url += "qualifiers=" + qualifiers + "&";
- }
- if (depth != null) {
- url += "depth=" + depth + "&";
- }
- if (limit != null) {
- url += "limit=" + limit + "&";
- }
- if (rules != null) {
- url += "rules=" + rules + "&";
- }
- if (rulePriorities != null) {
- url += "rule_priorities=" + rulePriorities + "&";
- }
- if (verbose) {
- url += "verbose=true&";
- }
- return url;
- }
-
- @Override
- public void execute(QueryCallBack<Resources> callback) {
- JsonUtils.requestJson(this.toString(), new JSONHandlerDispatcher<Resources>(callback) {
- @Override
- public Resources parseResponse(JavaScriptObject obj) {
- return new Resources(parseResources(obj));
- }
- });
- }
-
- public static List<Resource> parseResources(JavaScriptObject json) {
- JSONArray array = new JSONArray(json);
- List<Resource> resources = new ArrayList<Resource>();
- for (int i = 0; i < array.size(); i++) {
- JSONObject jsStock = array.get(i).isObject();
- if (jsStock != null) {
- resources.add(parseResource(jsStock));
- }
- }
- return resources;
- }
-
- private static Resource parseResource(JSONObject json) {
- Double id = JsonUtils.getDouble(json, "id");
- String key = JsonUtils.getString(json, "key");
- String name = JsonUtils.getString(json, "name");
- String longName = JsonUtils.getString(json, "lname");
- String qualifier = JsonUtils.getString(json, "qualifier");
- String language = JsonUtils.getString(json, "lang");
- String scope = JsonUtils.getString(json, "scope");
- Integer copy = JsonUtils.getInteger(json, "copy");
- Date date = JsonUtils.getDate(json, "date");
-
- List<Measure> measures = null;
- JSONValue measuresJson;
- if ((measuresJson = json.get("msr")) != null) {
- measures = parseMeasures(measuresJson, date);
- }
-
- final Resource resource = new Resource(id.intValue(), key, name, scope, qualifier, language, copy, measures);
- resource.setLongName(longName);
- return resource;
- }
-
- private static List<Measure> parseMeasures(JSONValue measures, Date date) {
- List<Measure> projectMeasures = new ArrayList<Measure>();
- int len = JsonUtils.getArraySize(measures);
- for (int i = 0; i < len; i++) {
- JSONObject measure = JsonUtils.getArray(measures, i);
- if (measure != null) {
- Measure measureEntry = parseMeasure(measure, date);
- if (measureEntry != null) {
- projectMeasures.add(measureEntry);
- }
- }
- }
- return projectMeasures;
- }
-
- private static Measure parseMeasure(JSONObject measure, Date date) {
- String metric = JsonUtils.getString(measure, "key");
- if (metric == null) {
- return null;
- }
-
- final Measure m = new Measure(metric, JsonUtils.getDouble(measure, "val"), JsonUtils.getString(measure, "frmt_val"));
- m.setData(JsonUtils.getString(measure, "data"));
- String metricName = JsonUtils.getString(measure, "name");
- if (metricName != null) {
- m.setMetricName(metricName);
- }
-
- m.setRuleKey(JsonUtils.getString(measure, "rule_key"));
- m.setRuleName(JsonUtils.getString(measure, "rule_name"));
- m.setRulePriority(JsonUtils.getString(measure, "rule_priority"));
- m.setDate(date);
- return m;
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-/**
- * Marker class for WS query response objects
- */
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public abstract class ResponsePOJO {
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-/**
- * @deprecated since 2.5
- */
-@Deprecated
-public class Rule extends ResponsePOJO {
- private String key;
- private String name;
-
- public Rule(String key, String name) {
- this.key = key;
- this.name = name;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
- */
- @Deprecated
- public String getCategory() {
- return null;
- }
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.Timer;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public class SequentialQueries extends Query<VoidResponse> {
-
- private List<AjaxQuery<?>> queries = new ArrayList<AjaxQuery<?>>();
- private int sleepTimeBetweenCbChecks;
-
- private SequentialQueries(int sleepTimeBetweenCbChecks) {
- this.sleepTimeBetweenCbChecks = sleepTimeBetweenCbChecks;
- }
-
- public static SequentialQueries get() {
- return new SequentialQueries(50);
- }
-
- public static SequentialQueries get(int sleepTimeBetweenCbChecks) {
- return new SequentialQueries(sleepTimeBetweenCbChecks);
- }
-
- public <R extends ResponsePOJO> SequentialQueries add(Query<R> query, QueryCallBack<R> callback) {
- queries.add(new AjaxQuery<R>(query, callback));
- return this;
- }
-
- @Override
- public void execute(final QueryCallBack<VoidResponse> callback) {
- for (AjaxQuery<?> query : queries) {
- query.execute();
- }
- Timer queriesMonitor = new Timer() {
- @Override
- public void run() {
- boolean queriesExecuted = true;
- for (AjaxQuery<?> query : queries) {
- if (!query.isCompleted()) {
- queriesExecuted = false;
- break;
- }
- }
- if (queriesExecuted) {
- callback.onResponse(new VoidResponse(), null);
- cancel();
- }
- }
- };
- queriesMonitor.scheduleRepeating(sleepTimeBetweenCbChecks);
- }
-
- private class AjaxQuery<R extends ResponsePOJO> {
- private Query<R> query;
- private QueryCallBack<R> callback;
-
- private boolean completed = false;
-
- public AjaxQuery(Query<R> query, QueryCallBack<R> callback) {
- super();
- this.query = query;
- this.callback = callback;
- }
-
- private void execute() {
- QueryCallBack<R> proxy = new QueryCallBack<R>() {
- public void onError(int errorCode, String errorMessage) {
- callback.onError(errorCode, errorMessage);
- completed = true;
- }
-
- public void onResponse(R response, JavaScriptObject jsonRawResponse) {
- callback.onResponse(response, jsonRawResponse);
- completed = true;
- }
-
- public void onTimeout() {
- callback.onTimeout();
- completed = true;
- }
- };
- query.execute(proxy);
- }
-
- public boolean isCompleted() {
- return completed;
- }
-
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public class VoidResponse extends ResponsePOJO {
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.webservices;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated since 2.8. Use sonar-gwt-api instead.
- */
-@Deprecated
-public final class WSMetrics {
-
- private WSMetrics() {
- }
-
- private final static List<Metric> DICTIONNARY = new ArrayList<Metric>();
-
- public static final Metric NCLOC = add(new Metric("ncloc"));
- public static final Metric LINES = add(new Metric("lines"));
- public static final Metric CLASSES = add(new Metric("classes"));
- public static final Metric PACKAGES = add(new Metric("packages"));
- public static final Metric FUNCTIONS = add(new Metric("functions"));
- public static final Metric ACCESSORS = add(new Metric("accessors"));
- public static final Metric FILES = add(new Metric("files"));
- public static final Metric DIRECTORIES = add(new Metric("directories"));
- public static final Metric PUBLIC_API = add(new Metric("public_api"));
-
- /* complexity */
- public static final Metric COMPLEXITY = add(new Metric("complexity"));
- public static final Metric CLASS_COMPLEXITY = add(new Metric("class_complexity"));
- public static final Metric FUNCTION_COMPLEXITY = add(new Metric("function_complexity"));
- public static final Metric FILE_COMPLEXITY = add(new Metric("file_complexity"));
- public static final Metric STATEMENTS = add(new Metric("statements"));
-
- public static final Metric CLASS_COMPLEXITY_DISTRIBUTION = add(new Metric("class_complexity_distribution"));
- public static final Metric FUNCTION_COMPLEXITY_DISTRIBUTION = add(new Metric("function_complexity_distribution"));
-
- /* comments */
- public static final Metric COMMENT_LINES = add(new Metric("comment_lines"));
- public static final Metric COMMENT_LINES_DENSITY = add(new Metric("comment_lines_density"));
- public static final Metric PUBLIC_DOCUMENTED_API_DENSITY = add(new Metric("public_documented_api_density"));
- public static final Metric PUBLIC_UNDOCUMENTED_API = add(new Metric("public_undocumented_api"));
- public static final Metric COMMENTED_OUT_CODE_LINES = add(new Metric("commented_out_code_lines"));
-
- /* unit tests */
- public static final Metric TESTS = add(new Metric("tests"));
- public static final Metric TESTS_EXECUTION_TIME = add(new Metric("test_execution_time"));
- public static final Metric TEST_ERRORS = add(new Metric("test_errors"));
- public static final Metric SKIPPED_TESTS = add(new Metric("skipped_tests"));
- public static final Metric TEST_FAILURES = add(new Metric("test_failures"));
- public static final Metric TEST_SUCCESS_DENSITY = add(new Metric("test_success_density"));
- public static final Metric TEST_DATA = add(new Metric("test_data"));
-
- /* coverage */
- public static final Metric COVERAGE = add(new Metric("coverage"));
- public static final Metric LINE_COVERAGE = add(new Metric("line_coverage"));
- public static final Metric UNCOVERED_LINES = add(new Metric("uncovered_lines"));
- public static final Metric BRANCH_COVERAGE = add(new Metric("branch_coverage"));
- public static final Metric UNCOVERED_CONDITIONS = add(new Metric("uncovered_conditions"));
- public static final Metric COVERAGE_LINE_HITS_DATA = add(new Metric("coverage_line_hits_data"));
- public static final Metric BRANCH_COVERAGE_HITS_DATA = add(new Metric("branch_coverage_hits_data"));
-
- /* duplicated lines */
- public static final Metric DUPLICATED_LINES = add(new Metric("duplicated_lines"));
- public static final Metric DUPLICATED_BLOCKS = add(new Metric("duplicated_blocks"));
- public static final Metric DUPLICATED_FILES = add(new Metric("duplicated_files"));
- public static final Metric DUPLICATED_LINES_DENSITY = add(new Metric("duplicated_lines_density"));
- public static final Metric DUPLICATIONS_DATA = add(new Metric("duplications_data"));
-
- /* coding rules */
- public static final Metric VIOLATIONS_DENSITY = add(new Metric("violations_density"));
- public static final Metric VIOLATIONS = add(new Metric("violations"));
- public static final Metric WEIGHTED_VIOLATIONS = add(new Metric("weighted_violations"));
-
- /* design */
- public static final Metric LCOM4 = add(new Metric("lcom4"));
- public static final Metric RFC = add(new Metric("rfc"));
-
- public static class MetricsList extends ResponsePOJO {
-
- private List<Metric> metrics = new ArrayList<Metric>();
-
- public List<Metric> getMetrics() {
- return metrics;
- }
- }
-
- /**
- * Generates a callback that will update the metrics definitions from the WSMetrics metrics constants list with data
- * received from a MetricsQuery call
- *
- * @param callback
- * @return
- */
- public static QueryCallBack<MetricsList> getUpdateMetricsFromServer(final QueryCallBack<MetricsList> callback) {
- return new QueryCallBack<MetricsList>() {
- public void onResponse(MetricsList response, JavaScriptObject jsonRawResponse) {
- for (Metric metric : response.getMetrics()) {
- Metric WSMetricConstant = get(metric.getKey());
- if (WSMetricConstant != null) {
- WSMetricConstant.updateFrom(metric);
- } else {
- add(metric);
- }
- }
- callback.onResponse(response, jsonRawResponse);
- }
-
- public void onError(int errorCode, String errorMessage) {
- callback.onError(errorCode, errorMessage);
- }
-
- public void onTimeout() {
- callback.onTimeout();
- }
- };
- }
-
- public static class Metric {
- public enum ValueType {
- INT, FLOAT, PERCENT, BOOL, STRING, MILLISEC, DATA, LEVEL, DISTRIB, RATING
- }
-
- private String key;
- private String name;
- private String description;
- private String domain;
- private boolean qualitative;
- private boolean userManaged;
- private int direction;
- private ValueType type;
-
- public Metric(String key) {
- super();
- this.key = key;
- }
-
- public Metric(String key, String name, String description, String domain,
- boolean qualitative, boolean userManaged, int direction, ValueType type) {
- super();
- this.key = key;
- this.name = name;
- this.description = description;
- this.domain = domain;
- this.qualitative = qualitative;
- this.userManaged = userManaged;
- this.direction = direction;
- this.type = type;
- }
-
- public void updateFrom(Metric metric) {
- this.name = metric.getName();
- this.description = metric.getDescription();
- this.domain = metric.getDomain();
- this.qualitative = metric.isQualitative();
- this.userManaged = metric.isUserManaged();
- this.direction = metric.getDirection();
- this.type = metric.getType();
- }
-
- public String getName() {
- return name;
- }
-
- public ValueType getType() {
- return type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getDomain() {
- return domain;
- }
-
- public boolean isQualitative() {
- return qualitative;
- }
-
- public boolean isUserManaged() {
- return userManaged;
- }
-
- public int getDirection() {
- return direction;
- }
-
- public String getKey() {
- return key;
- }
-
- @Override
- public int hashCode() {
- return key.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof Metric)) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- Metric other = (Metric) obj;
- return key.equals(other.getKey());
- }
- }
-
- public static Metric add(Metric metric) {
- if (!DICTIONNARY.contains(metric)) {
- DICTIONNARY.add(metric);
- }
- return metric;
- }
-
- public static Metric get(String metricKey) {
- for (Metric metric : DICTIONNARY) {
- if (metric.getKey().equals(metricKey)) {
- return metric;
- }
- }
- return new Metric(metricKey);
- }
-
-}
+++ /dev/null
-/*
- * 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.api.web.gwt.client.widgets;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
-
-public class LoadingLabel extends Composite {
- public LoadingLabel() {
- this("loading...");
- getElement().setId("loading");
- }
-
- public LoadingLabel(String text) {
- initWidget(new HTML("<div class='loading'>" + text + "</div>"));
- }
-}
if @project.nil?
return render :text => "Resource [#{project_key}] not found", :status => 404
end
+ return access_denied unless has_role?(:user, @project)
@snapshot=@project.last_snapshot
- # metrics
- size_metric=Metric.by_key('ncloc')
- color_metric=Metric.by_key('violations_density')
+ @size_metric=Metric.by_key(params[:size]||'ncloc')
+ @color_metric=Metric.by_key(params[:color]||'violations_density')
snapshot_conditions='snapshots.islast=:islast AND snapshots.scope=:scope AND snapshots.qualifier!=:test_qualifier AND
(snapshots.id=:sid OR (snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path))'
@snapshots=Snapshot.find(:all, :conditions => [snapshot_conditions, snapshot_values], :include => 'project', :order => 'projects.name')
- @size_measures=ProjectMeasure.find(:all,
+ size_measures=ProjectMeasure.find(:all,
:select => 'project_measures.id,project_measures.value,project_measures.metric_id,project_measures.snapshot_id,project_measures.rule_id,project_measures.rule_priority,project_measures.text_value,project_measures.characteristic_id,project_measures.alert_status',
:joins => :snapshot,
- :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{size_metric.id}", snapshot_values],
+ :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{@size_metric.id}", snapshot_values],
:order => 'project_measures.value')
- @color_measures=ProjectMeasure.find(:all,
+ color_measures=ProjectMeasure.find(:all,
:select => 'project_measures.id,project_measures.value,project_measures.metric_id,project_measures.snapshot_id,project_measures.rule_id,project_measures.rule_priority,project_measures.text_value,project_measures.characteristic_id,project_measures.alert_status',
:joins => :snapshot,
- :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{color_metric.id}", snapshot_values],
+ :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{@color_metric.id}", snapshot_values],
:order => 'project_measures.value')
@size_measure_by_sid={}, @color_measure_by_sid={}
- @size_measures.each do |m|
+ size_measures.each do |m|
@size_measure_by_sid[m.snapshot_id]=m
end
- @color_measures.each do |m|
+ color_measures.each do |m|
@color_measure_by_sid[m.snapshot_id]=m
end
- @min_size_value=(@size_measures.empty? ? 0.0 : @size_measures.first.value)
- @max_size_value=(@size_measures.empty? ? 0.0 : @size_measures.last.value)
+ @min_size_value=(size_measures.empty? ? 0.0 : size_measures.first.value)
+ @max_size_value=(size_measures.empty? ? 0.0 : size_measures.last.value)
end
end
<style>
-#cloud a {
- text-decoration: none;
-}
+ #cloud a {
+ text-decoration: none;
+ }
</style>
+<script type="text/javascript">
+ // open view
+ function ov(id) {
+ window.location.href = '<%=ApplicationController.root_context-%>/cloud/index/' + id + '?size=<%= @size_metric.key -%>&color=<%= @color_metric.key -%>';
+ return false;
+ }
+
+ // open file
+ function of(id) {
+ window.open('<%=ApplicationController.root_context-%>/resource/index/' + id + '?metric=<%= @color_metric.key -%>', 'resource', 'height=800,width=900,scrollbars=1,resizable=1');
+ return false;
+ }
+</script>
+
+<form id="cloudform" action="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>" method="GET">
+ <ul class="headerLine">
+ <li class="first">
+ <span class="note">Color:</span>
+ <select name="color" onchange="document.forms['cloudform'].submit()">
+ <option value="coverage" <%= 'selected' if @color_metric.key=='coverage' -%>>Coverage</option>
+ <option value="violations_density" <%= 'selected' if @color_metric.key=='violations_density' -%>>Rules compliance</option>
+ </select>
+ </li>
+ <li>
+ <input type="radio" name="size" value="ncloc" <%= 'checked' if @size_metric.key=='ncloc' -%> onchange="document.forms['cloudform'].submit()">
+ Quick wins</option>
+
+ <input type="radio" name="size" value="function_complexity" <%= 'checked' if @size_metric.key=='function_complexity' -%> onchange="document.forms['cloudform'].submit()">
+ Top risk</input>
+ </li>
+ </ul>
+</form>
+
<div id="cloud">
-<% @snapshots.each do |s|
- size_measure=@size_measure_by_sid[s.id]
- if size_measure && size_measure.value
- color_measure=@color_measure_by_sid[s.id]
-%>
- <a href=""><span style="font-size: <%= font_size(size_measure.value) -%>%;color: <%= MeasureColor.color(color_measure, :check_alert_status => false).html -%>"><%= s.resource.name %></span></a>
-<% end
- end %>
+ <% @snapshots.each do |s|
+ size_measure=@size_measure_by_sid[s.id]
+ if size_measure && size_measure.value
+ color_measure=@color_measure_by_sid[s.id]
+ if s.resource.copy_resource_id
+ link="ov(#{s.resource.copy_resource_id})"
+ else
+ link="of(#{s.project_id})"
+ end
+ title="#{s.resource.long_name} | #{@size_metric.short_name}: #{size_measure.formatted_value}"
+ if color_measure && color_measure.value
+ title += " | #{@color_metric.short_name}: #{color_measure.formatted_value}"
+ end
+ %>
+ <a href="#" onclick="<%= link -%>" title="<%= title -%>"><span style="font-size:<%= font_size(size_measure.value) -%>%;color: <%= MeasureColor.color(color_measure, :check_alert_status => false).html -%>"><%= s.resource.name %></span></a>
+ <% end
+ end %>
</div>
\ No newline at end of file
<% ActiveDashboard.user_dashboards(current_user).each do |active_dashboard| %>
<li class="<%= 'selected' if @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id -%>"><a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= @project.id -%>?did=<%= active_dashboard.dashboard_id -%>"><%= active_dashboard.dashboard.name -%></a></li>
<% end %>
+ <li class="<%= 'selected' if request.request_uri.include?('/cloud/index') -%>"><a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>">Clouds</a></li>
<li class="<%= 'selected' if request.request_uri.include?('/components/index') -%>"><a href="<%= ApplicationController.root_context -%>/components/index/<%= @project.id -%>">Components</a></li>
<li class="<%= 'selected' if request.request_uri.include?('/drilldown/violations') -%>"><a href="<%= ApplicationController.root_context -%>/drilldown/violations/<%= @project.id -%>">Violations drilldown</a></li>
<li class="<%= 'selected' if controller.controller_path=='timemachine' -%>"><a href="<%= ApplicationController.root_context -%>/timemachine/index/<%= @project.id -%>">Time machine</a></li>
text-align: left;
vertical-align: top;
}
+.headerLine {
+ background-color: #ECECEC;
+ color: #444;
+ border: 1px solid #DDD;
+ margin: 0 0 10px 0;
+ line-height: 30px;
+ height: 30px;
+ width: 100%;
+}
+ul.headerLine li {
+ float: left;
+ display: block;
+ padding: 0 10px 0;
+ background: url("../images/sep12.png") no-repeat scroll 0 50% transparent;
+}
+ul.headerLine li.first {
+ background: none;
+}
select.withIcons option {
background-repeat: no-repeat;
background-position: 2px 0;