From 0b75ead802109cdcdfa67e0098308a6211f19e05 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 11 Dec 2013 10:50:12 +0100 Subject: [PATCH] Faster build by extracting GWT compilation to project sonar-gwt-pages --- plugins/sonar-design-plugin/pom.xml | 44 +-- .../sonar/plugins/design/DesignPlugin.java | 12 +- .../design/ui/libraries/GwtLibrariesPage.java | 42 -- .../design/ui/libraries/client/Filters.java | 118 ------ .../ui/libraries/client/KeywordFilter.java | 44 --- .../ui/libraries/client/LibrariesPage.java | 103 ----- .../design/ui/libraries/client/Library.java | 96 ----- .../ui/libraries/client/ProjectPanel.java | 131 ------- .../plugins/design/ui/page/GwtDesignPage.java | 45 --- .../design/ui/page/client/DependencyInfo.java | 182 --------- .../design/ui/page/client/DesignPage.java | 72 ---- .../plugins/design/ui/page/client/Dsm.java | 369 ------------------ .../design/ui/page/client/DsmData.java | 65 --- .../design/ui/libraries/LibrariesPage.gwt.xml | 8 - .../ui/libraries/LibrariesPageDev.gwt.xml | 6 - .../design/ui/libraries/public/libraries.css | 22 -- .../design/ui/libraries/public/test.html | 33 -- .../plugins/design/ui/page/DesignPage.gwt.xml | 8 - .../design/ui/page/DesignPageDev.gwt.xml | 6 - .../plugins/design/ui/page/public/design.css | 227 ----------- .../design/ui/page/public/green-stripes.png | Bin 117 -> 0 bytes .../plugins/design/ui/page/public/test.html | 27 -- .../design/ui/page/public/yellow-stripes.png | Bin 111 -> 0 bytes pom.xml | 42 +- 24 files changed, 27 insertions(+), 1675 deletions(-) delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Filters.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/KeywordFilter.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/LibrariesPage.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/Library.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/client/ProjectPanel.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DesignPage.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DsmData.java delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPage.gwt.xml delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/LibrariesPageDev.gwt.xml delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/libraries.css delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/libraries/public/test.html delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPage.gwt.xml delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/DesignPageDev.gwt.xml delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/design.css delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/green-stripes.png delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/test.html delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/page/public/yellow-stripes.png 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 @@ -13,6 +13,10 @@ SonarQube :: Plugins :: Design + + org.codehaus.sonar + sonar-gwt-pages + org.codehaus.sonar sonar-core @@ -28,28 +32,12 @@ maven-dependency-tree provided - - org.codehaus.sonar - sonar-gwt-api - ${sonarGwt.version} - provided - org.codehaus.sonar sonar-ws-client 3.3.1 provided - - com.google.gwt - gwt-user - provided - - - com.google.gwt - gwt-incubator - provided - @@ -74,25 +62,25 @@ - org.codehaus.mojo - gwt-maven-plugin + org.apache.maven.plugins + maven-shade-plugin - - - org.sonar.plugins.design.ui.page.DesignPage${gwt.permutationSuffix} - org.sonar.plugins.design.ui.libraries.LibrariesPage${gwt.permutationSuffix} - - ${skipGwt} - ${project.build.directory}/classes - ${gwt.extraJvmArgs} - + package - compile + shade + + + + org.codehaus.sonar:sonar-gwt-pages + + + + org.codehaus.sonar sonar-dev-maven-plugin 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 projectPanels = new ArrayList(); - 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() { - @Override - protected void doOnResponse(List 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 += " " + tree.getResourceName() + " "; - - 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() { - - @Override - protected void doOnResponse(List 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 += " " + project.getName() + " "; - - if (project.getVersion() != null) { - html += project.getVersion() + " "; - } - title = new HTML(html); - } - - private void display(List 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() { - @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() { - - @Override - protected void doOnResponse(final List 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() { - - @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 - - - org.codehaus.mojo - gwt-maven-plugin - 1.2 - org.apache.maven.plugins maven-install-plugin @@ -753,16 +743,6 @@ - - com.google.gwt - gwt-user - 2.0.4 - - - com.google.gwt - gwt-incubator - 2.0.1 - com.ibm.icu icu4j @@ -886,6 +866,11 @@ postgresql 9.1-901-1.jdbc4 + + org.codehaus.sonar + sonar-gwt-pages + 4.0 + net.sourceforge.jtds jtds @@ -1192,10 +1177,6 @@ dev true - - - Dev - -Xmx512m -Xss1024k -Dgwt.draftCompile=true @@ -1284,19 +1265,6 @@ - - - org.codehaus.mojo - gwt-maven-plugin - [1.0,) - - compile - - - - - - org.codehaus.sonar -- 2.39.5