Search in sources :

Example 11 with ValueChangeEvent

use of com.google.gwt.event.logical.shared.ValueChangeEvent in project drools-wb by kiegroup.

the class FactPatternWidget method createCEPWindowWidget.

// Widget for CEP 'windows'
private Widget createCEPWindowWidget(final RuleModeller modeller, final HasCEPWindow c) {
    final HorizontalPanel hp = new HorizontalPanel();
    modeller.getDataModelOracle().isFactTypeAnEvent(pattern.getFactType(), new Callback<Boolean>() {

        @Override
        public void callback(final Boolean result) {
            if (Boolean.TRUE.equals(result)) {
                final Label lbl = new Label(HumanReadableConstants.INSTANCE.OverCEPWindow());
                lbl.setStyleName("paddedLabel");
                hp.add(lbl);
                final CEPWindowOperatorsDropdown cwo = new CEPWindowOperatorsDropdown(c, readOnly);
                if (!isReadOnly()) {
                    cwo.addValueChangeHandler(new ValueChangeHandler<OperatorSelection>() {

                        public void onValueChange(ValueChangeEvent<OperatorSelection> event) {
                            setModified(true);
                            OperatorSelection selection = event.getValue();
                            String selected = selection.getValue();
                            c.getWindow().setOperator(selected);
                        }
                    });
                }
                hp.add(cwo);
            }
        }
    });
    return hp;
}
Also used : CEPWindowOperatorsDropdown(org.drools.workbench.screens.guided.rule.client.editor.CEPWindowOperatorsDropdown) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) OperatorSelection(org.drools.workbench.screens.guided.rule.client.editor.OperatorSelection) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)

Example 12 with ValueChangeEvent

use of com.google.gwt.event.logical.shared.ValueChangeEvent in project rstudio by rstudio.

the class EditSnippetsDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    panel_ = new DockLayoutPanel(Unit.PX);
    // compute the widget size and set it
    Size size = new Size(900, 900);
    size = DomMetrics.adjustedElementSize(size, null, // pad
    70, // client margin
    100);
    panel_.setWidth(size.width + "px");
    panel_.setHeight(size.height + "px");
    // snippet types
    snippetTypes_ = new WidgetListBox<EditableSnippets>();
    snippetTypes_.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            updateEditor(snippetTypes_.getSelectedItem());
        }
    });
    snippetTypes_.addItem(new EditableSnippets("R", FileTypeRegistry.R));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.CPP));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.MARKDOWN));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.TEX));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.JS));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.HTML));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.CSS));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.SQL));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.JAVA));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.PYTHON));
    snippetTypes_.addItem(new EditableSnippets(FileTypeRegistry.STAN));
    panel_.addWest(snippetTypes_, 150);
    // editor
    docDisplay_ = new AceEditor();
    docDisplay_.setUseSoftTabs(false);
    docDisplay_.setTabSize(uiPrefs_.numSpacesForTab().getValue());
    docDisplay_.addValueChangeHandler(new ValueChangeHandler<Void>() {

        @Override
        public void onValueChange(ValueChangeEvent<Void> event) {
            editorDirty_ = true;
        }
    });
    docDisplay_.setFileType(FileTypeRegistry.SNIPPETS);
    SimplePanel panel = new SimplePanel();
    panel.addStyleName("EditDialog");
    panel.getElement().getStyle().setMarginLeft(8, Unit.PX);
    panel.setWidget(docDisplay_.asWidget());
    panel_.add(panel);
    TextEditingTarget.syncFontSize(releaseOnDismiss_, events_, this, fontSizeManager_);
    snippetTypes_.setSelectedIndex(0, true);
    return panel_;
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Size(org.rstudio.core.client.Size) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) AceEditor(org.rstudio.studio.client.workbench.views.source.editors.text.AceEditor) Void(org.rstudio.studio.client.server.Void)

Example 13 with ValueChangeEvent

use of com.google.gwt.event.logical.shared.ValueChangeEvent in project rstudio by rstudio.

the class DataImportOptionsUiCsv method initEvents.

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

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

        @Override
        public void onChange(ChangeEvent arg0) {
            updateEnabled();
            triggerChange();
        }
    };
    ChangeHandler delimChangeHandler = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent arg0) {
            if (delimiterListBox_.getSelectedValue() == "other") {
                globalDisplay_.promptForTextWithOption("Other Delimiter", "Please enter a single character delimiter.", "", false, "", false, new ProgressOperationWithInput<PromptWithOptionResult>() {

                    private void dismissAndUpdate(ProgressIndicator indicator, int newSelectIndex) {
                        lastDelimiterListBoxIndex_ = newSelectIndex;
                        delimiterListBox_.setSelectedIndex(newSelectIndex);
                        indicator.onCompleted();
                        updateEnabled();
                        triggerChange();
                    }

                    @Override
                    public void execute(PromptWithOptionResult result, ProgressIndicator indicator) {
                        String otherDelimiter = result.input;
                        if (otherDelimiter.length() != 1) {
                            globalDisplay_.showErrorMessage("Incorrect Delimiter", "The specified delimiter is not valid.");
                        } else {
                            for (int idxDelimiter = 0; idxDelimiter < delimiterListBox_.getItemCount(); idxDelimiter++) {
                                if (delimiterListBox_.getValue(idxDelimiter) == otherDelimiter) {
                                    dismissAndUpdate(indicator, idxDelimiter);
                                    return;
                                }
                            }
                            int selectedIndex = delimiterListBox_.getSelectedIndex();
                            delimiterListBox_.insertItem("Character " + otherDelimiter, otherDelimiter, selectedIndex - 1);
                            dismissAndUpdate(indicator, selectedIndex - 1);
                        }
                    }
                }, new Operation() {

                    @Override
                    public void execute() {
                        delimiterListBox_.setSelectedIndex(lastDelimiterListBoxIndex_);
                        updateEnabled();
                        triggerChange();
                    }
                });
            } else {
                lastDelimiterListBoxIndex_ = delimiterListBox_.getSelectedIndex();
                updateEnabled();
                triggerChange();
            }
        }
    };
    ValueChangeHandler<Boolean> booleanValueChangeHandler = new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> arg0) {
            updateEnabled();
            triggerChange();
        }
    };
    nameTextBox_.addValueChangeHandler(valueChangeHandler);
    delimiterListBox_.addChangeHandler(delimChangeHandler);
    quotesListBox_.addChangeHandler(changeHandler);
    escapeListBox_.addChangeHandler(changeHandler);
    columnNamesCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
    trimSpacesCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
    openDataViewerCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
    naListBox_.addChangeHandler(changeHandler);
    commentListBox_.addChangeHandler(changeHandler);
    skipTextBox_.addValueChangeHandler(valueChangeHandler);
    localeButton_.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            new DataImportOptionsUiCsvLocale(new OperationWithInput<DataImportOptionsCsvLocale>() {

                @Override
                public void execute(final DataImportOptionsCsvLocale result) {
                    localeInfo_ = result;
                    updateEnabled();
                    triggerChange();
                }
            }, localeInfo_).showModal();
        }
    });
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) Operation(org.rstudio.core.client.widget.Operation) PromptWithOptionResult(org.rstudio.core.client.MessageDisplay.PromptWithOptionResult) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) 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) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator)

Example 14 with ValueChangeEvent

use of com.google.gwt.event.logical.shared.ValueChangeEvent in project rstudio by rstudio.

the class DataImportOptionsUiSav method initEvents.

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

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

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

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> arg0) {
            updateEnabled();
            triggerChange();
        }
    };
    nameTextBox_.addValueChangeHandler(valueChangeHandler);
    formatListBox_.addChangeHandler(changeHandler);
    openDataViewerCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
}
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 15 with ValueChangeEvent

use of com.google.gwt.event.logical.shared.ValueChangeEvent in project rstudio by rstudio.

the class ImportFileSettingsDialog method hookChangeEvents.

private void hookChangeEvents() {
    ValueChangeHandler<Boolean> valueChangeHandler = new ValueChangeHandler<Boolean>() {

        public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
            updateOutput();
        }
    };
    headingYes_.addValueChangeHandler(valueChangeHandler);
    headingNo_.addValueChangeHandler(valueChangeHandler);
    ChangeHandler changeHandler = new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            updateOutput();
        }
    };
    separator_.addChangeHandler(changeHandler);
    decimal_.addChangeHandler(changeHandler);
    quote_.addChangeHandler(changeHandler);
    encoding_.addChangeHandler(changeHandler);
    comment_.addChangeHandler(changeHandler);
}
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)

Aggregations

ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)20 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)18 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)10 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)10 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 TextBox (org.gwtbootstrap3.client.ui.TextBox)5 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)4 Widget (com.google.gwt.user.client.ui.Widget)3 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)3 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)3 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 ListBox (org.gwtbootstrap3.client.ui.ListBox)3 DatePicker (org.uberfire.ext.widgets.common.client.common.DatePicker)3 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Image (com.google.gwt.user.client.ui.Image)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)2 Label (com.google.gwt.user.client.ui.Label)2