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;
}
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;
}
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);
}
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;
}
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;
}
Aggregations