diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-08-01 16:10:08 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-08-01 16:10:08 +0200 |
commit | c8c4752cf3f27fb4b0acf1234208127934689568 (patch) | |
tree | 968e2a81f7ba390d2037c48b2c15bffa3c3ef702 /plugins/sonar-core-gwt | |
parent | 67fe723d894ac406fe7b859bdcd13d5ea35e6f6e (diff) | |
download | sonarqube-c8c4752cf3f27fb4b0acf1234208127934689568.tar.gz sonarqube-c8c4752cf3f27fb4b0acf1234208127934689568.zip |
SONAR-75 support GWT components integrated to core
Diffstat (limited to 'plugins/sonar-core-gwt')
9 files changed, 39 insertions, 98 deletions
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java index 24a8ff15392..cad1b96cbc3 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java @@ -19,6 +19,7 @@ */ package org.sonar.plugins.core.duplicationsviewer.client; +import com.google.gwt.i18n.client.Dictionary; import org.sonar.gwt.Metrics; import org.sonar.gwt.ui.DefaultSourcePanel; import org.sonar.gwt.ui.ExpandCollapseLink; @@ -102,13 +103,14 @@ public class DuplicationsPanel extends Composite { } private FlexTable getDuplicationsTable() { + Dictionary l10n = Dictionary.getDictionary("l10n"); FlexTable table = new FlexTable(); table.setStylePrimaryName("duplicationsTable"); table.setText(0, 0, ""); - table.setText(0, 1, "Nb lines"); - table.setText(0, 2, "From line"); - table.setText(0, 3, "File"); - table.setText(0, 4, "From line"); + table.setText(0, 1, l10n.get("dupl.colSize")); + table.setText(0, 2, l10n.get("dupl.colFromLine")); + table.setText(0, 3, l10n.get("dupl.colFile")); + table.setText(0, 4, l10n.get("dupl.colFromLine")); table.getCellFormatter().getElement(0, 0).setId("expandCollapseCol"); table.getCellFormatter().getElement(0, 1).setId("nbLineCol"); diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsViewer.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsViewer.java index cf44ad88b25..db313329cee 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsViewer.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsViewer.java @@ -19,6 +19,7 @@ */ package org.sonar.plugins.core.duplicationsviewer.client; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Panel; @@ -59,9 +60,10 @@ public class DuplicationsViewer extends Page { addBigCell(panel, measure.getFormattedValue()); } - addCell(panel, getDefaultMeasure(resource, Metrics.LINES, "lines")); - addCell(panel, getDefaultMeasure(resource, Metrics.DUPLICATED_LINES, "Duplicated lines")); - addCell(panel, getDefaultMeasure(resource, Metrics.DUPLICATED_BLOCKS, "Duplicated blocks")); + Dictionary l10n = Dictionary.getDictionary("l10n"); + addCell(panel, getDefaultMeasure(resource, Metrics.LINES, l10n.get("lines"))); + addCell(panel, getDefaultMeasure(resource, Metrics.DUPLICATED_LINES, l10n.get("duplicated_lines"))); + addCell(panel, getDefaultMeasure(resource, Metrics.DUPLICATED_BLOCKS, l10n.get("duplicated_blocks"))); } private Measure getDefaultMeasure(Resource resource, String metric, String label) { diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/GwtHotspots.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/GwtHotspots.java index c4cd86ba5dc..f0adee74dbc 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/GwtHotspots.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/GwtHotspots.java @@ -20,6 +20,7 @@ package org.sonar.plugins.core.hotspots.client; import com.google.gwt.gen2.table.override.client.Grid; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import org.sonar.gwt.Metrics; @@ -46,16 +47,17 @@ public class GwtHotspots extends Page { VerticalPanel column2 = new VerticalPanel(); column2.setStyleName("hotspotcol"); + Dictionary l10n = Dictionary.getDictionary("l10n"); column1.add(new MostViolatedRules(resource)); - column1.add(new MetricHotspot(resource, Metrics.TEST_EXECUTION_TIME, I18nConstants.INSTANCE.titleLongestTests())); - column1.add(new MetricHotspot(resource, Metrics.COMPLEXITY, I18nConstants.INSTANCE.titleMostComplexResources())); - column1.add(new MetricHotspot(resource, Metrics.DUPLICATED_LINES, I18nConstants.INSTANCE.titleMostDuplicatedResources())); + column1.add(new MetricHotspot(resource, Metrics.TEST_EXECUTION_TIME, l10n.get("hotspot.titleLongestTests"))); + column1.add(new MetricHotspot(resource, Metrics.COMPLEXITY, l10n.get("hotspot.titleMostComplexResources"))); + column1.add(new MetricHotspot(resource, Metrics.DUPLICATED_LINES, l10n.get("hotspot.titleMostDuplicatedResources"))); column1.add(new MostBadlyDesignedFiles(resource)); column2.add(new MostViolatedResources(resource)); - column2.add(new MetricHotspot(resource, Metrics.UNCOVERED_LINES, I18nConstants.INSTANCE.titleLessTested())); - column2.add(new MetricHotspot(resource, Metrics.FUNCTION_COMPLEXITY, I18nConstants.INSTANCE.titleMostComplexMethods())); - column2.add(new MetricHotspot(resource, Metrics.PUBLIC_UNDOCUMENTED_API, I18nConstants.INSTANCE.titleMostUndocumentedAPI())); + column2.add(new MetricHotspot(resource, Metrics.UNCOVERED_LINES, l10n.get("hotspot.titleLessTested"))); + column2.add(new MetricHotspot(resource, Metrics.FUNCTION_COMPLEXITY, l10n.get("hotspot.titleMostComplexMethods"))); + column2.add(new MetricHotspot(resource, Metrics.PUBLIC_UNDOCUMENTED_API, l10n.get("hotspot.titleMostUndocumentedAPI"))); grid.setWidget(0, 0, column1); grid.setWidget(0, 1, column2); diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/I18nConstants.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/I18nConstants.java deleted file mode 100644 index ac1ebd5ab0d..00000000000 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/I18nConstants.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.core.hotspots.client; - -import com.google.gwt.core.client.GWT; - -public interface I18nConstants extends com.google.gwt.i18n.client.Constants { - - static I18nConstants INSTANCE = GWT.create(I18nConstants.class); - - @DefaultStringValue("Most violated rules") - String titleMostViolatedRules(); - - @DefaultStringValue("Most violated") - String titleMostViolatedResources(); - - @DefaultStringValue("Longest unit tests") - String titleLongestTests(); - - @DefaultStringValue("Highest complexity") - String titleMostComplexResources(); - - @DefaultStringValue("Highest duplications") - String titleMostDuplicatedResources(); - - @DefaultStringValue("Highest untested lines") - String titleLessTested(); - - @DefaultStringValue("Highest average method complexity") - String titleMostComplexMethods(); - - @DefaultStringValue("Most undocumented APIs") - String titleMostUndocumentedAPI(); - - @DefaultStringValue("No measures") - String noMeasures(); - - @DefaultStringValue("Any severity") - String anySeverity(); - - @DefaultStringValue("more") - String moreDetails(); - - @DefaultStringValue("Lack of Cohesion of Methods") - String lcom4(); - - @DefaultStringValue("Response for class") - String rfc(); - - @DefaultStringValue("Highest") - String designTitle(); -} diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/AbstractHotspot.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/AbstractHotspot.java index fa84185c303..aa0426dcbcb 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/AbstractHotspot.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/AbstractHotspot.java @@ -21,11 +21,11 @@ package org.sonar.plugins.core.hotspots.client.widget; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.*; import org.sonar.gwt.Links; import org.sonar.gwt.ui.Loading; -import org.sonar.plugins.core.hotspots.client.I18nConstants; import org.sonar.wsclient.services.Measure; import org.sonar.wsclient.services.Resource; @@ -74,7 +74,7 @@ public abstract class AbstractHotspot extends Composite { protected void renderEmptyResults() { Grid grid = new Grid(1, 1); - grid.setWidget(0, 0, new HTML(I18nConstants.INSTANCE.noMeasures())); + grid.setWidget(0, 0, new HTML(Dictionary.getDictionary("l10n").get("hotspot.noMeasures"))); grid.getCellFormatter().setStyleName(0, 0, getRowCssClass(0) + " emptyResultsCell"); grid.setStyleName("gwt-Hotspot"); render(grid); diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MetricHotspot.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MetricHotspot.java index bb19d263d0c..bb3ac53b6de 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MetricHotspot.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MetricHotspot.java @@ -21,10 +21,10 @@ package org.sonar.plugins.core.hotspots.client.widget; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.*; import org.sonar.gwt.Links; -import org.sonar.plugins.core.hotspots.client.I18nConstants; import org.sonar.wsclient.gwt.AbstractListCallback; import org.sonar.wsclient.gwt.Sonar; import org.sonar.wsclient.services.Measure; @@ -47,10 +47,11 @@ public class MetricHotspot extends AbstractHotspot { @Override Widget createHeader() { + Dictionary l10n = Dictionary.getDictionary("l10n"); final Label label = new Label(title); label.setStyleName("header"); - final Anchor moreLink = new Anchor(I18nConstants.INSTANCE.moreDetails()); + final Anchor moreLink = new Anchor(l10n.get("hotspot.moreDetails")); moreLink.getElement().setId("more-" + metric); moreLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostBadlyDesignedFiles.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostBadlyDesignedFiles.java index df84f197d49..954effd1362 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostBadlyDesignedFiles.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostBadlyDesignedFiles.java @@ -23,10 +23,10 @@ import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.*; import org.sonar.gwt.Links; -import org.sonar.plugins.core.hotspots.client.I18nConstants; import org.sonar.wsclient.gwt.AbstractListCallback; import org.sonar.wsclient.gwt.Sonar; import org.sonar.wsclient.services.Measure; @@ -45,9 +45,10 @@ public class MostBadlyDesignedFiles extends AbstractHotspot { @Override Widget createHeader() { + Dictionary l10n = Dictionary.getDictionary("l10n"); metricSelectBox = new ListBox(false); - metricSelectBox.addItem(I18nConstants.INSTANCE.lcom4(), "lcom4"); - metricSelectBox.addItem(I18nConstants.INSTANCE.rfc(), "rfc"); + metricSelectBox.addItem(l10n.get("hotspot.lcom4"), "lcom4"); + metricSelectBox.addItem(l10n.get("hotspot.rfc"), "rfc"); metricSelectBox.setStyleName("small"); metricSelectBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { @@ -55,10 +56,10 @@ public class MostBadlyDesignedFiles extends AbstractHotspot { } }); - final Label label = new Label(I18nConstants.INSTANCE.designTitle()); + final Label label = new Label(l10n.get("hotspot.designTitle")); label.setStyleName("header"); - final Anchor moreLink = new Anchor(I18nConstants.INSTANCE.moreDetails()); + final Anchor moreLink = new Anchor(l10n.get("hotspot.moreDetails")); moreLink.getElement().setId("more-design"); moreLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedResources.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedResources.java index d523bc13b4f..feff7db5e35 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedResources.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedResources.java @@ -21,12 +21,12 @@ package org.sonar.plugins.core.hotspots.client.widget; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.*; import org.sonar.gwt.Links; import org.sonar.gwt.Metrics; import org.sonar.gwt.ui.Icons; -import org.sonar.plugins.core.hotspots.client.I18nConstants; import org.sonar.wsclient.gwt.AbstractListCallback; import org.sonar.wsclient.gwt.Sonar; import org.sonar.wsclient.services.Measure; @@ -44,10 +44,11 @@ public class MostViolatedResources extends AbstractHotspot { @Override Widget createHeader() { - final Label label = new Label(I18nConstants.INSTANCE.titleMostViolatedResources()); + Dictionary l10n = Dictionary.getDictionary("l10n"); + final Label label = new Label(l10n.get("hotspot.titleMostViolatedResources")); label.setStyleName("header"); - final Anchor moreLink = new Anchor(I18nConstants.INSTANCE.moreDetails()); + final Anchor moreLink = new Anchor(l10n.get("hotspot.moreDetails")); moreLink.getElement().setId("more-violated-resources"); moreLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedRules.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedRules.java index c58b018a6eb..44d08372033 100644 --- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedRules.java +++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/hotspots/client/widget/MostViolatedRules.java @@ -23,12 +23,12 @@ import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.i18n.client.Dictionary; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.*; import org.sonar.gwt.Links; import org.sonar.gwt.Metrics; import org.sonar.gwt.ui.Icons; -import org.sonar.plugins.core.hotspots.client.I18nConstants; import org.sonar.wsclient.gwt.AbstractCallback; import org.sonar.wsclient.gwt.Sonar; import org.sonar.wsclient.services.Measure; @@ -45,8 +45,9 @@ public class MostViolatedRules extends AbstractHotspot { @Override Widget createHeader() { + Dictionary l10n = Dictionary.getDictionary("l10n"); severity = new ListBox(false); - severity.addItem(I18nConstants.INSTANCE.anySeverity(), ""); + severity.addItem(l10n.get("hotspot.anySeverity"), ""); severity.addItem("Blocker", "BLOCKER"); severity.addItem("Critical", "CRITICAL"); severity.addItem("Major", "MAJOR"); @@ -59,10 +60,10 @@ public class MostViolatedRules extends AbstractHotspot { } }); - final Label label = new Label(I18nConstants.INSTANCE.titleMostViolatedRules()); + final Label label = new Label(l10n.get("hotspot.titleMostViolatedRules")); label.setStyleName("header"); - final Anchor moreLink = new Anchor(I18nConstants.INSTANCE.moreDetails()); + final Anchor moreLink = new Anchor(l10n.get("hotspot.moreDetails")); moreLink.getElement().setId("more-rules"); moreLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { |