Search in sources :

Example 6 with InfoPopup

use of org.uberfire.ext.widgets.common.client.common.InfoPopup in project drools-wb by kiegroup.

the class RuleModellerActionSelectorPopup method getContent.

@Override
public Widget getContent() {
    if (position == null) {
        positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Bottom(), String.valueOf(this.model.rhs.length));
        positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Top(), "0");
        for (int i = 1; i < model.rhs.length; i++) {
            positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Line0(i), String.valueOf(i));
        }
    } else {
        // if position is fixed, we just add one element to the drop down.
        positionCbo.addItem(String.valueOf(position));
        positionCbo.setSelectedIndex(0);
    }
    if (oracle.getDSLConditions().size() == 0 && oracle.getFactTypes().length == 0) {
        layoutPanel.addRow(new HTML("<div class='highlight'>" + GuidedRuleEditorResources.CONSTANTS.NoModelTip() + "</div>"));
    }
    // only show the drop down if we are not using fixed position.
    if (position == null) {
        HorizontalPanel hp0 = new HorizontalPanel();
        hp0.add(new HTML(GuidedRuleEditorResources.CONSTANTS.PositionColon()));
        hp0.add(positionCbo);
        hp0.add(new InfoPopup(GuidedRuleEditorResources.CONSTANTS.PositionColon(), GuidedRuleEditorResources.CONSTANTS.ActionPositionExplanation()));
        layoutPanel.addRow(hp0);
        layoutPanel.addRow(new HTML("<hr/>"));
    }
    choices = makeChoicesListBox();
    choicesPanel.add(choices);
    layoutPanel.addRow(choicesPanel);
    // DSL might be prohibited (e.g. editing a DRL file. Only DSLR files can contain DSL)
    if (ruleModeller.isDSLEnabled()) {
        CheckBox chkOnlyDisplayDSLConditions = new CheckBox();
        chkOnlyDisplayDSLConditions.setText(GuidedRuleEditorResources.CONSTANTS.OnlyDisplayDSLActions());
        chkOnlyDisplayDSLConditions.setValue(onlyShowDSLStatements);
        chkOnlyDisplayDSLConditions.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            public void onValueChange(ValueChangeEvent<Boolean> event) {
                onlyShowDSLStatements = event.getValue();
                choicesPanel.setWidget(makeChoicesListBox());
            }
        });
        layoutPanel.addRow(chkOnlyDisplayDSLConditions);
    }
    return layoutPanel;
}
Also used : CheckBox(org.gwtbootstrap3.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) HTML(com.google.gwt.user.client.ui.HTML) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 7 with InfoPopup

use of org.uberfire.ext.widgets.common.client.common.InfoPopup in project drools-wb by kiegroup.

the class GuidedRuleAttributeSelectorPopup method setFreezePanel.

private void setFreezePanel(final boolean lockLHS, final boolean lockRHS) {
    HorizontalPanel hz = new HorizontalPanel();
    if (!lockLHS) {
        hz.add(createFreezeButton(GuidedRuleEditorResources.CONSTANTS.Conditions(), RuleAttributeWidget.LOCK_LHS));
    }
    if (!lockRHS) {
        hz.add(createFreezeButton(GuidedRuleEditorResources.CONSTANTS.Actions(), RuleAttributeWidget.LOCK_RHS));
    }
    hz.add(new InfoPopup(GuidedRuleEditorResources.CONSTANTS.FrozenAreas(), GuidedRuleEditorResources.CONSTANTS.FrozenExplanation()));
    if (hz.getWidgetCount() > 1) {
        addAttribute(GuidedRuleEditorResources.CONSTANTS.FreezeAreasForEditing(), hz);
    }
}
Also used : HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 8 with InfoPopup

use of org.uberfire.ext.widgets.common.client.common.InfoPopup in project drools-wb by kiegroup.

the class RuleAttributeWidget method getEditorWidget.

private Widget getEditorWidget(final RuleMetadata rm, final int idx, final boolean isReadOnly) {
    IsWidget editor;
    if (rm.getAttributeName().equals(LOCK_LHS) || rm.getAttributeName().equals(LOCK_RHS)) {
        editor = new InfoPopup(GuidedRuleEditorResources.CONSTANTS.FrozenAreas(), GuidedRuleEditorResources.CONSTANTS.FrozenExplanation());
    } else {
        editor = textBoxEditor(rm, isReadOnly);
    }
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
    horiz.add(editor);
    if (!isReadOnly) {
        horiz.add(getRemoveMetaIcon(idx));
    }
    return horiz;
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) DirtyableHorizontalPane(org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 9 with InfoPopup

use of org.uberfire.ext.widgets.common.client.common.InfoPopup in project drools-wb by kiegroup.

the class RuleModellerConditionSelectorPopup method getContent.

@Override
public Widget getContent() {
    if (position == null) {
        positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Bottom(), String.valueOf(this.model.lhs.length));
        positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Top(), "0");
        for (int i = 1; i < model.lhs.length; i++) {
            positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Line0(i), String.valueOf(i));
        }
    } else {
        // if position is fixed, we just add one element to the drop down.
        positionCbo.addItem(String.valueOf(position));
        positionCbo.setSelectedIndex(0);
    }
    if (oracle.getDSLConditions().size() == 0 && oracle.getFactTypes().length == 0) {
        layoutPanel.addRow(new HTML("<div class='highlight'>" + GuidedRuleEditorResources.CONSTANTS.NoModelTip() + "</div>"));
    }
    // only show the drop down if we are not using fixed position.
    if (position == null) {
        HorizontalPanel hp0 = new HorizontalPanel();
        hp0.add(new HTML(GuidedRuleEditorResources.CONSTANTS.PositionColon()));
        hp0.add(positionCbo);
        hp0.add(new InfoPopup(GuidedRuleEditorResources.CONSTANTS.PositionColon(), GuidedRuleEditorResources.CONSTANTS.ConditionPositionExplanation()));
        layoutPanel.addRow(hp0);
        layoutPanel.addRow(new HTML("<hr/>"));
    }
    choices = makeChoicesListBox();
    choicesPanel.add(choices);
    layoutPanel.addRow(choicesPanel);
    // DSL might be prohibited (e.g. editing a DRL file. Only DSLR files can contain DSL)
    if (ruleModeller.isDSLEnabled()) {
        CheckBox chkOnlyDisplayDSLConditions = new CheckBox();
        chkOnlyDisplayDSLConditions.setText(GuidedRuleEditorResources.CONSTANTS.OnlyDisplayDSLConditions());
        chkOnlyDisplayDSLConditions.setValue(onlyShowDSLStatements);
        chkOnlyDisplayDSLConditions.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            public void onValueChange(ValueChangeEvent<Boolean> event) {
                onlyShowDSLStatements = event.getValue();
                choicesPanel.setWidget(makeChoicesListBox());
            }
        });
        layoutPanel.addRow(chkOnlyDisplayDSLConditions);
    }
    return layoutPanel;
}
Also used : CheckBox(org.gwtbootstrap3.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) HTML(com.google.gwt.user.client.ui.HTML) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 10 with InfoPopup

use of org.uberfire.ext.widgets.common.client.common.InfoPopup 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)

Aggregations

InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)13 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)9 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)9 Button (org.gwtbootstrap3.client.ui.Button)9 HTML (com.google.gwt.user.client.ui.HTML)5 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)5 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)5 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)5 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 CompositeFieldConstraint (org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint)2 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)2 CheckBox (org.gwtbootstrap3.client.ui.CheckBox)2 ListBox (org.gwtbootstrap3.client.ui.ListBox)2 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 FactData (org.drools.workbench.models.testscenarios.shared.FactData)1 DirtyableHorizontalPane (org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane)1