Search in sources :

Example 1 with Manipulator

use of org.rstudio.studio.client.workbench.views.plots.model.Manipulator in project rstudio by rstudio.

the class ManipulatorPopupPanel method update.

public void update(Manipulator manipulator) {
    mainPanel_.clear();
    if (manipulator != null && manipulator.getVariables() != null) {
        // iterate over the variables
        JsArrayString variables = manipulator.getVariables();
        for (int i = 0; i < variables.length(); i++) {
            String variable = variables.get(i);
            try {
                ManipulatorControl addedControl = null;
                Manipulator.Control control = manipulator.getControl(variable);
                switch(control.getType()) {
                    case Manipulator.Control.SLIDER:
                        Manipulator.Slider slider = control.cast();
                        addedControl = addSliderControl(variable, manipulator.getDoubleValue(variable), slider);
                        break;
                    case Manipulator.Control.PICKER:
                        Manipulator.Picker picker = control.cast();
                        addedControl = addPickerControl(variable, manipulator.getStringValue(variable), picker);
                        break;
                    case Manipulator.Control.CHECKBOX:
                        Manipulator.CheckBox checkBox = control.cast();
                        addedControl = addCheckBoxControl(variable, manipulator.getBooleanValue(variable), checkBox);
                        break;
                    case Manipulator.Control.BUTTON:
                        Manipulator.Button button = control.cast();
                        addedControl = addButtonControl(variable, button);
                        break;
                }
                // save reference to first control (for setting focus)
                if (i == 0)
                    firstControl_ = addedControl;
            } catch (Throwable e) {
                Debug.log("WARNING: exception occurred during addition of " + "variable " + variable + ", " + e.getMessage());
            }
        }
    }
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) Manipulator(org.rstudio.studio.client.workbench.views.plots.model.Manipulator)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)1 Manipulator (org.rstudio.studio.client.workbench.views.plots.model.Manipulator)1