Search in sources :

Example 6 with ChangeHandler

use of com.google.gwt.event.dom.client.ChangeHandler in project rstudio by rstudio.

the class InstallPackageDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    // vertical panel
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setSpacing(2);
    mainPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
    // source type
    reposCaption_ = new CaptionWithHelp("Install from:", "Configuring Repositories", "configuring_repositories");
    reposCaption_.setIncludeVersionInfo(false);
    reposCaption_.setWidth("100%");
    mainPanel.add(reposCaption_);
    packageSourceListBox_ = new ListBox();
    packageSourceListBox_.setStylePrimaryName(RESOURCES.styles().packageSourceListBox());
    packageSourceListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    JsArrayString repos = installContext_.selectedRepositoryNames();
    if (repos.length() == 1) {
        packageSourceListBox_.addItem("Repository (" + repos.get(0) + ")");
    } else {
        StringBuilder reposItem = new StringBuilder();
        reposItem.append("Repository (");
        for (int i = 0; i < repos.length(); i++) {
            if (i != 0)
                reposItem.append(", ");
            reposItem.append(repos.get(i));
        }
        reposItem.append(")");
        packageSourceListBox_.addItem(reposItem.toString());
    }
    packageSourceListBox_.addItem("Package Archive File (" + installContext_.packageArchiveExtension() + ")");
    mainPanel.add(packageSourceListBox_);
    // source panel container
    sourcePanel_ = new SimplePanel();
    sourcePanel_.setStylePrimaryName(RESOURCES.styles().packageSourcePanel());
    // repos source panel
    reposSourcePanel_ = new FlowPanel();
    Label packagesLabel = new Label("Packages (separate multiple with space or comma):");
    packagesLabel.setStylePrimaryName(RESOURCES.styles().packagesLabel());
    reposSourcePanel_.add(packagesLabel);
    packagesTextBox_ = new MultipleItemSuggestTextBox();
    packagesSuggestBox_ = new SuggestBox(new PackageOracle(), packagesTextBox_);
    packagesSuggestBox_.setWidth("100%");
    packagesSuggestBox_.setLimit(20);
    packagesSuggestBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    reposSourcePanel_.add(packagesSuggestBox_);
    sourcePanel_.setWidget(reposSourcePanel_);
    mainPanel.add(sourcePanel_);
    // archive source panel
    packageArchiveFile_ = new TextBoxWithButton("Package archive:", "Browse...", browseForArchiveClickHandler_);
    // create check box here because manageUIState accesses it
    installDependenciesCheckBox_ = new CheckBox();
    if (defaultInstallOptions_.getInstallFromRepository())
        packageSourceListBox_.setSelectedIndex(0);
    else
        packageSourceListBox_.setSelectedIndex(1);
    manageUIState();
    packageSourceListBox_.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            manageUIState();
            if (!installFromRepository())
                packageArchiveFile_.click();
        }
    });
    mainPanel.add(new Label("Install to Library:"));
    // library list box
    libraryListBox_ = new ListBox();
    libraryListBox_.setWidth("100%");
    libraryListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    JsArrayString libPaths = installContext_.getWriteableLibraryPaths();
    int selectedIndex = 0;
    for (int i = 0; i < libPaths.length(); i++) {
        String libPath = libPaths.get(i);
        if (!installContext_.isDevModeOn()) {
            if (defaultInstallOptions_.getLibraryPath().equals(libPath))
                selectedIndex = i;
        }
        if (libPath.equals(installContext_.getDefaultLibraryPath()))
            libPath = libPath + " [Default]";
        libraryListBox_.addItem(libPath);
    }
    libraryListBox_.setSelectedIndex(selectedIndex);
    mainPanel.add(libraryListBox_);
    // install dependencies check box
    installDependenciesCheckBox_.addStyleName(RESOURCES.styles().installDependenciesCheckBox());
    installDependenciesCheckBox_.setText("Install dependencies");
    installDependenciesCheckBox_.setValue(defaultInstallOptions_.getInstallDependencies());
    mainPanel.add(installDependenciesCheckBox_);
    mainPanel.add(new HTML("<br/>"));
    return mainPanel;
}
Also used : MultipleItemSuggestTextBox(org.rstudio.core.client.widget.MultipleItemSuggestTextBox) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) SuggestBox(com.google.gwt.user.client.ui.SuggestBox) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) TextBoxWithButton(org.rstudio.core.client.widget.TextBoxWithButton) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) CheckBox(com.google.gwt.user.client.ui.CheckBox) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) CaptionWithHelp(org.rstudio.core.client.widget.CaptionWithHelp) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 7 with ChangeHandler

use of com.google.gwt.event.dom.client.ChangeHandler in project gwt-test-utils by gwt-test-utils.

the class MyBeautifulApp method onModuleLoad.

public void onModuleLoad() {
    FlowPanel panel = new FlowPanel();
    b1 = new Button("Button1's HTML");
    b1.getElement().setId("button-1");
    panel.add(b1);
    b2 = new Button("Button2's HTML");
    b2.getElement().setId("button-2");
    panel.add(b2);
    l = new Label();
    l.setText("init");
    panel.add(l);
    t = new TextBox();
    panel.add(t);
    historyLabel = new Label();
    panel.add(historyLabel);
    invisibleTB = new TextBox();
    invisibleTB.setVisible(false);
    panel.add(invisibleTB);
    lb = new ListBox();
    lb.addItem("lbText0");
    lb.addItem("lbText1");
    lb.addItem("lbText2");
    panel.add(lb);
    RootPanel.get().add(panel);
    b1.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            l.setText("click on b1");
        }
    });
    b2.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            l.setText("click on b2");
        }
    });
    b3 = new Button("Button3's HTML");
    panel.add(b3);
    b3.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            MyRemoteServiceAsync remoteServiceAsync = GWT.create(MyRemoteService.class);
            remoteServiceAsync.myMethod(l.getText(), new AsyncCallback<String>() {

                public void onFailure(Throwable arg0) {
                    l.setText("error");
                }

                public void onSuccess(String arg0) {
                    l.setText(arg0);
                }
            });
        }
    });
    b4 = new Button("Button4's HTML");
    panel.add(b4);
    b4.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            MyRemoteServiceAsync remoteServiceAsync = GWT.create(MyRemoteService.class);
            remoteServiceAsync.myMethod2(new MyCustomObject("toto"), new AsyncCallback<MyCustomObject>() {

                public void onFailure(Throwable t) {
                    throw new RuntimeException(t);
                }

                public void onSuccess(MyCustomObject object) {
                    l.setText(object.myField + " " + object.myTransientField);
                }
            });
        }
    });
    b5 = new Button("Button5's HTML");
    panel.add(b5);
    b5.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            MyRemoteServiceAsync remoteServiceAsync = GWT.create(MyRemoteService.class);
            remoteServiceAsync.myMethod3(new AsyncCallback<Void>() {

                public void onFailure(Throwable arg0) {
                    l.setText("error");
                }

                public void onSuccess(Void arg0) {
                    l.setText("success");
                }
            });
        }
    });
    t.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            historyLabel.setText("t was filled with value \"" + t.getText() + "\"");
        }
    });
    invisibleTB.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            historyLabel.setText("invisibleTB was filled with value \"" + invisibleTB.getText() + "\"");
        }
    });
    myComposite = new MyComposite("myComposite Label", "MyComposite Button");
    panel.add(myComposite);
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler)

Example 8 with ChangeHandler

use of com.google.gwt.event.dom.client.ChangeHandler in project rstudio by rstudio.

the class DataImportOptionsUiCsvLocale method initializeEvents.

private void initializeEvents() {
    ChangeHandler encodingChangeHandler = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent arg0) {
            if (encoding_.getSelectedItemText() == otherLabel) {
                globalDisplay_.promptForText("Encoding Identifier", "Please enter an encoding identifier. For a list of valid encodings run iconvlist().", encoding_.getSelectedValue(), new OperationWithInput<String>() {

                    @Override
                    public void execute(final String otherEncoding) {
                        for (int idxEncoding = 0; idxEncoding < encoding_.getItemCount(); idxEncoding++) {
                            if (encoding_.getValue(idxEncoding) == otherEncoding) {
                                encoding_.setSelectedIndex(idxEncoding);
                                return;
                            }
                        }
                        int selectedIndex = encoding_.getSelectedIndex();
                        addOtherEncodingItem(selectedIndex - 1, otherEncoding);
                    }
                });
            }
        }
    };
    encoding_.addChangeHandler(encodingChangeHandler);
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler)

Example 9 with ChangeHandler

use of com.google.gwt.event.dom.client.ChangeHandler in project rstudio by rstudio.

the class DataImportOptionsUiXls method initEvents.

void initEvents() {
    ValueChangeHandler<String> valueChangeHandler = new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> arg0) {
            triggerChange();
        }
    };
    ChangeHandler changeHandler = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent arg0) {
            triggerChange();
        }
    };
    ValueChangeHandler<Boolean> booleanValueChangeHandler = new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> arg0) {
            triggerChange();
        }
    };
    nameTextBox_.addValueChangeHandler(valueChangeHandler);
    sheetListBox_.addChangeHandler(changeHandler);
    columnNamesCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
    openDataViewerCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
    naListBox_.addChangeHandler(changeHandler);
    skipTextBox_.addValueChangeHandler(valueChangeHandler);
}
Also used : ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)

Example 10 with ChangeHandler

use of com.google.gwt.event.dom.client.ChangeHandler in project drools-wb by kiegroup.

the class VerifyFieldConstraintEditor method variableEditor.

private Widget variableEditor() {
    List<String> vars = this.scenario.getFactNamesInScope(this.executionTrace, true);
    final ListBox box = new ListBox();
    if (this.field.getExpected() == null) {
        box.addItem(CommonConstants.INSTANCE.Choose());
    }
    int j = 0;
    for (int i = 0; i < vars.size(); i++) {
        String var = vars.get(i);
        FactData f = scenario.getFactTypes().get(var);
        String fieldType = oracle.getFieldType(this.factType, field.getFieldName());
        if (f.getType().equals(fieldType)) {
            if (box.getItemCount() == 0) {
                box.addItem("...");
                j++;
            }
            box.addItem("=" + var);
            if (this.field.getExpected() != null && this.field.getExpected().equals("=" + var)) {
                box.setSelectedIndex(j);
            }
            j++;
        }
    }
    box.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            field.setExpected(box.getItemText(box.getSelectedIndex()));
        }
    });
    return box;
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FactData(org.drools.workbench.models.testscenarios.shared.FactData) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Aggregations

ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)123 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)123 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)48 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)48 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)34 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)31 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)31 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)31 ListBox (org.gwtbootstrap3.client.ui.ListBox)31 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)29 ArrayList (java.util.ArrayList)26 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)21 PerunError (cz.metacentrum.perun.webgui.model.PerunError)17 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)16 HTML (com.google.gwt.user.client.ui.HTML)14 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)14 HashMap (java.util.HashMap)13 ListBox (com.google.gwt.user.client.ui.ListBox)12 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)12 Map (java.util.Map)11