Search in sources :

Example 1 with SelectWidget

use of org.rstudio.core.client.widget.SelectWidget in project rstudio by rstudio.

the class NewPackagePage method onAddTopPanelWidgets.

@Override
protected void onAddTopPanelWidgets(HorizontalPanel panel) {
    dirNameLabel_.setText("Package name:");
    String[] labels = { "Package" };
    String[] values = { "package" };
    listProjectType_ = new SelectWidget("Type:", labels, values, false);
    listProjectType_.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            txtProjectName_.setFocus(true);
        }
    });
    panel.add(listProjectType_);
}
Also used : SelectWidget(org.rstudio.core.client.widget.SelectWidget) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler)

Example 2 with SelectWidget

use of org.rstudio.core.client.widget.SelectWidget in project rstudio by rstudio.

the class ProjectTemplateWidget method selectBoxInput.

private ProjectTemplateWidgetItem selectBoxInput(final ProjectTemplateWidgetDescription description) {
    String[] fields = readSelectBoxFields(description);
    String label = ensureEndsWithColon(description.getLabel());
    final SelectWidget widget = new SelectWidget(label, fields);
    String defaultValue = description.getDefault();
    if (!StringUtil.isNullOrEmpty(defaultValue))
        widget.setValue(defaultValue);
    return new ProjectTemplateWidgetItem(widget, new Collector() {

        @Override
        public void collectInput(JsObject receiver) {
            String value = widget.getValue();
            receiver.setString(description.getParameter(), value);
        }
    });
}
Also used : JsObject(org.rstudio.core.client.js.JsObject) SelectWidget(org.rstudio.core.client.widget.SelectWidget) JsArrayString(com.google.gwt.core.client.JsArrayString)

Aggregations

SelectWidget (org.rstudio.core.client.widget.SelectWidget)2 JsArrayString (com.google.gwt.core.client.JsArrayString)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 JsObject (org.rstudio.core.client.js.JsObject)1