Support project specific plugin list parameters for edit in UI
Change-Id: I22a383fa0944681078b327cc62c215d08e2c9bc6 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -371,6 +371,9 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
w = renderTextBox(g, param, true);
|
||||
} else if ("BOOLEAN".equals(param.type())) {
|
||||
w = renderCheckBox(g, param);
|
||||
} else if ("LIST".equals(param.type())
|
||||
&& param.permittedValues() != null) {
|
||||
w = renderListBox(g, param);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -399,6 +402,21 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
return checkBox;
|
||||
}
|
||||
|
||||
private ListBox renderListBox(LabeledWidgetsGrid g,
|
||||
ConfigParameterInfo param) {
|
||||
ListBox listBox = new ListBox();
|
||||
for (int i = 0; i < param.permittedValues().length(); i++) {
|
||||
String sv = param.permittedValues().get(i);
|
||||
listBox.addItem(sv);
|
||||
if (sv.equals(param.value())) {
|
||||
listBox.setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
g.add(getDisplayName(param), listBox);
|
||||
saveEnabler.listenTo(listBox);
|
||||
return listBox;
|
||||
}
|
||||
|
||||
private String getDisplayName(ConfigParameterInfo param) {
|
||||
return param.displayName() != null ? param.displayName() : param.name();
|
||||
}
|
||||
@@ -460,6 +478,10 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
values.put(e2.getKey(), ((TextBox) widget).getValue().trim());
|
||||
} else if (widget instanceof CheckBox) {
|
||||
values.put(e2.getKey(), Boolean.toString(((CheckBox) widget).getValue()));
|
||||
} else if (widget instanceof ListBox) {
|
||||
ListBox listBox = (ListBox) widget;
|
||||
String value = listBox.getValue(listBox.getSelectedIndex());
|
||||
values.put(e2.getKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
|
||||
import com.google.gerrit.reviewdb.client.Project.SubmitType;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwtexpui.safehtml.client.FindReplace;
|
||||
import com.google.gwtexpui.safehtml.client.LinkFindReplace;
|
||||
import com.google.gwtexpui.safehtml.client.RawFindReplace;
|
||||
@@ -150,6 +151,7 @@ public class ConfigInfo extends JavaScriptObject {
|
||||
public final native String displayName() /*-{ return this.display_name; }-*/;
|
||||
public final native String type() /*-{ return this.type; }-*/;
|
||||
public final native String value() /*-{ return this.value; }-*/;
|
||||
public final native JsArrayString permittedValues() /*-{ return this.permitted_values; }-*/;
|
||||
|
||||
protected ConfigParameterInfo() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user