Search in sources :

Example 51 with Label

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

the class ColumnsPagePresenterTest method testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty.

@Test
public void testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty() {
    final AttributeColumnConfigRow attributeColumnConfigRow = mock(AttributeColumnConfigRow.class);
    final Label blankSlate = mock(Label.class);
    final AttributeCol52 attributeCol52 = mock(AttributeCol52.class);
    final Widget widget = mock(Widget.class);
    final List<AttributeCol52> attributeColumns = new ArrayList<AttributeCol52>() {

        {
            add(attributeCol52);
        }
    };
    doReturn(verticalPanel).when(presenter).getAttributeWidget();
    doReturn(attributeColumnConfigRow).when(this.attributeColumnConfigRow).get();
    doReturn(widget).when(attributeColumnConfigRow).getView();
    doReturn(blankSlate).when(presenter).blankSlate();
    presenter.refreshAttributeWidget(attributeColumns);
    verify(attributeColumnConfigRow).init(attributeCol52, modeller);
    verify(verticalPanel, never()).add(blankSlate);
    verify(verticalPanel).add(widget);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) Label(com.google.gwt.user.client.ui.Label) Widget(com.google.gwt.user.client.ui.Widget) ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) ArrayList(java.util.ArrayList) AttributeColumnConfigRow(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow) Test(org.junit.Test)

Example 52 with Label

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

the class ColumnsPagePresenterTest method testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsEmpty.

@Test
public void testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsEmpty() {
    final List<MetadataCol52> metaDataColumns = new ArrayList<>();
    final Label blankSlate = mock(Label.class);
    doReturn(verticalPanel).when(presenter).getMetaDataWidget();
    doReturn(blankSlate).when(presenter).blankSlate();
    presenter.refreshMetaDataWidget(metaDataColumns);
    verify(verticalPanel).clear();
    verify(verticalPanel).add(blankSlate);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) ArrayList(java.util.ArrayList) Label(com.google.gwt.user.client.ui.Label) Test(org.junit.Test)

Example 53 with Label

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

the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsEmpty.

@Test
public void testRefreshActionsWidgetWhenActionColumnsIsEmpty() {
    final List<ActionCol52> actionColumns = new ArrayList<>();
    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    doReturn(verticalPanel).when(presenter).getActionsWidget();
    doReturn(columnManagementView).when(presenter).getActionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(ACTION);
    presenter.refreshActionsWidget(actionColumns);
    verify(item).setOpen(false);
    verify(verticalPanel).add(blankSlate);
    verify(verticalPanel, never()).add(columnManagementView);
    verify(columnManagementView, never()).renderColumns(any());
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ArrayList(java.util.ArrayList) ColumnManagementView(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView) Label(com.google.gwt.user.client.ui.Label) GuidedDecisionTableAccordionItem(org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem) Test(org.junit.Test)

Example 54 with Label

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

the class ExpressionBuilder method createWidgetForExpression.

// Render Widgets for the Expression. ExpressionMethodParameter and ExpressionText parts
// are represented by a TextBox to allow the User to edit the values, Updates are
// reflected in the model.
private Widget createWidgetForExpression() {
    final HorizontalPanel container = new HorizontalPanel();
    container.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    container.setStylePrimaryName(GuidedRuleEditorResources.INSTANCE.css().container());
    for (ExpressionPart expressionPart : expression.getParts()) {
        if (expressionPart instanceof ExpressionUnboundFact) {
            continue;
        } else if (this.readOnly) {
            container.add(new Label(expressionPart.getName()));
        } else if (expressionPart instanceof ExpressionMethod) {
            container.add(new Label(expressionPart.getName()));
            container.add(new Label("("));
            final ExpressionMethod em = (ExpressionMethod) expressionPart;
            final List<ExpressionFormLine> emParams = em.getOrderedParams();
            for (int index = 0; index < emParams.size(); index++) {
                final ExpressionFormLine paramValueHolder = emParams.get(index);
                final String paramDataType = em.getParameterDataType(paramValueHolder);
                final ExpressionMethodParameter paramValue = ((ExpressionMethodParameter) paramValueHolder.getRootExpression());
                final TextBox paramValueEditor = TextBoxFactory.getTextBox(paramDataType);
                paramValueEditor.addValueChangeHandler(new ValueChangeHandler<String>() {

                    @Override
                    public void onValueChange(ValueChangeEvent<String> event) {
                        paramValue.setText(event.getValue());
                    }
                });
                paramValueEditor.setText(paramValue.getName());
                container.add(paramValueEditor);
                if (index < emParams.size() - 1) {
                    container.add(new Label(", "));
                }
            }
            container.add(new Label(")"));
        } else if (!(expressionPart instanceof ExpressionText)) {
            container.add(new Label(expressionPart.getName()));
        } else {
            final TextBox tb = new TextBox();
            final ExpressionText expressionTextPart = (ExpressionText) expressionPart;
            tb.setText(expressionTextPart.getName());
            tb.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(final ChangeEvent changeEvent) {
                    expressionTextPart.setText(tb.getText());
                }
            });
            container.add(tb);
        }
        container.add(new Label("."));
    }
    return container;
}
Also used : ExpressionMethodParameter(org.drools.workbench.models.datamodel.rule.ExpressionMethodParameter) ExpressionPart(org.drools.workbench.models.datamodel.rule.ExpressionPart) Label(com.google.gwt.user.client.ui.Label) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ExpressionText(org.drools.workbench.models.datamodel.rule.ExpressionText) TextBox(org.gwtbootstrap3.client.ui.TextBox) ExpressionUnboundFact(org.drools.workbench.models.datamodel.rule.ExpressionUnboundFact) ExpressionMethod(org.drools.workbench.models.datamodel.rule.ExpressionMethod) ExpressionFormLine(org.drools.workbench.models.datamodel.rule.ExpressionFormLine) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ExpressionTypeChangeEvent(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeEvent) ExpressionChangeEvent(org.drools.workbench.screens.guided.rule.client.editor.ExpressionChangeEvent) ExpressionChangeHandler(org.drools.workbench.screens.guided.rule.client.editor.ExpressionChangeHandler) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ExpressionTypeChangeHandler(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeHandler) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Example 55 with Label

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

the class FactPatternWidget method createCEPWindowWidget.

// Widget for CEP 'windows'
private Widget createCEPWindowWidget(final RuleModeller modeller, final HasCEPWindow c) {
    final HorizontalPanel hp = new HorizontalPanel();
    modeller.getDataModelOracle().isFactTypeAnEvent(pattern.getFactType(), new Callback<Boolean>() {

        @Override
        public void callback(final Boolean result) {
            if (Boolean.TRUE.equals(result)) {
                final Label lbl = new Label(HumanReadableConstants.INSTANCE.OverCEPWindow());
                lbl.setStyleName("paddedLabel");
                hp.add(lbl);
                final CEPWindowOperatorsDropdown cwo = new CEPWindowOperatorsDropdown(c, readOnly);
                if (!isReadOnly()) {
                    cwo.addValueChangeHandler(new ValueChangeHandler<OperatorSelection>() {

                        public void onValueChange(ValueChangeEvent<OperatorSelection> event) {
                            setModified(true);
                            OperatorSelection selection = event.getValue();
                            String selected = selection.getValue();
                            c.getWindow().setOperator(selected);
                        }
                    });
                }
                hp.add(cwo);
            }
        }
    });
    return hp;
}
Also used : CEPWindowOperatorsDropdown(org.drools.workbench.screens.guided.rule.client.editor.CEPWindowOperatorsDropdown) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) OperatorSelection(org.drools.workbench.screens.guided.rule.client.editor.OperatorSelection) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)

Aggregations

Label (com.google.gwt.user.client.ui.Label)106 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)22 Test (org.junit.Test)19 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)17 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)11 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)11 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)10 ArrayList (java.util.ArrayList)10 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)9 TextBox (com.google.gwt.user.client.ui.TextBox)9 Image (com.google.gwt.user.client.ui.Image)8 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)7 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)7 CheckBox (com.google.gwt.user.client.ui.CheckBox)7 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)7 HTML (com.google.gwt.user.client.ui.HTML)6 JsArrayString (com.google.gwt.core.client.JsArrayString)5 Element (com.google.gwt.dom.client.Element)5 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)5 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)5