aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-design-plugin
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-12-11 10:50:12 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2013-12-11 10:50:21 +0100
commit0b75ead802109cdcdfa67e0098308a6211f19e05 (patch)
tree58be458827e372f5974bceebaef120ad2c009640 /plugins/sonar-design-plugin
parentc9097cd1b6273d7b7f7156067118b9e92bb9c059 (diff)
downloadsonarqube-0b75ead802109cdcdfa67e0098308a6211f19e05.tar.gz
sonarqube-0b75ead802109cdcdfa67e0098308a6211f19e05.zip
Faster build by extracting GWT compilation to project sonar-gwt-pages
Diffstat (limited to 'plugins/sonar-design-plugin')
-rw-r--r--plugins/sonar-design-plugin/pom.xml44
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java12
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java42
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Filters.java118
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/KeywordFilter.java44
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/LibrariesPage.java103
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Library.java96
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/ProjectPanel.java131
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java45
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java182
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DesignPage.java72
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java369
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DsmData.java65
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPage.gwt.xml8
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPageDev.gwt.xml6
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/libraries.css22
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/test.html33
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPage.gwt.xml8
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPageDev.gwt.xml6
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/design.css227
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/green-stripes.pngbin117 -> 0 bytes
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/test.html27
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/yellow-stripes.pngbin111 -> 0 bytes
23 files changed, 22 insertions, 1638 deletions
diff --git a/plugins/sonar-design-plugin/pom.xml b/plugins/sonar-design-plugin/pom.xml
index daff87477eb..3880e65121e 100644
--- a/plugins/sonar-design-plugin/pom.xml
+++ b/plugins/sonar-design-plugin/pom.xml
@@ -15,6 +15,10 @@
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-gwt-pages</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-core</artifactId>
<scope>provided</scope>
</dependency>
@@ -30,26 +34,10 @@
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-gwt-api</artifactId>
- <version>${sonarGwt.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-ws-client</artifactId>
<version>3.3.1</version>
<scope>provided</scope>
</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>
<!-- unit tests -->
<dependency>
@@ -74,25 +62,25 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
- <configuration>
- <modules>
- <module>org.sonar.plugins.design.ui.page.DesignPage${gwt.permutationSuffix}</module>
- <module>org.sonar.plugins.design.ui.libraries.LibrariesPage${gwt.permutationSuffix}</module>
- </modules>
- <skip>${skipGwt}</skip>
- <webappDirectory>${project.build.directory}/classes</webappDirectory>
- <extraJvmArgs>${gwt.extraJvmArgs}</extraJvmArgs>
- </configuration>
+ <phase>package</phase>
<goals>
- <goal>compile</goal>
+ <goal>shade</goal>
</goals>
</execution>
</executions>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.codehaus.sonar:sonar-gwt-pages</include>
+ </includes>
+ </artifactSet>
+ </configuration>
</plugin>
+
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-dev-maven-plugin</artifactId>
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
index 7ebb93528e0..baa781b7ca5 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
@@ -43,12 +43,12 @@ public class DesignPlugin extends SonarPlugin {
ProjectDsmDecorator.class,
PackageTangleIndexDecorator.class,
FileTangleIndexDecorator.class,
- GwtLibrariesPage.class,
- // UI
- GwtDesignPage.class,
- FileDesignWidget.class,
- PackageDesignWidget.class,
- ResponseForClassWidget.class);
+ // UI
+ GwtLibrariesPage.class,
+ GwtDesignPage.class,
+ FileDesignWidget.class,
+ PackageDesignWidget.class,
+ ResponseForClassWidget.class);
}
}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java
deleted file mode 100644
index 6a11874d74d..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.libraries;
-
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.GwtPage;
-import org.sonar.api.web.NavigationSection;
-import org.sonar.api.web.ResourceQualifier;
-import org.sonar.api.web.UserRole;
-import org.sonar.plugins.design.ui.libraries.client.LibrariesPage;
-
-@ResourceQualifier({Qualifiers.PROJECT, Qualifiers.MODULE})
-@NavigationSection(NavigationSection.RESOURCE)
-@UserRole(UserRole.USER)
-public class GwtLibrariesPage extends GwtPage {
-
- public String getTitle() {
- return "Libraries";
- }
-
- public String getGwtId() {
- return LibrariesPage.GWT_ID;
- }
-}
-
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Filters.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Filters.java
deleted file mode 100644
index 775c7694a78..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Filters.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.libraries.client;
-
-import com.google.gwt.i18n.client.Dictionary;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.Label;
-import org.sonar.gwt.Configuration;
-import org.sonar.gwt.Links;
-import org.sonar.wsclient.services.Resource;
-
-public class Filters extends Grid {
-
- private static final String PARAM_TEST = "test";
-
- private KeywordFilter keywordFilter;
- private CheckBox testCheckbox;
- private Anchor expandCollapse;
- private boolean isExpanded;
- private Anchor usageLink;
-
-
- public Filters(Resource resource) {
- super(1, 5);
-
- setStyleName("libFilter");
- Dictionary l10n = Dictionary.getDictionary("l10n");
-
- keywordFilter = new KeywordFilter();
- setWidget(0, 0, new Label(l10n.get("libs.filter")));
- setWidget(0, 1, keywordFilter);
-
- testCheckbox = new CheckBox(l10n.get("libs.displayTests"));
- testCheckbox.getElement().setId("testCb");
- testCheckbox.setValue(Boolean.valueOf(Configuration.getRequestParameter(PARAM_TEST, "false")));
- setWidget(0, 2, testCheckbox);
-
- expandCollapse = new Anchor(l10n.get("libs.collapse"));
- isExpanded = true;
- setWidget(0, 3, expandCollapse);
-
- usageLink = new Anchor(l10n.get("libs.usageLink"), Links.baseUrl() + "/dependencies/index?search=" + resource.getKey());
- setWidget(0, 4, usageLink);
- }
-
- public KeywordFilter getKeywordFilter() {
- return keywordFilter;
- }
-
- public CheckBox getTestCheckbox() {
- return testCheckbox;
- }
-
- public boolean isTestDisplayed() {
- return testCheckbox.getValue();
- }
-
- public boolean isTestFiltered() {
- return !isTestDisplayed();
- }
-
- public boolean hasKeyword() {
- return getKeywordFilter().hasKeyword();
- }
-
- public Anchor getExpandCollapseLink() {
- return expandCollapse;
- }
-
- public boolean isExpanded() {
- return isExpanded;
- }
-
- public boolean isCollapsed() {
- return !isExpanded;
- }
-
- public Anchor getUsageLink() {
- return usageLink;
- }
-
- public void expand() {
- if (!isExpanded) {
- expandCollapse.setText(Dictionary.getDictionary("l10n").get("libs.collapse"));
- isExpanded = true;
- }
- }
-
- public void collapse() {
- if (isExpanded) {
- expandCollapse.setText(Dictionary.getDictionary("l10n").get("libs.expand"));
- isExpanded = false;
- }
- }
-
- public String toUrlParams() {
- return PARAM_TEST + '=' + testCheckbox.getValue() + '&' + KeywordFilter.PARAM_FILTER + '=' + getKeywordFilter();
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/KeywordFilter.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/KeywordFilter.java
deleted file mode 100644
index 5a29dd029c1..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/KeywordFilter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.libraries.client;
-
-import com.google.gwt.user.client.ui.TextBox;
-import org.sonar.gwt.Configuration;
-
-public class KeywordFilter extends TextBox {
- public static final String PARAM_FILTER = "filter";
-
- public KeywordFilter() {
- getElement().setId("keywordFilter");
- String filterValue = Configuration.getRequestParameter(PARAM_FILTER);
- if (filterValue != null) {
- setValue(filterValue);
- }
- }
-
- public String getKeyword() {
- return getText().trim().toUpperCase();
- }
-
- public boolean hasKeyword() {
- String keyword = getKeyword();
- return keyword!=null && !"".equals(keyword);
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/LibrariesPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/LibrariesPage.java
deleted file mode 100644
index d8eb5c3b350..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/LibrariesPage.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.libraries.client;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import org.sonar.gwt.ui.Page;
-import org.sonar.wsclient.gwt.AbstractListCallback;
-import org.sonar.wsclient.gwt.Sonar;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class LibrariesPage extends Page implements KeyUpHandler, ClickHandler {
- public static final String GWT_ID = "org.sonar.plugins.design.ui.libraries.LibrariesPage";
-
- private Filters filters;
- private List<ProjectPanel> projectPanels = new ArrayList<ProjectPanel>();
- private Panel container;
-
- @Override
- protected Widget doOnResourceLoad(Resource resource) {
- container = new VerticalPanel();
- container.setWidth("100%");
-
- filters = new Filters(resource);
- filters.getKeywordFilter().addKeyUpHandler(this);
- filters.getTestCheckbox().addClickHandler(this);
- filters.getExpandCollapseLink().addClickHandler(this);
-
- container.add(filters);
- load(resource);
- return container;
- }
-
-
- private void load(Resource resource) {
- ResourceQuery resourceQuery = new ResourceQuery(resource.getId().toString());
- resourceQuery.setDepth(-1).setScopes(Resource.SCOPE_SET);
- Sonar.getInstance().findAll(resourceQuery, new AbstractListCallback<Resource>() {
- @Override
- protected void doOnResponse(List<Resource> subProjects) {
- for (Resource subProject : subProjects) {
- ProjectPanel projectPanel = new ProjectPanel(subProject, filters);
- projectPanels.add(projectPanel);
- container.add(projectPanel);
- }
- }
- });
- }
-
- public void onKeyUp(KeyUpEvent event) {
- for (ProjectPanel projectPanel : projectPanels) {
- projectPanel.filter();
- }
- }
-
- public void onClick(ClickEvent event) {
- if (event.getSource() == filters.getTestCheckbox()) {
- for (ProjectPanel projectPanel : projectPanels) {
- projectPanel.filter();
- }
- } else if (event.getSource() == filters.getExpandCollapseLink()) {
- if (filters.isExpanded()) {
- filters.collapse();
- expandCollapseLibs(false);
- } else {
- filters.expand();
- expandCollapseLibs(true);
- }
- }
- }
-
- private void expandCollapseLibs(boolean expand) {
- for (ProjectPanel projectPanel : projectPanels) {
- projectPanel.expandCollapse(expand);
- }
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Library.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Library.java
deleted file mode 100644
index ee176eed5bf..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Library.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.libraries.client;
-
-import com.google.gwt.user.client.ui.TreeItem;
-import org.sonar.gwt.ui.Icons;
-import org.sonar.wsclient.services.DependencyTree;
-
-public class Library extends TreeItem {
-
- private String keywords;
- private String usage;
-
- public Library(DependencyTree dep) {
- setHTML(toHTML(dep));
- keywords = toKeywords(dep);
- usage = dep.getUsage();
- }
-
- private static String toKeywords(DependencyTree dep) {
- String text = dep.getResourceName() + " ";
-
- if (dep.getResourceKey() != null) {
- text += dep.getResourceKey() + " ";
- }
- if (dep.getResourceVersion() != null) {
- text += dep.getResourceVersion() + " ";
- }
- text += dep.getUsage();
- return text.toUpperCase();
- }
-
- /**
- * @param keyword upper-case keyword
- */
- public boolean containsKeyword(String keyword) {
- if (keywords.indexOf(keyword) >= 0) {
- return true;
- }
- for (int index = 0; index < getChildCount(); index++) {
- if (((Library) getChild(index)).containsKeyword(keyword)) {
- return true;
- }
- }
- return false;
- }
-
- private static String toHTML(DependencyTree tree) {
- String html = Icons.forQualifier(tree.getResourceQualifier()).getHTML();
- html += " <span> " + tree.getResourceName() + "</span> ";
-
- if (tree.getResourceVersion() != null) {
- html += tree.getResourceVersion() + " ";
- }
- html += "(" + tree.getUsage() + ")";
- return html;
- }
-
- public boolean filter(String keyword, boolean testFiltered) {
- if (testFiltered && "test".equals(usage)) {
- setVisible(false);
- return true;
- }
-
- boolean filtered = false;
- if (!"".equals(keyword) && !containsKeyword(keyword)) {
- filtered = true;
- }
-
- boolean hasVisibleChild = false;
- for (int index = 0; index < getChildCount(); index++) {
- hasVisibleChild |= !((Library) getChild(index)).filter(keyword, testFiltered);
- }
-
- boolean visible = !filtered || hasVisibleChild;
- setVisible(visible);
- return !visible;
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/ProjectPanel.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/ProjectPanel.java
deleted file mode 100644
index 14d269610b5..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/ProjectPanel.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.libraries.client;
-
-import com.google.gwt.i18n.client.Dictionary;
-import com.google.gwt.user.client.ui.*;
-import org.sonar.gwt.ui.Icons;
-import org.sonar.gwt.ui.Loading;
-import org.sonar.wsclient.gwt.AbstractListCallback;
-import org.sonar.wsclient.gwt.Sonar;
-import org.sonar.wsclient.services.DependencyTree;
-import org.sonar.wsclient.services.DependencyTreeQuery;
-import org.sonar.wsclient.services.Resource;
-
-import java.util.List;
-
-public class ProjectPanel extends FlowPanel {
-
- private Label title;
- private Tree tree;
- private Filters filters;
-
- public ProjectPanel(Resource project, Filters filters) {
- this.filters = filters;
- setStyleName("libs");
- getElement().setId("libs-" + project.getKey());
- add(new Loading(project.getName()));
- loadLibraries(project);
- }
-
- private void loadLibraries(final Resource project) {
- Sonar.getInstance().findAll(DependencyTreeQuery.createForProject(project.getId().toString()), new AbstractListCallback<DependencyTree>() {
-
- @Override
- protected void doOnResponse(List<DependencyTree> dependencyTrees) {
- createTitle(project);
- createTree();
-
- if (dependencyTrees == null || dependencyTrees.isEmpty()) {
- clear();
- add(title);
- add(createNoLibsMessage());
-
- } else {
- display(dependencyTrees, null);
- filter();
-
- clear();
- add(title);
- add(tree);
- }
- }
-
- private void createTitle(Resource project) {
- String html = Icons.forQualifier(project.getQualifier()).getHTML();
- html += " <span class=''> " + project.getName() + "</span> ";
-
- if (project.getVersion() != null) {
- html += project.getVersion() + " ";
- }
- title = new HTML(html);
- }
-
- private void display(List<DependencyTree> depTrees, TreeItem parentLibrary) {
- if (depTrees != null) {
- for (DependencyTree depTree : depTrees) {
- Library library = new Library(depTree);
- if (parentLibrary == null) {
- tree.addItem(library);
- library.setState(true);
- } else {
- parentLibrary.addItem(library);
- }
- display(depTree.getTo(), library);
- library.setState(true);
- }
- }
- }
-
- private void createTree() {
- tree = new Tree();
- tree.setAnimationEnabled(false);
- }
- });
- }
-
- private Label createNoLibsMessage() {
- Label msg = new Label(Dictionary.getDictionary("l10n").get("libs.noLibraries"));
- msg.setStyleName("nolibs");
- return msg;
- }
-
- public void filter() {
- boolean visible = tree.getItemCount() == 0 && !filters.hasKeyword();
- for (int index = 0; index < tree.getItemCount(); index++) {
- Library lib = (Library) tree.getItem(index);
- visible |= !lib.filter(filters.getKeywordFilter().getKeyword(), filters.isTestFiltered());
- }
- setVisible(visible);
- }
-
- public void expandCollapse(boolean expand) {
- for (int index = 0; index < tree.getItemCount(); index++) {
- openItem(tree.getItem(index), expand);
- }
- }
-
- private void openItem(TreeItem item, boolean open) {
- item.setState(open);
- for (int i = 0; i < item.getChildCount(); i++) {
- openItem(item.getChild(i), open);
- }
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
deleted file mode 100644
index e75b14c65ae..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.page;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.*;
-import org.sonar.plugins.design.ui.page.client.DesignPage;
-
-@RequiredMeasures(allOf = {CoreMetrics.DEPENDENCY_MATRIX_KEY})
-@ResourceQualifier({Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY})
-@DefaultTab(metrics = {
- CoreMetrics.DEPENDENCY_MATRIX_KEY, CoreMetrics.PACKAGE_FEEDBACK_EDGES_KEY, CoreMetrics.PACKAGE_CYCLES_KEY,
- CoreMetrics.PACKAGE_TANGLE_INDEX_KEY, CoreMetrics.PACKAGE_TANGLES_KEY, CoreMetrics.FILE_CYCLES_KEY,
- CoreMetrics.FILE_TANGLE_INDEX_KEY, CoreMetrics.FILE_TANGLES_KEY, CoreMetrics.FILE_FEEDBACK_EDGES_KEY})
-@NavigationSection({NavigationSection.RESOURCE, NavigationSection.RESOURCE_TAB})
-@UserRole(UserRole.USER)
-public class GwtDesignPage extends GwtPage {
-
- public String getGwtId() {
- return DesignPage.GWT_ID;
- }
-
- public String getTitle() {
- return "Design";
- }
-
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java
deleted file mode 100644
index c17c1699743..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.page.client;
-
-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.Configuration;
-import org.sonar.gwt.Links;
-import org.sonar.gwt.ui.Icons;
-import org.sonar.gwt.ui.Loading;
-import org.sonar.wsclient.gwt.AbstractCallback;
-import org.sonar.wsclient.gwt.AbstractListCallback;
-import org.sonar.wsclient.gwt.Sonar;
-import org.sonar.wsclient.services.Dependency;
-import org.sonar.wsclient.services.DependencyQuery;
-import org.sonar.wsclient.services.Resource;
-
-import java.util.List;
-
-public final class DependencyInfo extends Composite {
-
- private static final DependencyInfo INSTANCE = new DependencyInfo();
-
- private VerticalPanel panel;
- private Loading loading = new Loading();
- private String currentDependencyId = null;
- private boolean popupMode = false;
-
- private DependencyInfo() {
- panel = new VerticalPanel();
- initWidget(panel);
- }
-
- public static DependencyInfo getInstance() {
- return INSTANCE;
- }
-
-
- public void showOrPopup(String dependencyId) {
- if (popupMode) {
- Window.open(Links.urlForResourcePage(Configuration.getResourceId(), DesignPage.GWT_ID, "layout=false&depId=" + dependencyId),
- "dependency", Links.DEFAULT_POPUP_HTML_FEATURES);
-
- } else {
- INSTANCE.show(dependencyId);
- }
- }
-
- public void show(String dependencyId) {
- panel.clear();
- currentDependencyId = dependencyId;
- if (dependencyId != null) {
- panel.add(loading);
- loadDependency(dependencyId);
- }
- }
-
- public DependencyInfo setPopupMode(boolean b) {
- this.popupMode = b;
- return this;
- }
-
- public void popup() {
- popupMode = true;
- panel.clear();
- showOrPopup(currentDependencyId);
- }
-
- private void setLoaded() {
- loading.removeFromParent();
- }
-
- private void loadDependency(String dependencyId) {
- DependencyQuery query = DependencyQuery.createForId(dependencyId);
- Sonar.getInstance().find(query, new AbstractCallback<Dependency>() {
- @Override
- protected void doOnResponse(Dependency dependency) {
- if (dependency == null) {
- setLoaded();
- panel.add(new Label(Dictionary.getDictionary("l10n").get("noData")));
- } else {
- loadSubDependencies(dependency);
- }
- }
-
- @Override
- protected void doOnError(int errorCode, String errorMessage) {
- super.doOnError(errorCode, errorMessage);
- }
- });
- }
-
- private void loadSubDependencies(final Dependency dependency) {
- DependencyQuery query = DependencyQuery.createForSubDependencies(dependency.getId());
- Sonar.getInstance().findAll(query, new AbstractListCallback<Dependency>() {
-
- @Override
- protected void doOnResponse(final List<Dependency> subDependencies) {
- Grid table = new Grid(subDependencies.size() + 1, 5);
- table.setStyleName("depInfo");
- createHeader(dependency, table);
-
- for (int row = 0; row < subDependencies.size(); row++) {
- Dependency dep = subDependencies.get(row);
- table.setWidget(row + 1, 0, new HTML(Icons.forQualifier(dep.getFromQualifier()).getHTML()));
- if (Resource.QUALIFIER_FILE.equals(dep.getFromQualifier()) || Resource.QUALIFIER_CLASS.equals(dep.getFromQualifier())) {
- table.setWidget(row + 1, 1, createLink(dep.getFromId(), dep.getFromName()));
- } else {
- table.setText(row + 1, 1, dep.getFromName());
- }
- table.setText(row + 1, 2, " " + dep.getUsage() + " ");
- table.setWidget(row + 1, 3, new HTML(Icons.forQualifier(dep.getToQualifier()).getHTML()));
- if (Resource.QUALIFIER_FILE.equals(dep.getToQualifier()) || Resource.QUALIFIER_CLASS.equals(dep.getToQualifier())) {
- table.setWidget(row + 1, 4, createLink(dep.getToId(), dep.getToName()));
- } else {
- table.setText(row + 1, 4, dep.getToName());
- }
- }
-
-
- panel.clear();
- if (!popupMode) {
- panel.add(createNewWindowLink());
- }
- panel.add(table);
- }
- });
- }
-
- private Label createLink(final long resourceId, final String resourceName) {
- Label link = new Label(resourceName);
- link.setStyleName("link");
- link.addClickHandler(new ClickHandler() {
-
- public void onClick(ClickEvent event) {
- Links.openResourcePopup(String.valueOf(resourceId));
- }
- });
- return link;
- }
-
- private void createHeader(final Dependency dependency, final Grid grid) {
- grid.getRowFormatter().setStyleName(0, "depInfoHeader");
-
- grid.setWidget(0, 0, Icons.forQualifier(dependency.getFromQualifier()).createImage());
- grid.setText(0, 1, dependency.getFromName());
-
- grid.setWidget(0, 3, Icons.forQualifier(dependency.getToQualifier()).createImage());
- grid.setText(0, 4, dependency.getToName());
- }
-
- private Widget createNewWindowLink() {
- Label popup = new Label(Dictionary.getDictionary("l10n").get("newWindow"));
- popup.setStyleName("newwindow");
- popup.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- popup();
- }
- });
- return popup;
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DesignPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DesignPage.java
deleted file mode 100644
index 605f1cf66aa..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DesignPage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.page.client;
-
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import org.sonar.gwt.Configuration;
-import org.sonar.gwt.Metrics;
-import org.sonar.gwt.ui.Page;
-import org.sonar.wsclient.gwt.AbstractCallback;
-import org.sonar.wsclient.gwt.Sonar;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-public class DesignPage extends Page {
-
- public static final String GWT_ID = "org.sonar.plugins.design.ui.page.DesignPage";
- private Dsm matrix;
-
- @Override
- protected Widget doOnResourceLoad(Resource resource) {
- String dependencyId = Configuration.getRequestParameter("depId");
- if (dependencyId != null) {
- DependencyInfo.getInstance().setPopupMode(true).show(dependencyId);
- return DependencyInfo.getInstance();
- }
- VerticalPanel layout = new VerticalPanel();
- layout.setWidth("100%");
- Panel hPanel = new VerticalPanel();
- matrix = new Dsm();
- hPanel.add(matrix);
- hPanel.add(DependencyInfo.getInstance());
- layout.add(hPanel);
- loadMatrix(resource);
- return layout;
- }
-
- private void loadMatrix(Resource resource) {
- Sonar.getInstance().find(ResourceQuery.createForMetrics(resource.getId().toString(), "dsm"), new AbstractCallback<Resource>() {
-
- @Override
- protected void doOnResponse(Resource resource) {
- if (resource == null || resource.getMeasure(Metrics.DEPENDENCY_MATRIX) == null) {
- matrix.displayNoData();
-
- } else {
- Measure dsm = resource.getMeasure(Metrics.DEPENDENCY_MATRIX);
- matrix.display(DsmData.parse(dsm.getData()));
- }
- }
- });
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java
deleted file mode 100644
index 1dad1fa06c5..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.page.client;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickEvent;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
-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.Icons;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class Dsm extends Composite {
-
- /* STYLES */
- public static final String DSM = "dsm";
-
- public static final String HEADER = "htable";
- public static final String HEADER_TITLE = "ht";
- public static final String HEADER_SELECTED_SUFFIX = "s";
- public static final String HEADER_INDICATOR = "hi";
- public static final String HEADER_HIGHER_INDICATOR_SUFFIX = "h";
- public static final String HEADER_LOWER_INDICATOR_SUFFIX = "l";
-
- public static final String GRID = "gtable";
- public static final String GRID_CELL_BOTTOM_LEFT = "cbl";
- public static final String GRID_CELL_TOP_RIGHT = "ctr";
- public static final String GRID_CELL_DIAGONAL = "cd";
- public static final String GRID_CELL_SELECTION1_SUFFIX = "s1";
- public static final String GRID_CELL_SELECTION2_SUFFIX = "s2";
- public static final String GRID_CELL_COMB1_SUFFIX = "c1";
- public static final String GRID_CELL_COMB2_SUFFIX = "c2";
- public static final String[] GRID_SUFFIXES = {GRID_CELL_SELECTION1_SUFFIX, GRID_CELL_SELECTION2_SUFFIX, GRID_CELL_COMB1_SUFFIX, GRID_CELL_COMB2_SUFFIX};
-
-
- private VerticalPanel dsm = new VerticalPanel();
- private DsmData.Rows data;
- private Label[][] cells;
- private Label[] titles;
- private Label[] indicators;
- private List<Label> highlightedCells = new LinkedList<Label>();
-
- public Dsm() {
- dsm.setStylePrimaryName(DSM);
- initWidget(dsm);
- }
-
- private Widget createLegend() {
- Dictionary l10n = Dictionary.getDictionary("l10n");
- HorizontalPanel legend = new HorizontalPanel();
- legend.getElement().setId("dsmlegend");
- legend.add(new HTML("<div class='square gray'> </div>"));
- legend.add(new Label(l10n.get("design.legend.dependencies")));
- legend.add(new HTML("<div class='space'></div>"));
- legend.add(new HTML("<div class='square red'> </div> "));
- legend.add(new Label(l10n.get("design.legend.cycles")));
- legend.add(new HTML(" <div class='space'></div> "));
- legend.add(new HTML("<div class='square green'></div> "));
- legend.add(new Label(l10n.get("design.legend.uses")));
- legend.add(new HTML("<div class='square blue'></div> "));
- legend.add(new Label(l10n.get("design.legend.uses")));
- legend.add(new HTML(" <div class='square yellow'></div>"));
- return legend;
- }
-
- public void displayNoData() {
- dsm.clear();
- dsm.add(new Label(Dictionary.getDictionary("l10n").get("noData")));
- }
-
- public void display(DsmData.Rows data) {
- if (data == null) {
- displayNoData();
-
- } else {
- this.data = data;
- dsm.clear();
- dsm.add(createHelp());
- dsm.add(createLegend());
- HorizontalPanel matrix = new HorizontalPanel();
- matrix.add(createRowHeader());
- matrix.add(createGrid());
- dsm.add(matrix);
- }
- }
-
- private Widget createHelp() {
- HorizontalPanel help = new HorizontalPanel();
- help.getElement().setId("dsmhelp");
- Dictionary l10n = Dictionary.getDictionary("l10n");
- Anchor link = new Anchor(l10n.get("design.help"), "http://docs.codehaus.org/x/QQFhC", "docsonar");
- help.add(Icons.get().help().createImage());
- help.add(link);
- return help;
- }
-
- private Grid createRowHeader() {
- Grid header = new Grid(data.size(), 2);
- header.setCellPadding(0);
- header.setCellSpacing(0);
- header.setStylePrimaryName(HEADER);
-
- titles = new Label[data.size()];
- indicators = new Label[data.size()];
- for (int indexRow = 0; indexRow < data.size(); indexRow++) {
- DsmData.Row row = data.get(indexRow);
-
- HTML title = buildRowTitle(indexRow, row);
- titles[indexRow] = title;
- header.setWidget(indexRow, 0, title);
-
- Label indicator = buildLabel("", HEADER_INDICATOR);
- header.setWidget(indexRow, 1, indicator);
- indicators[indexRow] = indicator;
- }
- return header;
- }
-
- private Grid createGrid() {
- int rowsCount = data.size();
- Grid grid = new Grid(rowsCount, rowsCount);
- grid.setCellPadding(0);
- grid.setCellSpacing(0);
- grid.setStylePrimaryName(GRID);
-
- return loadGridCells(grid, data);
- }
-
- private Grid loadGridCells(Grid grid, DsmData.Rows data) {
- int size = data.size();
- cells = new Label[size][size];
- for (int row = 0; row < size; row++) {
- DsmData.Row resource = data.get(row);
- for (int col = 0; col < resource.size(); col++) {
- Label cell = createGridCell(row, col, resource.getWeight(col));
- grid.setWidget(row, col, cell);
- cells[row][col] = cell;
- }
- }
- return grid;
- }
-
-
- /* ---------------- ACTIONS -------------------- */
-
- public void onCellClicked(int row, int col) {
- cancelHighlighting();
-
- highlightTitle(row);
- highlightTitle(col);
- highlightIndicator(row);
- highlightIndicator(col);
-
- for (int i = 0; i < cells.length; i++) {
- for (int j = 0; j < cells.length; j++) {
- Label cell = cells[i][j];
- if (i == row && j == col) {
- highlightCell(cell, GRID_CELL_SELECTION1_SUFFIX);
-
- } else if (j == row && i == col) {
- // opposite
- highlightCell(cell, GRID_CELL_SELECTION1_SUFFIX);
-
- } else if (j == col || i == col) {
- highlightCell(cell, GRID_CELL_COMB1_SUFFIX);
-
- } else if (i == row || j == row) {
- highlightCell(cell, GRID_CELL_COMB2_SUFFIX);
- }
- }
- }
- }
-
- private void displayDependencyInfo(int row, int col) {
- DsmData.Cell cell = data.get(row).getCell(col);
- DependencyInfo.getInstance().showOrPopup(cell.getDependencyId());
- }
-
- public void onTitleClicked(int row) {
- cancelHighlighting();
- highlightTitle(row);
- highlightIndicator(row);
-
- // highlight row
- for (int col = 0; col < cells[row].length; col++) {
- highlightCell(cells[row][col], GRID_CELL_SELECTION2_SUFFIX);
- if (col < row && hasWeight(cells[row][col])) {
- highlightIndicator(col, true);
- }
- }
-
- // highlight column
- for (int i = 0; i < cells.length; i++) {
- if (i != row) {
- highlightCell(cells[i][row], GRID_CELL_SELECTION2_SUFFIX);
- if (i > row && hasWeight(cells[i][row])) {
- highlightIndicator(i, false);
- }
- }
- }
- }
-
- private boolean hasWeight(Label label) {
- return label.getText().length() > 0;
- }
-
-
- /*--------- EFFECTS ----------*/
- private void cancelHighlighting() {
- cancelGridHighlighting();
- cancelIndicatorsHighlighting();
- cancelTitlesHighlighting();
- }
-
- private void cancelGridHighlighting() {
- for (Label cell : highlightedCells) {
- for (String suffix : GRID_SUFFIXES) {
- cell.removeStyleDependentName(suffix);
- }
- }
- highlightedCells.clear();
- }
-
- private void highlightCell(Label cell, String style) {
- cell.addStyleDependentName(style);
- highlightedCells.add(cell);
- }
-
- private void highlightTitle(int row) {
- titles[row].addStyleDependentName(HEADER_SELECTED_SUFFIX);
- }
-
- private void cancelTitlesHighlighting() {
- for (Label title : titles) {
- title.removeStyleDependentName(HEADER_SELECTED_SUFFIX);
- }
- }
-
- private void cancelIndicatorsHighlighting() {
- for (Label indicator : indicators) {
- indicator.removeStyleDependentName(HEADER_HIGHER_INDICATOR_SUFFIX);
- indicator.removeStyleDependentName(HEADER_LOWER_INDICATOR_SUFFIX);
- indicator.removeStyleDependentName(HEADER_SELECTED_SUFFIX);
- }
- }
-
- private void highlightIndicator(int row) {
- indicators[row].addStyleDependentName(HEADER_SELECTED_SUFFIX);
- }
-
- private void highlightIndicator(int row, boolean higher) {
- indicators[row].addStyleDependentName(higher ? HEADER_HIGHER_INDICATOR_SUFFIX : HEADER_LOWER_INDICATOR_SUFFIX);
- }
-
-
- /* ---------- COMPONENTS ------------ */
- private Label createGridCell(final int row, final int col, final int weight) {
- Label cell;
- if (row == col) {
- cell = createDiagonalCell(row);
-
- } else {
- cell = createNonDiagonalCell(row, col, weight);
- }
- return cell;
- }
-
- private Label createNonDiagonalCell(final int row, final int col, int weight) {
- Label cell;
- cell = buildCell(row, col, weight, col > row ? GRID_CELL_TOP_RIGHT : GRID_CELL_BOTTOM_LEFT);
-
- if (weight > 0) {
- String tooltip = data.get(col).getName() + " -> " + data.get(row).getName() + " (" + weight + "). " + Dictionary.getDictionary("l10n").get("design.cellTooltip");
- cell.setTitle(tooltip);
- }
- return cell;
- }
-
- private Label createDiagonalCell(final int row) {
- Label cell;
- cell = buildLabel("-", GRID_CELL_DIAGONAL);
- cell.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent event) {
- onTitleClicked(row);
- }
- });
- return cell;
- }
-
- private HTML buildRowTitle(final int indexRow, final DsmData.Row row) {
- HTML title = new HTML(Icons.forQualifier(row.getQualifier()).getHTML() + " " + row.getName()) {
- {
- addDomHandler(new DoubleClickHandler() {
- public void onDoubleClick(DoubleClickEvent pEvent) {
- if (row.getId() != null) {
- if (!"FIL".equals(row.getQualifier()) && !"CLA".equals(row.getQualifier())) {
- Window.Location.assign(Links.urlForResourcePage(row.getId(), DesignPage.GWT_ID, null));
- } else {
- Links.openMeasurePopup(row.getId(), null);
- }
- }
- }
- }, DoubleClickEvent.getType());
- }
- };
- title.setStylePrimaryName(HEADER_TITLE);
- title.setTitle(Dictionary.getDictionary("l10n").get("design.rowTooltip"));
- final int finalIndexRow = indexRow;
- title.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- onTitleClicked(finalIndexRow);
- }
- });
- return title;
- }
-
- private static Label buildLabel(String text, String primaryStyle) {
- Label label = new Label(text);
- label.setStylePrimaryName(primaryStyle);
- return label;
- }
-
- private Label buildCell(final int row, final int col, int weight, String primaryStyle) {
- String text = "";
- if (weight > 0) {
- text = "<span>" + Integer.toString(weight) + "</span>";
- }
-
- HTML cell = new HTML(text) {
- {
- addDomHandler(new DoubleClickHandler() {
- public void onDoubleClick(DoubleClickEvent pEvent) {
- displayDependencyInfo(row, col);
- }
- }, DoubleClickEvent.getType());
- }
- };
- cell.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent event) {
- onCellClicked(row, col);
- }
- });
- cell.setStylePrimaryName(primaryStyle);
- return cell;
- }
-
-}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DsmData.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DsmData.java
deleted file mode 100644
index aa4189011a1..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DsmData.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.design.ui.page.client;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public final class DsmData {
-
- public static class Row extends JavaScriptObject {
-
- // Overlay types always have protected, zero-arg ctors
- protected Row() {
- }
-
- public final native String getId() /*-{ return this.i; }-*/;
- public final native String getName() /*-{ return this.n; }-*/;
- public final native String getQualifier() /*-{ return this.q; }-*/;
- public final native Cell getCell(final int col) /*-{ return this.v[col]; }-*/;
- public final native int size() /*-{ return this.v.length; }-*/;
- public final int getWeight(final int col) {
- Cell cell = getCell(col);
- return (cell==null) ? 0 : cell.getWeight();
- }
- }
-
- public static class Cell extends JavaScriptObject {
-
- // Overlay types always have protected, zero-arg ctors
- protected Cell() {
- }
-
- public final native String getDependencyId() /*-{ if(this.i) {return this.i;} else { return null;} }-*/;
- public final native int getWeight() /*-{ return this.w || 0; }-*/;
- }
-
-
- public static class Rows extends JavaScriptObject {
- protected Rows() {
- }
- public final native int size() /*-{ return this.length; }-*/;
- public final native Row get(int i) /*-{ return this[i]; }-*/;
- }
-
- public static native Rows parse(String json) /*-{
- return eval('(' + json + ')')
- }-*/;
-
-}
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPage.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPage.gwt.xml
deleted file mode 100644
index c37ecc6e9fe..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPage.gwt.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<module>
- <inherits name="com.google.gwt.user.User"/>
- <inherits name="com.google.gwt.json.JSON"/>
- <inherits name="com.google.gwt.http.HTTP"/>
- <inherits name="org.sonar.Sonar"/>
- <stylesheet src="libraries.css"/>
- <entry-point class="org.sonar.plugins.design.ui.libraries.client.LibrariesPage"/>
-</module>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPageDev.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPageDev.gwt.xml
deleted file mode 100644
index 37f3a2f0609..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPageDev.gwt.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<module rename-to="org.sonar.plugins.design.ui.libraries.LibrariesPage">
- <inherits name="org.sonar.plugins.design.ui.libraries.LibrariesPage"/>
- <inherits name="org.sonar.SonarDev"/>
-
- <entry-point class="org.sonar.plugins.design.ui.libraries.client.LibrariesPage"/>
-</module>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/libraries.css b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/libraries.css
deleted file mode 100644
index 191ade42a86..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/libraries.css
+++ /dev/null
@@ -1,22 +0,0 @@
-.libs {
- border: 1px solid #ccc;
- padding: 5px 10px;
- margin-top: 5px;
-}
-.libs .gwt-Tree img {
- /* hack to align rows */
- margin-left: 6px;
-}
-.libFilter input {
- margin-right: 3px;
-}
-.libFilter {
-
-}
-.libFilter td {
- padding-right: 15px;
-}
-.nolibs {
- padding: 0 0 0 20px;
- font-size: 93%;
-} \ No newline at end of file
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/test.html b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/test.html
deleted file mode 100644
index 1f5af2b1bbc..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/test.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <meta name="gwt:property" content="locale=fr_CH">
-
- <title>Libraries</title>
- <link href="http://localhost:9000/stylesheets/sonar.css" media="all" rel="Stylesheet" type="text/css" />
- <script src="http://localhost:9000/javascripts/sonar.js" type="text/javascript"></script>
-</head>
-
-<body>
-<h1>Libraries</h1>
-<div id="gwtpage">
-</div>
-<script type="text/javascript">
-var config = {
- "sonar_url": "http://localhost:9000",
- "resource":[{"id":1141, "key":"org.apache.struts:struts-parent","scope": "PRJ", "qualifier": "TRK", "name": "Struts Core", "lang":"java"}]
-};
- var modules = {};
-
-var rp = {
- "page":"org.sonar.plugins.design.ui.libraries.LibrariesPage"
- ,"filter2":"commons"
- };
-
-</script>
-<script type="text/javascript" language="javascript" src="org.sonar.plugins.design.ui.libraries.LibrariesPage.nocache.js"></script>
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPage.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPage.gwt.xml
deleted file mode 100644
index f97ac1b5574..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPage.gwt.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<module>
- <inherits name="com.google.gwt.user.User"/>
- <inherits name="com.google.gwt.json.JSON"/>
- <inherits name="com.google.gwt.http.HTTP"/>
- <inherits name="org.sonar.Sonar"/>
- <stylesheet src="design.css"/>
- <entry-point class="org.sonar.plugins.design.ui.page.client.DesignPage"/>
-</module>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPageDev.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPageDev.gwt.xml
deleted file mode 100644
index 0bbeccd6929..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPageDev.gwt.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<module rename-to="org.sonar.plugins.design.ui.page.DesignPage">
- <inherits name="org.sonar.plugins.design.ui.page.DesignPage"/>
- <inherits name="org.sonar.SonarDev"/>
-
- <entry-point class="org.sonar.plugins.design.ui.page.client.DesignPage"/>
-</module>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/design.css b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/design.css
deleted file mode 100644
index a5a8be74221..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/design.css
+++ /dev/null
@@ -1,227 +0,0 @@
-.dsm {
- border-collapse: separate;
- background-color: #fff;
- font-family: sans-serif;
- font-size: 9pt;
- color: #222;
- margin-bottom: 10px;
- padding: 5px 10px;
-}
-
-/*------- LEGEND */
-
-#dsmlegend {
- padding: 5px;
- margin: 0 0 5px 5px;
-}
-#dsmlegend td {
- white-space: nowrap;
-}
-#dsmlegend .square {
- width: 11px;
- height: 14px;
- display: inline-block;
- vertical-align: bottom;
- padding-left: 3px;
- margin-bottom: 1px;
- margin-right: 5px;
-}
-#dsmlegend .gwt-Label {
- padding-right: 5px;
-}
-#dsmhelp {
- margin: 0 0 5px 5px;
-}
-#dsmhelp img {
- margin-right: 4px;
-}
-
-.dsm .gray {
- background-color: #ddd;
-}
-.dsm .red {
- background-color: #c13333;
-}
-.dsm .green {
- background-color: #46c557;
- background-image:url('green-stripes.png');
-}
-.dsm .blue {
- background-color: #4B9FD5;
-}
-.dsm .yellow {
- background-color: #d49e37;
-}
-.dsm .space {
- display: inline-block;
- width: 12px;
-}
-
-
-
-/*------- LEFT HEADER */
-
-/* header table */
-.dsm .htable {
- padding: 1px;
- border-top: 1px solid #676b9a;
- border-right: 1px solid #676b9a;
-}
-
-/* header title */
-.dsm .ht {
- background-color: #CAE3F2;
- color: #434343;
- height: 16px;
- padding: 2px 0 3px 5px;
- border-bottom: 1px solid #676b9a;
- border-left: 1px solid #676b9a;
- cursor: pointer;
- white-space: nowrap;
-}
-.dsm .ht-s {
- background-color: #4B9FD5;
- color: #efefef;
-}
-.dsm .ht img {
- vertical-align: text-bottom;
-}
-
-/* header indicator */
-.dsm .hi {
- background-color: #CAE3F2;
- width: 8px;
- height: 21px;
- border-bottom: 1px solid #676b9a;
-}
-.dsm .hi-s {
- background-color: #4B9FD5;
-}
-.dsm .hi-h {
- background-color: #46c557;
- background-image:url('green-stripes.png');
-}
-.dsm .hi-l {
- background-color: #d49e37;
-}
-
-
-
-/*------- GRID */
-
-.dsm .gtable {
- padding: 1px;
- border-top: 1px solid #ccc;
-
-}
-
-/* cell on bottom left */
-.dsm .cbl {
- height: 16px;
- width: 23px;
- padding-top: 5px;
- background-color: #fff;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- color: #434343;
- text-align: center;
- cursor: pointer;
-}
-.dsm .cbl span {
- background-color: #ddd;
- padding: 2px 2px 0 2px;
-}
-
-/*
- cell on top right : has feedback edge
- total height: height + padding-top + 2*border = 25px
-*/
-.dsm .ctr {
- height: 16px;
- width: 23px;
- padding-top: 5px;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- font-weight: normal;
- text-align: center;
- cursor: pointer;
-}
-.dsm .ctr span {
- background-color: #c13333;
- color: #fff;
- padding: 2px 2px 0 2px;
-}
-
-/* cell on diagonal */
-.dsm .cd {
- height: 16px;
- width: 23px;
- padding-top: 5px;
- background-color: #fff;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- color: #434343;
- text-align: center;
- cursor: pointer;
-}
-
-/* selected cell, mode 1 */
-.dsm .cbl-s1, .dsm .ctr-s1, .dsm .cd-s1 {
- background-color: #b580c9;
-}
-
-/* selected cell, mode 2 */
-.dsm .cbl-s2 {
- background-color: #CAE3F2;
-}
-.dsm .ctr-s2 {
- background-color: #CAE3F2;
-}
-.dsm .cd-s2 {
- background-color: #4B9FD5;
- color: #efefef;
-}
-
-/* comb 1 */
-.dsm .cbl-c1, .dsm .ctr-c1, .dsm .cd-c1 {
- background-color: #46c557;
- background-image:url('green-stripes.png');
-}
-
-/* comb 2 */
-.dsm .cbl-c2, .dsm .ctr-c2, .dsm .cd-c2 {
- background-color: #d49e37;
-}
-
-
-/*---------- DEPENDENCY INFO */
-.depInfo {
- background-color: #fff;
- border-top-width: 0;
- border-bottom: 2px solid #ccc;
- border-left: 1px solid #ccc;
- border-right: 1px solid #ccc;
- width: 100%;
-}
-.depInfo td {
- padding: 3px 2px;
-}
-.link {
- text-decoration:underline;
- cursor: pointer;
-}
-.newwindow {
- text-decoration:underline;
- cursor: pointer;
- padding: 3px;
- color: #777;
-}
-.depInfoHeader {
- background-color: #efefef;
- border-top: 2px solid #ccc;
- border-bottom: 2px solid #ccc;
- border-left: 1px solid #ccc;
- border-right: 1px solid #ccc;
- padding: 5px;
- width: 100%;
-}
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/green-stripes.png b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/green-stripes.png
deleted file mode 100644
index 56509c4dab2..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/green-stripes.png
+++ /dev/null
Binary files differ
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/test.html b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/test.html
deleted file mode 100644
index daf6bdeef7e..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/test.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <meta name="gwt:property" content="locale=fr_CH">
-
- <title>DSM</title>
- <link href="http://localhost:9000/stylesheets/sonar.css" media="all" rel="Stylesheet" type="text/css" />
- <script src="http://localhost:9000/javascripts/sonar.js" type="text/javascript"></script>
-</head>
-
-<body>
-<h1>Design Structure Matrix</h1>
-<div id="gwtpage">
-</div>
-<script type="text/javascript">
-var config = {
- "sonar_url": "http://localhost:9000",
- "resource":[{"id":1, "key":"org.apache.struts:struts-parent","scope": "PRJ", "qualifier": "BRC", "name": "Struts Core", "lang":"java"}]
-};
- var modules = {};
-</script>
-<script type="text/javascript" language="javascript" src="org.sonar.plugins.design.ui.page.DesignPage.nocache.js"></script>
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/yellow-stripes.png b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/yellow-stripes.png
deleted file mode 100644
index fb4cccc1605..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/yellow-stripes.png
+++ /dev/null
Binary files differ