Search in sources :

Example 26 with SmallLabel

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

the class DSLSentenceWidget method getLabel.

public Widget getLabel(String labelDef) {
    SmallLabel label = new SmallLabel();
    label.setText(labelDef.trim());
    return label;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel)

Example 27 with SmallLabel

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

the class ExpressionBuilder method initializeWidgets.

private void initializeWidgets() {
    panel.clear();
    StringBuilder bindingLabel = new StringBuilder();
    String binding = getBoundText();
    bindingLabel.append("<b>");
    bindingLabel.append(binding);
    bindingLabel.append("</b>");
    bindingLabel.append(":");
    if (isExpressionEmpty()) {
        if (this.readOnly) {
            panel.add(new SmallLabel("<b>-</b>"));
        } else {
            panel.add(createStartPointWidget());
        }
    } else {
        if (this.readOnly) {
            panel.add(createBindingWidgetForExpression(bindingLabel.toString()));
            panel.add(createWidgetForExpression());
        } else {
            panel.add(createBindingWidgetForExpression(bindingLabel.toString()));
            panel.add(createWidgetForExpression());
            panel.add(getWidgetForCurrentType());
        }
    }
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel)

Example 28 with SmallLabel

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

the class FactPatternWidget method expressionBuilderLS.

private HorizontalPanel expressionBuilderLS(final SingleFieldConstraintEBLeftSide con, boolean showBinding) {
    HorizontalPanel ab = new HorizontalPanel();
    ab.setStyleName("modeller-field-Label");
    if (!con.isBound()) {
        if (bindable && showBinding && !this.readOnly) {
            ab.add(new ExpressionBuilder(getModeller(), getEventBus(), con.getExpressionLeftSide()));
        } else {
            final DRLConstraintValueBuilder constraintValueBuilder = DRLConstraintValueBuilder.getBuilder(getRuleDialect());
            final ToStringExpressionVisitor visitor = new ToStringExpressionVisitor(constraintValueBuilder);
            ab.add(new SmallLabel(con.getExpressionLeftSide().getText(visitor)));
        }
    } else {
        ab.add(new ExpressionBuilder(getModeller(), getEventBus(), con.getExpressionLeftSide()));
    }
    return ab;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DRLConstraintValueBuilder(org.drools.workbench.models.datamodel.rule.builder.DRLConstraintValueBuilder) ToStringExpressionVisitor(org.drools.workbench.models.datamodel.rule.visitors.ToStringExpressionVisitor)

Example 29 with SmallLabel

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

the class FactDataWidgetFactory method build.

public void build(final String headerText, final Fact fact) {
    if (fact instanceof FactData) {
        FactData factData = (FactData) fact;
        widget.setWidget(0, ++col, new SmallLabel("[" + factData.getName() + "]"));
    } else {
        col++;
    }
    widget.setWidget(0, 0, new ClickableLabel(headerText, createAddFieldButton(fact)));
    Map<FieldData, FieldDataConstraintEditor> enumEditorMap = new HashMap<FieldData, FieldDataConstraintEditor>();
    // Sets row name and delete button.
    for (final Field field : fact.getFieldData()) {
        // Avoid duplicate field rows, only one for each name.
        if (rowIndexByFieldName.doesNotContain(field.getName())) {
            newRow(fact, field.getName());
        }
        // Sets row data
        int fieldRowIndex = rowIndexByFieldName.getRowIndex(field.getName());
        IsWidget editableCell = editableCell(field, fact, fact.getType());
        widget.setWidget(fieldRowIndex, col, editableCell);
        if (field instanceof FieldData) {
            FieldData fieldData = (FieldData) field;
            if (fieldData.getNature() == FieldData.TYPE_ENUM) {
                enumEditorMap.put(fieldData, (FieldDataConstraintEditor) editableCell);
            }
        }
    }
    for (FieldDataConstraintEditor outerEnumEditor : enumEditorMap.values()) {
        for (FieldDataConstraintEditor innerEnumEditor : enumEditorMap.values()) {
            if (outerEnumEditor != innerEnumEditor) {
                outerEnumEditor.addIfDependentEnumEditor(innerEnumEditor);
            }
        }
    }
    if (fact instanceof FactData) {
        DeleteFactColumnButton deleteFactColumnButton = new DeleteFactColumnButton((FactData) fact);
        widget.setWidget(rowIndexByFieldName.amountOrRows() + 1, col, deleteFactColumnButton);
    }
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) CollectionFieldData(org.drools.workbench.models.testscenarios.shared.CollectionFieldData) FieldData(org.drools.workbench.models.testscenarios.shared.FieldData) IsWidget(com.google.gwt.user.client.ui.IsWidget) FactAssignmentField(org.drools.workbench.models.testscenarios.shared.FactAssignmentField) Field(org.drools.workbench.models.testscenarios.shared.Field) HashMap(java.util.HashMap) FactData(org.drools.workbench.models.testscenarios.shared.FactData) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel)

Example 30 with SmallLabel

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

the class RetractWidget method render.

private void render() {
    clear();
    getCellFormatter().setStyleName(0, 0, "modeller-fact-TypeHeader");
    getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
    setStyleName("modeller-fact-pattern-Widget");
    setWidget(0, 0, new SmallLabel(TestScenarioConstants.INSTANCE.DeleteFacts()));
    getFlexCellFormatter().setColSpan(0, 0, 2);
    int row = 1;
    for (Fixture fixture : retractList) {
        if (fixture instanceof RetractFact) {
            final RetractFact retractFact = (RetractFact) fixture;
            setWidget(row, 0, new SmallLabel(retractFact.getName()));
            setWidget(row, 1, new DeleteButton(retractFact));
            row++;
        }
    }
    ScenarioUtils.addBottomAndRightPaddingToTableCells(this);
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) Fixture(org.drools.workbench.models.testscenarios.shared.Fixture) RetractFact(org.drools.workbench.models.testscenarios.shared.RetractFact)

Aggregations

SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)32 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)13 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)13 Button (org.gwtbootstrap3.client.ui.Button)12 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)9 HTML (com.google.gwt.user.client.ui.HTML)8 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)7 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)7 Image (com.google.gwt.user.client.ui.Image)7 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)7 ListBox (org.gwtbootstrap3.client.ui.ListBox)6 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)5 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)5 TextBox (org.gwtbootstrap3.client.ui.TextBox)5 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)5 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)4 Widget (com.google.gwt.user.client.ui.Widget)3 CompositeFieldConstraint (org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint)3 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)3 ClickableLabel (org.uberfire.ext.widgets.common.client.common.ClickableLabel)3