ONOS-4733: Simplified Settings Table view (removed redundant data)
- Now shows just simple class name for component
- Removed default value column
- Values that are *not* the same as the default are highlighted (emboldened)
- Table rows now selectable and show details panel
- panel shows component fully qualified class name
- panel currently read-only
- in future, user will be able to change the property value from here
Change-Id: I01a2af727dcfad82c6b7d2378701a5cb3e24e43a
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/SettingsViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/SettingsViewMessageHandler.java
index e83dad7..3ca6e88 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/SettingsViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/SettingsViewMessageHandler.java
@@ -36,14 +36,17 @@
private static final String SETTINGS = "settings";
private static final String COMPONENT = "component";
+ private static final String FQ_COMPONENT = "fqComponent";
private static final String ID = "id";
private static final String TYPE = "type";
private static final String VALUE = "value";
private static final String DEFAULT = "defValue";
private static final String DESC = "desc";
+ private static final char DOT = '.';
+
private static final String[] COL_IDS = {
- COMPONENT, ID, TYPE, VALUE, DEFAULT, DESC
+ COMPONENT, FQ_COMPONENT, ID, TYPE, VALUE, DEFAULT, DESC
};
@Override
@@ -90,13 +93,25 @@
}
}
- private void populateRow(TableModel.Row row, String component, ConfigProperty prop) {
- row.cell(COMPONENT, component)
+ private void populateRow(TableModel.Row row, String fqComp,
+ ConfigProperty prop) {
+ row.cell(COMPONENT, simpleName(fqComp))
+ .cell(FQ_COMPONENT, fqComp)
.cell(ID, prop.name())
- .cell(TYPE, prop.type().toString().toLowerCase())
+ .cell(TYPE, typeName(prop))
.cell(VALUE, prop.value())
.cell(DEFAULT, prop.defaultValue())
.cell(DESC, prop.description());
}
+
+ // return just simple class name: "a.b.c.MyClass" -> "MyClass"
+ private String simpleName(String component) {
+ int lastDot = component.lastIndexOf(DOT);
+ return lastDot < 0 ? component : component.substring(lastDot + 1);
+ }
+
+ private String typeName(ConfigProperty prop) {
+ return prop.type().toString().toLowerCase();
+ }
}
}