aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-12-15 18:06:13 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-12-15 18:06:13 +0000
commita8026252cd527d5aeb5897b641ee4a8df19a452c (patch)
treebcf16b9727f3975b9ab786407da086db7fc3da71 /plugins
parentf212d46dd02ed138de0631e40d7ba72cf4083870 (diff)
downloadsonarqube-a8026252cd527d5aeb5897b641ee4a8df19a452c.tar.gz
sonarqube-a8026252cd527d5aeb5897b641ee4a8df19a452c.zip
remove ISO categories from ws-client ResourceQuery + minor improvements of GWT API
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java10
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsViewer.java42
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb2
3 files changed, 29 insertions, 25 deletions
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java
index b5122536668..8f2f85acabd 100644
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java
+++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java
@@ -39,16 +39,16 @@ public class ViolationsPanel extends SourcePanel {
public ViolationsPanel(Resource resource, String filter) {
super(resource);
- loadViolations(resource, filter);
+ loadViolations(resource, filter, null);
}
- protected void loadViolations(final Resource resource, final String filter) {
+ protected void loadViolations(final Resource resource, final String filter, final Date fromDate) {
Sonar.getInstance().findAll(ViolationQuery.createForResource(resource), new AbstractListCallback<Violation>() {
@Override
protected void doOnResponse(List<Violation> violations) {
ViolationsPanel.this.violations = violations;
- filter(filter);
+ filter(filter, fromDate);
setStarted();
}
});
@@ -62,10 +62,10 @@ public class ViolationsPanel extends SourcePanel {
this.expand = expand;
}
- public void filter(String filter) {
+ public void filter(String filter, Date fromDate) {
filteredViolationsByLine.clear();
for (Violation violation : violations) {
- if (filter == null || filter.equals("") || violation.getRuleKey().equals(filter) || violation.getPriority().equals(filter)) {
+ if (filter == null || filter.equals("") || violation.getRuleKey().equals(filter) || violation.getSeverity().equals(filter) || violation.isCreatedAfter(fromDate)) {
Integer line = 0;
if (violation.getLine() != null) {
line = violation.getLine();
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsViewer.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsViewer.java
index 2afccc73f57..35e00a660d7 100644
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsViewer.java
+++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsViewer.java
@@ -48,7 +48,7 @@ public class ViolationsViewer extends Page {
// header
private Grid header = null;
- private ListBox filterBox = null;
+ private ListBox filterBox = null, periodBox = null;
private CheckBox expandCheckbox = null;
private String defaultFilter;
@@ -73,22 +73,27 @@ public class ViolationsViewer extends Page {
initDefaultFilter();
sourcePanel = new ViolationsPanel(resource, defaultFilter);
- header.setHTML(0, 1, "<div class='cell'><span class='note'>" + I18nConstants.INSTANCE.filter() + "</span></div>");
header.getCellFormatter().setStyleName(0, 1, "right");
filterBox = new ListBox();
filterBox.addItem(I18nConstants.INSTANCE.noFilters(), "");
filterBox.setStyleName("small");
-
filterBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String filter = filterBox.getValue(filterBox.getSelectedIndex());
loadSources();
- sourcePanel.filter(filter);
+ sourcePanel.filter(filter, null);
sourcePanel.refresh();
}
});
+ periodBox = new ListBox();
+ periodBox.addItem(I18nConstants.INSTANCE.noFilters(), "");
+ periodBox.setStyleName("small");
+
+ header.setWidget(0, 1, periodBox);
+ header.getCellFormatter().setStyleName(0, 1, "thin cell right");
+
header.setWidget(0, 2, filterBox);
header.getCellFormatter().setStyleName(0, 2, "thin cell right");
@@ -106,7 +111,7 @@ public class ViolationsViewer extends Page {
header.setWidget(0, 4, expandCheckbox);
header.getCellFormatter().setStyleName(0, 4, "thin cell left");
- loadRulePriorities();
+ loadRuleSeverities();
return mainPanel;
}
@@ -117,42 +122,41 @@ public class ViolationsViewer extends Page {
}
}
- private void loadRulePriorities() {
+ private void loadRuleSeverities() {
final ResourceQuery query = ResourceQuery.createForResource(resource, Metrics.BLOCKER_VIOLATIONS,
- Metrics.CRITICAL_VIOLATIONS, Metrics.MAJOR_VIOLATIONS, Metrics.MINOR_VIOLATIONS, Metrics.INFO_VIOLATIONS)
- .setExcludeRulePriorities(true);
+ Metrics.CRITICAL_VIOLATIONS, Metrics.MAJOR_VIOLATIONS, Metrics.MINOR_VIOLATIONS, Metrics.INFO_VIOLATIONS);
Sonar.getInstance().find(query, new AbstractCallback<Resource>(loading) {
@Override
protected void doOnResponse(Resource resource) {
setResourceHasViolations(resource);
- displayRulePriorities(resource);
+ displayRuleSeverities(resource);
loadRules(resource);
}
});
}
- private void displayRulePriorities(Resource resource) {
+ private void displayRuleSeverities(Resource resource) {
final Grid grid = new Grid(1, 10);
header.setWidget(0, 0, grid);
- displayRulePriority(grid, 0, "BLOCKER", resource.getMeasure(Metrics.BLOCKER_VIOLATIONS));
- displayRulePriority(grid, 2, "CRITICAL", resource.getMeasure(Metrics.CRITICAL_VIOLATIONS));
- displayRulePriority(grid, 4, "MAJOR", resource.getMeasure(Metrics.MAJOR_VIOLATIONS));
- displayRulePriority(grid, 6, "MINOR", resource.getMeasure(Metrics.MINOR_VIOLATIONS));
- displayRulePriority(grid, 8, "INFO", resource.getMeasure(Metrics.INFO_VIOLATIONS));
+ displayRuleSeverity(grid, 0, "BLOCKER", resource.getMeasure(Metrics.BLOCKER_VIOLATIONS));
+ displayRuleSeverity(grid, 2, "CRITICAL", resource.getMeasure(Metrics.CRITICAL_VIOLATIONS));
+ displayRuleSeverity(grid, 4, "MAJOR", resource.getMeasure(Metrics.MAJOR_VIOLATIONS));
+ displayRuleSeverity(grid, 6, "MINOR", resource.getMeasure(Metrics.MINOR_VIOLATIONS));
+ displayRuleSeverity(grid, 8, "INFO", resource.getMeasure(Metrics.INFO_VIOLATIONS));
}
- private void displayRulePriority(final Grid grid, final int column, final String priority, final Measure measure) {
+ private void displayRuleSeverity(final Grid grid, final int column, final String severity, final Measure measure) {
String value = "0";
if (measure != null) {
value = measure.getFormattedValue();
- filterBox.addItem(priority + " (" + value + ")", priority);
- if (priority.equals(defaultFilter)) {
+ filterBox.addItem(severity + " (" + value + ")", severity);
+ if (severity.equals(defaultFilter)) {
filterBox.setSelectedIndex(filterBox.getItemCount() - 1);
}
}
- grid.setHTML(0, column, Icons.forPriority(priority).getHTML());
+ grid.setHTML(0, column, Icons.forSeverity(severity).getHTML());
grid.setHTML(0, column + 1, value);
grid.getCellFormatter().setStyleName(0, column, "thin metric right");
grid.getCellFormatter().setStyleName(0, column + 1, "thin left value");
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb
index 5ad038419f8..69edd07cbe9 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb
@@ -32,7 +32,7 @@
<% end %>
<% unless @project.project_links.empty? %>
<tr>
- <td>Links: </td>
+ <td valign="top">Links: </td>
<td id="resource_links">
<% @project.project_links.sort.each do |link| %>
<%= link_to(image_tag(link.icon, :alt => link.name), link.href , :popup => true, :class => 'nolink') -%> <%= link_to(h(link.name), link.href, :popup => true) -%><br/>