Search in sources :

Example 56 with Button

use of org.gwtbootstrap3.client.ui.Button in project drools-wb by kiegroup.

the class CompositeFactPatternWidget method showFactTypeSelector.

/**
 * Pops up the fact selector.
 */
protected void showFactTypeSelector(final Widget w) {
    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) {
            pattern.addFactPattern(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());
    ClickHandler btnsClickHandler = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            if (sender == fromBtn) {
                pattern.addFactPattern(new FromCompositeFactPattern());
            } else if (sender == fromAccumulateBtn) {
                pattern.addFactPattern(new FromAccumulateCompositeFactPattern());
            } else if (sender == fromCollectBtn) {
                pattern.addFactPattern(new FromCollectCompositeFactPattern());
            } else {
                throw new IllegalArgumentException("Unknown sender: " + sender);
            }
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
        }
    };
    fromBtn.addClickHandler(btnsClickHandler);
    fromAccumulateBtn.addClickHandler(btnsClickHandler);
    fromCollectBtn.addClickHandler(btnsClickHandler);
    popup.addAttribute("", fromBtn);
    popup.addAttribute("", fromAccumulateBtn);
    popup.addAttribute("", fromCollectBtn);
    popup.show();
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Widget(com.google.gwt.user.client.ui.Widget) IFactPattern(org.drools.workbench.models.datamodel.rule.IFactPattern) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) FromAccumulateCompositeFactPattern(org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern) CompositeFactPattern(org.drools.workbench.models.datamodel.rule.CompositeFactPattern) 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 57 with Button

use of org.gwtbootstrap3.client.ui.Button in project drools-wb by kiegroup.

the class PopupCreatorTest method testMakeExpressionEditorButton.

@Test
public void testMakeExpressionEditorButton() {
    final HasConstraints hasConstraints = mock(HasConstraints.class);
    final FormStylePopup popup = mock(FormStylePopup.class);
    final Button button = mock(Button.class);
    final ClickHandler clickHandler = mock(ClickHandler.class);
    doReturn(button).when(popupCreator).makeExpressionEditorButton();
    doReturn(clickHandler).when(popupCreator).onExpressionEditorButtonClick(hasConstraints, popup);
    popupCreator.makeExpressionEditorButton(hasConstraints, popup);
    verify(button).addClickHandler(clickHandler);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) HasConstraints(org.drools.workbench.models.datamodel.rule.HasConstraints) Button(org.gwtbootstrap3.client.ui.Button) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup) Test(org.junit.Test)

Example 58 with Button

use of org.gwtbootstrap3.client.ui.Button in project drools-wb by kiegroup.

the class GuidedRuleTemplateDataViewImpl method setContent.

@Override
public void setContent(final TemplateModel model, final AsyncPackageDataModelOracle oracle, final EventBus eventBus, final boolean isReadOnly) {
    widgetContainer.clear();
    // Initialise table to edit data. The widget needs to be added after the containing panel has
    // been added to the DOM and rendered by the browser as the Merged Grid widget needs the
    // parent panel sizes.
    Scheduler.get().scheduleDeferred(new Command() {

        @Override
        public void execute() {
            final TemplateDataTableWidget dataTable = new TemplateDataTableWidget(model, oracle, isReadOnly, eventBus);
            final Button btnAddRow = new Button(GuidedRuleEditorResources.CONSTANTS.AddRow(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    dataTable.appendRow();
                }
            });
            widgetContainer.add(btnAddRow);
            widgetContainer.add(dataTable);
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Command(com.google.gwt.user.client.Command) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 59 with Button

use of org.gwtbootstrap3.client.ui.Button in project drools-wb by kiegroup.

the class TypeChoiceFormPopup method addCreateNewObject.

private void addCreateNewObject() {
    Button button = new Button(TestScenarioConstants.INSTANCE.CreateNewFact());
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent w) {
            fireSelection(FieldData.TYPE_FACT);
        }
    });
    addAttribute(TestScenarioConstants.INSTANCE.Fact(), widgets(button, new InfoPopup(TestScenarioConstants.INSTANCE.CreateNewFact(), TestScenarioConstants.INSTANCE.CreateNewFactTip())));
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 60 with Button

use of org.gwtbootstrap3.client.ui.Button in project drools-wb by kiegroup.

the class TypeChoiceFormPopup method addListSelection.

private void addListSelection() {
    Button variable = new Button(TestScenarioConstants.INSTANCE.GuidedList());
    variable.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent w) {
            fireSelection(FieldData.TYPE_COLLECTION);
        }
    });
    addAttribute(TestScenarioConstants.INSTANCE.AVariable(), widgets(variable, new InfoPopup(TestScenarioConstants.INSTANCE.AGuidedList(), TestScenarioConstants.INSTANCE.AGuidedListTip())));
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Aggregations

Button (org.gwtbootstrap3.client.ui.Button)71 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)33 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)33 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)14 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)12 HTML (com.google.gwt.user.client.ui.HTML)10 ListBox (org.gwtbootstrap3.client.ui.ListBox)10 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)9 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)9 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)9 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 TextBox (org.gwtbootstrap3.client.ui.TextBox)6 MenuItem (org.uberfire.workbench.model.menu.MenuItem)6 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 Widget (com.google.gwt.user.client.ui.Widget)5 AnchorListItem (org.gwtbootstrap3.client.ui.AnchorListItem)5 ButtonGroup (org.gwtbootstrap3.client.ui.ButtonGroup)5 FlexTable (com.google.gwt.user.client.ui.FlexTable)4 ApplicationScoped (javax.enterprise.context.ApplicationScoped)4 Inject (javax.inject.Inject)4