Search in sources :

Example 61 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel in project gerrit by GerritCodeReview.

the class GroupListScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(AdminConstants.I.groupListTitle());
    initPageHeader();
    prev = PagingHyperlink.createPrev();
    prev.setVisible(false);
    next = PagingHyperlink.createNext();
    next.setVisible(false);
    groups = new GroupTable(PageLinks.ADMIN_GROUPS);
    add(groups);
    final HorizontalPanel buttons = new HorizontalPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
    buttons.add(prev);
    buttons.add(next);
    add(buttons);
}
Also used : HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Example 62 with HorizontalPanel

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

the class ColumnsPagePresenterTest method testMakeMetaDataWidgetWhenDecisionTableIsEditable.

@Test
public void testMakeMetaDataWidgetWhenDecisionTableIsEditable() {
    final HorizontalPanel expectedHorizontalPanel = mock(HorizontalPanel.class);
    final ColumnLabelWidget columnLabelWidget = mock(ColumnLabelWidget.class);
    final CheckBox hideColumnCheckBox = mock(CheckBox.class);
    final DeleteColumnManagementAnchorWidget deleteColumnManagementAnchorWidget = mock(DeleteColumnManagementAnchorWidget.class);
    final boolean isEditable = true;
    doReturn(expectedHorizontalPanel).when(presenter).makeHorizontalPanel();
    doReturn(columnLabelWidget).when(presenter).makeColumnLabel(metadataColumn);
    doReturn(hideColumnCheckBox).when(presenter).hideColumnCheckBox(modeller, metadataColumn);
    doReturn(deleteColumnManagementAnchorWidget).when(presenter).deleteMetaDataColumnAnchor(modeller, metadataColumn);
    doReturn(isEditable).when(modeller).isActiveDecisionTableEditable();
    final HorizontalPanel actualHorizontalPanel = presenter.makeMetaDataWidget(modeller, metadataColumn);
    verify(actualHorizontalPanel).setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verify(actualHorizontalPanel).add(columnLabelWidget);
    verify(actualHorizontalPanel).add(hideColumnCheckBox);
    verify(actualHorizontalPanel).add(deleteColumnManagementAnchorWidget);
    assertEquals(expectedHorizontalPanel, actualHorizontalPanel);
}
Also used : ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) CheckBox(org.gwtbootstrap3.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) Test(org.junit.Test)

Example 63 with HorizontalPanel

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

the class ColumnsPagePresenterTest method testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsNotEmpty.

@Test
public void testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsNotEmpty() {
    final MetadataCol52 metadataColumn1 = mock(MetadataCol52.class);
    final MetadataCol52 metadataColumn2 = mock(MetadataCol52.class);
    final HorizontalPanel metaDataWidget1 = mock(HorizontalPanel.class);
    final HorizontalPanel metaDataWidget2 = mock(HorizontalPanel.class);
    final List<MetadataCol52> metaDataColumns = new ArrayList<MetadataCol52>() {

        {
            add(metadataColumn1);
            add(metadataColumn2);
        }
    };
    doReturn(verticalPanel).when(presenter).getMetaDataWidget();
    doReturn(metaDataWidget1).when(presenter).makeMetaDataWidget(modeller, metadataColumn1);
    doReturn(metaDataWidget2).when(presenter).makeMetaDataWidget(modeller, metadataColumn2);
    presenter.refreshMetaDataWidget(metaDataColumns);
    verify(verticalPanel).clear();
    verify(verticalPanel).add(metaDataWidget1);
    verify(verticalPanel).add(metaDataWidget2);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 64 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel 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 65 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel 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

HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)75 Label (com.google.gwt.user.client.ui.Label)25 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)24 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)21 Image (com.google.gwt.user.client.ui.Image)15 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)14 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)11 HTML (com.google.gwt.user.client.ui.HTML)8 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)7 Widget (com.google.gwt.user.client.ui.Widget)7 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)7 Button (org.gwtbootstrap3.client.ui.Button)7 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)6 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)6 TextBox (com.google.gwt.user.client.ui.TextBox)6 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)5 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)5 TextBox (org.gwtbootstrap3.client.ui.TextBox)5 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)5 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)4