Measure debt = resource.getMeasures().get(0);
if (debt != null && debt.getData() != null) {
Map<String, String> map = debt.getDataAsMap(";");
- renderPriority(grid, row, map, 1, "BLOCKER");
- renderPriority(grid, row, map, 3, "CRITICAL");
- renderPriority(grid, row, map, 5, "MAJOR");
- renderPriority(grid, row, map, 7, "MINOR");
- renderPriority(grid, row, map, 9, "INFO");
+ renderSeverity(grid, row, map, 1, "BLOCKER");
+ renderSeverity(grid, row, map, 3, "CRITICAL");
+ renderSeverity(grid, row, map, 5, "MAJOR");
+ renderSeverity(grid, row, map, 7, "MINOR");
+ renderSeverity(grid, row, map, 9, "INFO");
}
}
- private void renderPriority(Grid grid, int row, Map<String, String> map, int column, String priority) {
- grid.setWidget(row, column, Icons.forPriority(priority).createImage());
+ private void renderSeverity(Grid grid, int row, Map<String, String> map, int column, String severity) {
+ grid.setWidget(row, column, Icons.forPriority(severity).createImage());
grid.getCellFormatter().setStyleName(row, column, getRowCssClass(row) + " small right");
- if (map.containsKey(priority)) {
- grid.setWidget(row, column + 1, new HTML(map.get(priority)));
+ if (map.containsKey(severity)) {
+ grid.setWidget(row, column + 1, new HTML(map.get(severity)));
} else {
grid.setWidget(row, column + 1, new HTML("0"));
}
public class MostViolatedRules extends AbstractHotspot {
- private ListBox priorities;
+ private ListBox severity;
public MostViolatedRules(Resource resource) {
super("rules-hotspot", resource);
@Override
Widget createHeader() {
- priorities = new ListBox(false);
- priorities.addItem(I18nConstants.INSTANCE.anyPriority(), "");
- priorities.addItem("Blocker", "BLOCKER");
- priorities.addItem("Critical", "CRITICAL");
- priorities.addItem("Major", "MAJOR");
- priorities.addItem("Minor", "MINOR");
- priorities.addItem("Info", "INFO");
- priorities.setStyleName("small");
- priorities.addChangeHandler(new ChangeHandler() {
+ severity = new ListBox(false);
+ severity.addItem(I18nConstants.INSTANCE.anySeverity(), "");
+ severity.addItem("Blocker", "BLOCKER");
+ severity.addItem("Critical", "CRITICAL");
+ severity.addItem("Major", "MAJOR");
+ severity.addItem("Minor", "MINOR");
+ severity.addItem("Info", "INFO");
+ severity.setStyleName("small");
+ severity.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
loadData();
}
horizontal.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
horizontal.setWidth("98%");
horizontal.add(label);
- horizontal.add(priorities);
+ horizontal.add(severity);
horizontal.add(moreLink);
horizontal.setCellHorizontalAlignment(label, HorizontalPanel.ALIGN_LEFT);
- horizontal.setCellHorizontalAlignment(priorities, HorizontalPanel.ALIGN_LEFT);
+ horizontal.setCellHorizontalAlignment(severity, HorizontalPanel.ALIGN_LEFT);
horizontal.setCellHorizontalAlignment(moreLink, HorizontalPanel.ALIGN_RIGHT);
return horizontal;
}
private String getSelectedPriority() {
- String priority = priorities.getValue(priorities.getSelectedIndex());
+ String priority = severity.getValue(severity.getSelectedIndex());
if ("".equals(priority) || priority == null) {
return null;
}