Search in sources :

Example 31 with ChangeHandler

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

the class FromAccumulateCompositeFactPatternWidget method showSourcePatternSelector.

/**
 * Pops up the fact selector.
 */
protected void showSourcePatternSelector() {
    final ListBox box = new ListBox();
    AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
    String[] facts = oracle.getFactTypes();
    box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose());
    for (int i = 0; i < facts.length; i++) {
        box.addItem(facts[i]);
    }
    box.setSelectedIndex(0);
    final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern());
    popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box);
    box.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            getFromAccumulatePattern().setSourcePattern(new FactPattern(box.getItemText(box.getSelectedIndex())));
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
        }
    });
    final Button fromBtn = new Button(HumanReadableConstants.INSTANCE.From());
    final Button fromAccumulateBtn = new Button(HumanReadableConstants.INSTANCE.FromAccumulate());
    final Button fromCollectBtn = new Button(HumanReadableConstants.INSTANCE.FromCollect());
    final Button fromEntryPointBtn = new Button(HumanReadableConstants.INSTANCE.FromEntryPoint());
    ClickHandler btnsClickHandler = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            if (sender == fromBtn) {
                getFromAccumulatePattern().setSourcePattern(new FromCompositeFactPattern());
            } else if (sender == fromAccumulateBtn) {
                getFromAccumulatePattern().setSourcePattern(new FromAccumulateCompositeFactPattern());
            } else if (sender == fromCollectBtn) {
                getFromAccumulatePattern().setSourcePattern(new FromCollectCompositeFactPattern());
            } else if (sender == fromEntryPointBtn) {
                getFromAccumulatePattern().setSourcePattern(new FromEntryPointFactPattern());
            } else {
                throw new IllegalArgumentException("Unknown sender: " + sender);
            }
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
        }
    };
    fromBtn.addClickHandler(btnsClickHandler);
    fromAccumulateBtn.addClickHandler(btnsClickHandler);
    fromCollectBtn.addClickHandler(btnsClickHandler);
    fromEntryPointBtn.addClickHandler(btnsClickHandler);
    popup.addAttribute("", fromBtn);
    popup.addAttribute("", fromAccumulateBtn);
    popup.addAttribute("", fromCollectBtn);
    popup.addAttribute("", fromEntryPointBtn);
    popup.show();
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FromEntryPointFactPattern(org.drools.workbench.models.datamodel.rule.FromEntryPointFactPattern) Widget(com.google.gwt.user.client.ui.Widget) FromEntryPointFactPattern(org.drools.workbench.models.datamodel.rule.FromEntryPointFactPattern) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) FromAccumulateCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern) FromCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern) FromCollectCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromCollectCompositeFactPattern) FromCollectCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromCollectCompositeFactPattern) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) FromCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Button(org.gwtbootstrap3.client.ui.Button) FromAccumulateCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Example 32 with ChangeHandler

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

the class FromAccumulateCompositeFactPatternWidget method showFactTypeSelector.

/**
 * Pops up the fact selector.
 */
@Override
protected void showFactTypeSelector() {
    final ListBox box = GWT.create(ListBox.class);
    AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
    String[] facts = oracle.getFactTypes();
    box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose());
    for (int i = 0; i < facts.length; i++) {
        box.addItem(facts[i]);
    }
    box.setSelectedIndex(0);
    final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern());
    popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box);
    box.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex())));
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
        }
    });
    popup.show();
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup) FromEntryPointFactPattern(org.drools.workbench.models.datamodel.rule.FromEntryPointFactPattern) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) FromAccumulateCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern) FromCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern) FromCollectCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromCollectCompositeFactPattern) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Example 33 with ChangeHandler

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

the class ContainerRulesConfigView method init.

@PostConstruct
public void init() {
    version.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (!version.getText().trim().isEmpty()) {
                StyleHelper.addUniqueEnumStyleName(versionForm, ValidationState.class, ValidationState.NONE);
            }
        }
    });
    version.getElement().setAttribute("placeholder", getVersionTextBoxPlaceholder());
    interval.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (!interval.getText().trim().isEmpty()) {
                StyleHelper.addUniqueEnumStyleName(scannerForm, ValidationState.class, ValidationState.NONE);
            }
        }
    });
    interval.getElement().setAttribute("placeholder", getIntervalTextBoxPlaceholder());
    interval.getElement().setAttribute("data-original-title", getIntervalTextBoxDataOriginalTitle());
    Option ms = new Option();
    ms.setText(translationService.format(Constants.ContainerRulesConfigView_Milliseconds));
    ms.setValue(ContainerRulesConfigPresenter.MS);
    ms.setSelected(true);
    intervalTimeUnit.add(ms);
    Option s = new Option();
    s.setText(translationService.format(Constants.ContainerRulesConfigView_Seconds));
    s.setValue(ContainerRulesConfigPresenter.S);
    intervalTimeUnit.add(s);
    Option m = new Option();
    m.setText(translationService.format(Constants.ContainerRulesConfigView_Minutes));
    m.setValue(ContainerRulesConfigPresenter.M);
    intervalTimeUnit.add(m);
    Option h = new Option();
    h.setText(translationService.format(Constants.ContainerRulesConfigView_Hours));
    h.setValue(ContainerRulesConfigPresenter.H);
    intervalTimeUnit.add(h);
    Option d = new Option();
    d.setText(translationService.format(Constants.ContainerRulesConfigView_Days));
    d.setValue(ContainerRulesConfigPresenter.D);
    intervalTimeUnit.add(d);
}
Also used : ValidationState(org.gwtbootstrap3.client.ui.constants.ValidationState) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Option(org.gwtbootstrap3.extras.select.client.ui.Option) PostConstruct(javax.annotation.PostConstruct)

Example 34 with ChangeHandler

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

the class CopyPopupView method init.

@Override
public void init(final CopyPopupPresenter presenter) {
    this.presenter = presenter;
    templateName.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (!templateName.getText().trim().isEmpty()) {
                StyleHelper.addUniqueEnumStyleName(templateNameGroup, ValidationState.class, ValidationState.NONE);
                templateNameHelp.setVisible(false);
            }
        }
    });
    this.modal.setTitle(getCopyServerTemplatePopupTitle());
    this.modal.setBody(this);
    this.templateNameLabel.setText(getTemplateNameLabelText());
    this.modal.add(new ModalFooterOKCancelButtons(new Command() {

        @Override
        public void execute() {
            presenter.save();
        }
    }, new Command() {

        @Override
        public void execute() {
            hide();
        }
    }));
}
Also used : ValidationState(org.gwtbootstrap3.client.ui.constants.ValidationState) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Command(com.google.gwt.user.client.Command) ModalFooterOKCancelButtons(org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons)

Example 35 with ChangeHandler

use of com.google.gwt.event.dom.client.ChangeHandler in project data-access by pentaho.

the class AnalysisImportDialogController method createWorkingForm.

private void createWorkingForm() {
    if (formPanel == null) {
        formPanel = new FormPanel();
        formPanel.setMethod(FormPanel.METHOD_POST);
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setAction(MONDRIAN_POSTANALYSIS_URL);
        formPanel.getElement().getStyle().setProperty("position", "absolute");
        formPanel.getElement().getStyle().setProperty("visibility", "hidden");
        formPanel.getElement().getStyle().setProperty("overflow", "hidden");
        formPanel.getElement().getStyle().setProperty("clip", "rect(0px,0px,0px,0px)");
        mainFormPanel = new FlowPanel();
        formPanel.add(mainFormPanel);
        analysisFileUpload = new FileUpload();
        analysisFileUpload.setName("uploadAnalysis");
        analysisFileUpload.getElement().setId("analysisFileUpload");
        analysisFileUpload.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                schemaNameLabel.setValue(((FileUpload) event.getSource()).getFilename());
                importDialogModel.setUploadedFile(((FileUpload) event.getSource()).getFilename());
                acceptButton.setDisabled(!isValid());
            }
        });
        mainFormPanel.add(analysisFileUpload);
        VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
        vp.add(formPanel);
    // addSubmitHandler(); moved to GwtDataSourceEditorEntryPoint
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) FormPanel(com.google.gwt.user.client.ui.FormPanel) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) FileUpload(com.google.gwt.user.client.ui.FileUpload)

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