Allow users of ChangeTable to control styling of change rows
Currently it is hard-coded in the ChangeTable that outdated and abandoned changes should be highlighted. With this change users of the ChangeTable can now control from outside which changes should be highlighted and how the highlighting should be done. The ChangeTable which shows the dependencies on the ChangeScreen is using the new ability so that outdated and abandoned changes are now only highlighted in the 'Depends On' section, but not anymore in the 'Needed By' section. Change-Id: If3140a3ad0a47d4c6813fc3aef06adb1c959f49b Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -183,6 +183,23 @@ public class ChangeScreen extends Screen
|
||||
}
|
||||
};
|
||||
dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn());
|
||||
dependsOn.setChangeRowFormatter(new ChangeTable.ChangeRowFormatter() {
|
||||
@Override
|
||||
public String getRowStyle(ChangeInfo c) {
|
||||
if (! c.isLatest() || Change.Status.ABANDONED.equals(c.getStatus())) {
|
||||
return Gerrit.RESOURCES.css().outdated();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayText(final ChangeInfo c, final String displayText) {
|
||||
if (! c.isLatest()) {
|
||||
return displayText + " [OUTDATED]";
|
||||
}
|
||||
return displayText;
|
||||
}
|
||||
});
|
||||
neededBy = new ChangeTable.Section(Util.C.changeScreenNeededBy());
|
||||
dependencies.addSection(dependsOn);
|
||||
dependencies.addSection(neededBy);
|
||||
|
Reference in New Issue
Block a user