use of com.google.gerrit.client.projects.ConfigInfo.ConfigParameterInfo in project gerrit by GerritCodeReview.
the class ProjectInfoScreen method initPluginOptions.
private void initPluginOptions(ConfigInfo info) {
pluginOptionsPanel.clear();
pluginConfigWidgets = new HashMap<>();
for (String pluginName : info.pluginConfig().keySet()) {
Map<String, HasEnabled> widgetMap = new HashMap<>();
pluginConfigWidgets.put(pluginName, widgetMap);
LabeledWidgetsGrid g = new LabeledWidgetsGrid();
g.addHeader(new SmallHeading(AdminMessages.I.pluginProjectOptionsTitle(pluginName)));
pluginOptionsPanel.add(g);
NativeMap<ConfigParameterInfo> pluginConfig = info.pluginConfig(pluginName);
pluginConfig.copyKeysIntoChildren("name");
for (ConfigParameterInfo param : Natives.asList(pluginConfig.values())) {
HasEnabled w;
switch(param.type()) {
case "STRING":
case "INT":
case "LONG":
w = renderTextBox(g, param);
break;
case "BOOLEAN":
w = renderCheckBox(g, param);
break;
case "LIST":
w = renderListBox(g, param);
break;
case "ARRAY":
w = renderStringListPanel(g, param);
break;
default:
throw new UnsupportedOperationException("unsupported widget type");
}
if (param.editable()) {
widgetMap.put(param.name(), w);
} else {
w.setEnabled(false);
}
}
}
enableForm();
}
Aggregations