Search in sources :

Example 86 with HTML

use of com.google.gwt.user.client.ui.HTML in project drools-wb by kiegroup.

the class GuidedScoreCardEditor method getCharacteristics.

private Widget getCharacteristics() {
    characteristicsPanel = new VerticalPanel();
    characteristicsTables = new ArrayList<FlexTable>();
    final HorizontalPanel toolbar = new HorizontalPanel();
    btnAddCharacteristic = new Button(GuidedScoreCardConstants.INSTANCE.addCharacteristic(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            addCharacteristic(null);
        }
    });
    toolbar.add(btnAddCharacteristic);
    toolbar.setHeight("24");
    characteristicsPanel.add(toolbar);
    final SimplePanel gapPanel = new SimplePanel();
    gapPanel.add(new HTML("<br/>"));
    characteristicsPanel.add(gapPanel);
    return characteristicsPanel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML)

Example 87 with HTML

use of com.google.gwt.user.client.ui.HTML in project drools-wb by kiegroup.

the class VerifyRulesFiredWidget method render.

private FlexTable render(final FixtureList rfl, final Scenario sc) {
    FlexTable data = new FlexTable();
    for (int i = 0; i < rfl.size(); i++) {
        final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);
        if (showResults && v.getSuccessResult() != null) {
            if (!v.getSuccessResult().booleanValue()) {
                data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
                data.setWidget(i, 4, new HTML(TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString())));
                data.getCellFormatter().addStyleName(i, 4, // NON-NLS
                "testErrorValue");
            } else {
                data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
            }
        }
        data.setWidget(i, 1, new SmallLabel(v.getRuleName() + ":"));
        data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);
        final ListBox b = new ListBox();
        b.addItem(TestScenarioConstants.INSTANCE.firedAtLeastOnce(), "y");
        b.addItem(TestScenarioConstants.INSTANCE.didNotFire(), "n");
        b.addItem(TestScenarioConstants.INSTANCE.firedThisManyTimes(), "e");
        final TextBox num = new TextBox();
        ((InputElement) num.getElement().cast()).setSize(5);
        if (v.getExpectedFire() != null) {
            b.setSelectedIndex((v.getExpectedFire().booleanValue()) ? 0 : 1);
            num.setVisible(false);
        } else {
            b.setSelectedIndex(2);
            String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
            num.setText(xc);
        }
        b.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                String s = b.getValue(b.getSelectedIndex());
                if (s.equals("y") || s.equals("n")) {
                    num.setVisible(false);
                    v.setExpectedFire((s.equals("y")) ? Boolean.TRUE : Boolean.FALSE);
                    v.setExpectedCount(null);
                } else {
                    num.setVisible(true);
                    v.setExpectedFire(null);
                    num.setText("1");
                    v.setExpectedCount(Integer.valueOf(1));
                }
            }
        });
        b.addItem(TestScenarioConstants.INSTANCE.ChooseDotDotDot());
        num.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                v.setExpectedCount(Integer.valueOf(num.getText()));
            }
        });
        HorizontalPanel h = new HorizontalPanel();
        h.add(b);
        h.add(num);
        data.setWidget(i, 2, h);
        Button del = new Button();
        del.setIcon(IconType.TRASH);
        del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
        del.addClickHandler(clickEvent -> {
            if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisRuleExpectation())) {
                rfl.remove(v);
                sc.removeFixture(v);
                outer.setWidget(1, 0, render(rfl, sc));
            }
        });
        data.setWidget(i, 3, del);
        // we only want numbers here...
        num.addKeyPressHandler(new KeyPressHandler() {

            public void onKeyPress(KeyPressEvent event) {
                if (Character.isLetter(event.getCharCode())) {
                    ((TextBox) event.getSource()).cancelKey();
                }
            }
        });
    }
    ScenarioUtils.addBottomAndRightPaddingToTableCells(data);
    return data;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) VerifyRuleFired(org.drools.workbench.models.testscenarios.shared.VerifyRuleFired) FlexTable(com.google.gwt.user.client.ui.FlexTable) HTML(com.google.gwt.user.client.ui.HTML) TextBox(org.gwtbootstrap3.client.ui.TextBox) InputElement(com.google.gwt.dom.client.InputElement) Image(com.google.gwt.user.client.ui.Image) KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Button(org.gwtbootstrap3.client.ui.Button) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Example 88 with HTML

use of com.google.gwt.user.client.ui.HTML in project drools-wb by kiegroup.

the class FactPatternWidget method compositeFieldConstraintEditor.

/**
 * This will show the constraint editor - allowing field constraints to be
 * nested etc.
 */
private Widget compositeFieldConstraintEditor(final CompositeFieldConstraint constraint) {
    FlexTable t = new FlexTable();
    String desc;
    ClickHandler click = event -> popupCreator.showPatternPopupForComposite(constraint);
    if (constraint.getCompositeJunctionType().equals(CompositeFieldConstraint.COMPOSITE_TYPE_AND)) {
        desc = GuidedRuleEditorResources.CONSTANTS.AllOf() + ":";
    } else {
        desc = GuidedRuleEditorResources.CONSTANTS.AnyOf() + ":";
    }
    t.setWidget(0, 0, new ClickableLabel(desc, click, !this.readOnly));
    t.getFlexCellFormatter().setColSpan(0, 0, 2);
    FieldConstraint[] nested = constraint.getConstraints();
    FlexTable inner = new FlexTable();
    if (nested != null) {
        for (int i = 0; i < nested.length; i++) {
            this.renderFieldConstraint(inner, i, nested[i], constraint, true, 0);
            // add in remove icon here...
            final int currentRow = i;
            Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
            clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisNestedRestriction());
            clear.addClickHandler(event -> {
                if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItemFromNestedConstraint())) {
                    setModified(true);
                    constraint.removeConstraint(currentRow);
                    getModeller().refreshWidget();
                }
            });
            if (!this.readOnly) {
                // This used to be 5 and Connectives were not rendered
                inner.setWidget(i, 6, clear);
                inner.setWidget(i, 7, new MoveDownButton(event -> {
                    constraint.moveDown(currentRow);
                    getModeller().refreshWidget();
                }));
                inner.setWidget(i, 8, new MoveUpButton(event -> {
                    constraint.moveUp(currentRow);
                    getModeller().refreshWidget();
                }));
            }
        }
    }
    t.setWidget(1, 1, inner);
    t.setWidget(1, 0, new HTML("&nbsp;&nbsp;&nbsp;&nbsp;"));
    return t;
}
Also used : CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) DataType(org.kie.soup.project.datamodel.oracle.DataType) FlexTable(com.google.gwt.user.client.ui.FlexTable) Image(com.google.gwt.user.client.ui.Image) SingleFieldConstraintOperatorSelector(org.drools.workbench.screens.guided.rule.client.widget.operator.SingleFieldConstraintOperatorSelector) HumanReadable(org.kie.workbench.common.widgets.client.resources.HumanReadable) HTML(com.google.gwt.user.client.ui.HTML) Label(com.google.gwt.user.client.ui.Label) Map(java.util.Map) RuleModeller(org.drools.workbench.screens.guided.rule.client.editor.RuleModeller) ToStringExpressionVisitor(org.drools.workbench.models.datamodel.rule.visitors.ToStringExpressionVisitor) EventBus(com.google.gwt.event.shared.EventBus) DOM(com.google.gwt.user.client.DOM) ConstraintValueEditor(org.drools.workbench.screens.guided.rule.client.editor.ConstraintValueEditor) TextBox(org.gwtbootstrap3.client.ui.TextBox) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) MoveUpButton(org.drools.workbench.screens.guided.rule.client.editor.MoveUpButton) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) GuidedRuleEditorImages508(org.drools.workbench.screens.guided.rule.client.resources.images.GuidedRuleEditorImages508) DRLConstraintValueBuilder(org.drools.workbench.models.datamodel.rule.builder.DRLConstraintValueBuilder) HumanReadableConstants(org.kie.workbench.common.widgets.client.resources.i18n.HumanReadableConstants) CEPWindowOperatorsDropdown(org.drools.workbench.screens.guided.rule.client.editor.CEPWindowOperatorsDropdown) OperatorSelection(org.drools.workbench.screens.guided.rule.client.editor.OperatorSelection) RefreshUtil(org.drools.workbench.screens.guided.rule.client.util.RefreshUtil) SingleFieldConstraintEBLeftSide(org.drools.workbench.models.datamodel.rule.SingleFieldConstraintEBLeftSide) HasCEPWindow(org.drools.workbench.models.datamodel.rule.HasCEPWindow) MoveDownButton(org.drools.workbench.screens.guided.rule.client.editor.MoveDownButton) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) GuidedRuleEditorResources(org.drools.workbench.screens.guided.rule.client.resources.GuidedRuleEditorResources) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) HashMap(java.util.HashMap) GWT(com.google.gwt.core.client.GWT) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ArrayList(java.util.ArrayList) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) Window(com.google.gwt.user.client.Window) RuleAttribute(org.drools.workbench.models.datamodel.rule.RuleAttribute) IPattern(org.drools.workbench.models.datamodel.rule.IPattern) SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) Connectives(org.drools.workbench.screens.guided.rule.client.editor.factPattern.Connectives) HasHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment) HasConstraints(org.drools.workbench.models.datamodel.rule.HasConstraints) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) HasVerticalAlignment(com.google.gwt.user.client.ui.HasVerticalAlignment) PopupCreator(org.drools.workbench.screens.guided.rule.client.editor.factPattern.PopupCreator) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) MoveDownButton(org.drools.workbench.screens.guided.rule.client.editor.MoveDownButton) FlexTable(com.google.gwt.user.client.ui.FlexTable) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) MoveUpButton(org.drools.workbench.screens.guided.rule.client.editor.MoveUpButton) HTML(com.google.gwt.user.client.ui.HTML) Image(com.google.gwt.user.client.ui.Image) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 89 with HTML

use of com.google.gwt.user.client.ui.HTML in project drools-wb by kiegroup.

the class FactPatternWidget method renderSingleFieldConstraint.

/**
 * Applies a single field constraint to the given table, and start row.
 */
private void renderSingleFieldConstraint(final FlexTable inner, final int row, final SingleFieldConstraint constraint, final HasConstraints hasConstraints, boolean showBinding, final int tabs) {
    // for offsetting, just a slight indent
    final int col = 1;
    inner.setWidget(row, 0, new HTML("&nbsp;&nbsp;&nbsp;&nbsp;"));
    if (constraint.getConstraintValueType() != BaseSingleFieldConstraint.TYPE_PREDICATE) {
        HorizontalPanel ebContainer = null;
        if (constraint instanceof SingleFieldConstraintEBLeftSide) {
            ebContainer = expressionBuilderLS((SingleFieldConstraintEBLeftSide) constraint, showBinding);
            inner.setWidget(row, 0 + col, ebContainer);
        } else {
            inner.setWidget(row, 0 + col, fieldLabel(constraint, hasConstraints, showBinding, tabs * 20));
        }
        inner.setWidget(row, 1 + col, operatorDropDown(constraint, inner, row, 2 + col));
        // Get first part of constraint.fieldName? #1=Fact1, #2=SubFact1
        inner.setWidget(row, 2 + col, createValueEditor(constraint));
        inner.setWidget(row, 3 + col, getConnectives().connectives(constraint));
        if (ebContainer != null && ebContainer.getWidgetCount() > 0) {
            if (ebContainer.getWidget(0) instanceof ExpressionBuilder) {
                associateExpressionWithChangeHandler(inner, row, constraint, col, ebContainer);
            }
        }
    } else if (constraint.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_PREDICATE) {
        inner.setWidget(row, 1, predicateEditor(constraint));
        inner.getFlexCellFormatter().setColSpan(row, 1, 5);
    }
}
Also used : SingleFieldConstraintEBLeftSide(org.drools.workbench.models.datamodel.rule.SingleFieldConstraintEBLeftSide) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) HTML(com.google.gwt.user.client.ui.HTML) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 90 with HTML

use of com.google.gwt.user.client.ui.HTML in project drools-wb by kiegroup.

the class FromCompositeFactPatternWidget method getCompositeLabel.

protected Widget getCompositeLabel() {
    ClickHandler click = new ClickHandler() {

        public void onClick(ClickEvent event) {
            showFactTypeSelector();
        }
    };
    String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from") + "&nbsp;</div>";
    FlexTable panel = new FlexTable();
    int r = 0;
    if (pattern.getFactPattern() == null) {
        panel.setWidget(r, 0, new ClickableLabel("<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>", click, !this.readOnly));
        r++;
    }
    panel.setWidget(r, 0, new HTML(lbl));
    ExpressionBuilder expressionBuilder = new ExpressionBuilder(this.getModeller(), this.getEventBus(), this.pattern.getExpression(), this.readOnly);
    expressionBuilder.addOnModifiedCommand(new Command() {

        public void execute() {
            setModified(true);
        }
    });
    panel.setWidget(r, 1, expressionBuilder);
    return panel;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Command(com.google.gwt.user.client.Command) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) HTML(com.google.gwt.user.client.ui.HTML)

Aggregations

HTML (com.google.gwt.user.client.ui.HTML)170 ViewerPanel (org.cesiumjs.cs.widgets.ViewerPanel)34 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)32 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)31 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)26 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)21 FlexTable (com.google.gwt.user.client.ui.FlexTable)17 JSONString (com.google.gwt.json.client.JSONString)16 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)14 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)14 Label (com.google.gwt.user.client.ui.Label)14 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)13 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)12 Image (com.google.gwt.user.client.ui.Image)11 Widget (com.google.gwt.user.client.ui.Widget)11 ViewerOptions (org.cesiumjs.cs.widgets.options.ViewerOptions)11 Button (org.gwtbootstrap3.client.ui.Button)11 ListBox (com.google.gwt.user.client.ui.ListBox)10 ArrayList (java.util.ArrayList)10 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)10