Search in sources :

Example 76 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project openremote by openremote.

the class ValueEditors method createObjectEditor.

public static IsWidget createObjectEditor(ObjectValue currentValue, Consumer<ObjectValue> onValueModified, Optional<Long> timestamp, boolean readOnly, String label, String title, JsonEditor jsonEditor) {
    Consumer<Value> updateConsumer = readOnly ? null : value -> onValueModified.accept(Values.getObject(value).orElse(null));
    FlowPanel panel = new FlowPanel();
    panel.setStyleName("flex layout horizontal center or-ValueEditor or-ObjectValueEditor");
    IsWidget widget = createJsonEditorWidget(jsonEditor, readOnly, label, title, currentValue, updateConsumer);
    FlowPanel widgetWrapper = new FlowPanel();
    widgetWrapper.setStyleName("flex layout horizontal center");
    widgetWrapper.add(widget);
    panel.add(widgetWrapper);
    timestamp.ifPresent(time -> addTimestampLabel(time, panel));
    return panel;
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 77 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project openremote by openremote.

the class ValueEditors method createStringEditor.

public static IsWidget createStringEditor(StringValue currentValue, Consumer<StringValue> onValueModified, Optional<Long> timestamp, boolean readOnly, String styleName) {
    Consumer<String> updateConsumer = readOnly ? null : str -> onValueModified.accept(isNullOrEmpty(str) ? null : Values.create(str));
    FlowPanel panel = new FlowPanel();
    panel.setStyleName("flex layout horizontal center or-ValueEditor or-StringValueEditor");
    IsWidget widget = ValueEditors.createStringEditorWidget(styleName, readOnly, currentValue != null ? currentValue.getString() : null, updateConsumer);
    FlowPanel widgetWrapper = new FlowPanel();
    widgetWrapper.setStyleName("flex layout horizontal center");
    widgetWrapper.add(widget);
    panel.add(widgetWrapper);
    timestamp.ifPresent(time -> addTimestampLabel(time, panel));
    return panel;
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 78 with FlowPanel

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

the class ColumnsPagePresenterTest method testRuleInheritanceWidget.

@Test
public void testRuleInheritanceWidget() {
    final FlowPanel expectedPanel = mock(FlowPanel.class);
    final Label label = mock(Label.class);
    final Widget widget = mock(Widget.class);
    doReturn(expectedPanel).when(presenter).makeFlowPanel();
    doReturn(label).when(presenter).ruleInheritanceLabel();
    doReturn(widget).when(presenter).ruleSelector();
    final Widget actualPanel = presenter.ruleInheritanceWidget();
    verify(expectedPanel).setStyleName(GuidedDecisionTableResources.INSTANCE.css().ruleInheritance());
    verify(expectedPanel).add(label);
    verify(expectedPanel).add(widget);
    assertEquals(expectedPanel, actualPanel);
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) 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) Test(org.junit.Test)

Example 79 with FlowPanel

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

the class ColumnManagementView method renderColumn.

HorizontalPanel renderColumn(final ActionCol52 actionColumn) {
    HorizontalPanel action = newHorizontalPanel();
    final ColumnLabelWidget actionLabel = makeColumnLabel(actionColumn);
    action.add(actionLabel);
    final FlowPanel buttons = new FlowPanel() {

        {
            add(editAnchor((clickEvent) -> {
                presenter.getActiveDecisionTable().ifPresent(dt -> dt.editAction(actionColumn));
            }));
            if (presenter.isActiveDecisionTableEditable()) {
                add(deleteAnchor(actionColumn.getHeader(), () -> {
                    try {
                        final Optional<GuidedDecisionTableView.Presenter> dtPresenter = presenter.getActiveDecisionTable();
                        if (dtPresenter.isPresent()) {
                            dtPresenter.get().deleteColumn(actionColumn);
                        }
                    } catch (VetoDeletePatternInUseException veto) {
                        presenter.getView().showUnableToDeleteColumnMessage(actionColumn);
                    } catch (VetoException veto) {
                        presenter.getView().showGenericVetoMessage();
                    }
                }));
            }
        }
    };
    action.add(buttons);
    return action;
}
Also used : BRLConditionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ArrayList(java.util.ArrayList) VetoDeletePatternInUseException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoDeletePatternInUseException) Inject(javax.inject.Inject) VetoException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Command(com.google.gwt.user.client.Command) Dependent(javax.enterprise.context.Dependent) Label(com.google.gwt.user.client.ui.Label) Map(java.util.Map) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Optional(java.util.Optional) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) VetoException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException) Optional(java.util.Optional) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) VetoDeletePatternInUseException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoDeletePatternInUseException)

Example 80 with FlowPanel

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

the class ColumnManagementView method renderColumn.

HorizontalPanel renderColumn(final BRLConditionColumn conditionColumn) {
    HorizontalPanel condition = newHorizontalPanel();
    final ColumnLabelWidget columnLabel = makeColumnLabel(conditionColumn);
    condition.add(columnLabel);
    final FlowPanel buttons = new FlowPanel() {

        {
            add(editAnchor((clickEvent) -> {
                presenter.getActiveDecisionTable().ifPresent(dt -> dt.editCondition(conditionColumn));
            }));
            if (presenter.isActiveDecisionTableEditable()) {
                add(removeCondition(conditionColumn));
            }
        }
    };
    condition.add(buttons);
    return condition;
}
Also used : BRLConditionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ArrayList(java.util.ArrayList) VetoDeletePatternInUseException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoDeletePatternInUseException) Inject(javax.inject.Inject) VetoException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Command(com.google.gwt.user.client.Command) Dependent(javax.enterprise.context.Dependent) Label(com.google.gwt.user.client.ui.Label) Map(java.util.Map) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Optional(java.util.Optional) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)81 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)18 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 Button (com.google.gwt.user.client.ui.Button)14 Label (com.google.gwt.user.client.ui.Label)12 Grid (com.google.gwt.user.client.ui.Grid)10 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)8 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 SmallHeading (com.google.gerrit.client.ui.SmallHeading)6 Element (com.google.gwt.dom.client.Element)6 CheckBox (com.google.gwt.user.client.ui.CheckBox)6 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)6 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)6 Widget (com.google.gwt.user.client.ui.Widget)6 Test (org.junit.Test)6 ComplexPanel (com.google.gwt.user.client.ui.ComplexPanel)5 HTML (com.google.gwt.user.client.ui.HTML)5 Image (com.google.gwt.user.client.ui.Image)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 List (java.util.List)4