Search in sources :

Example 6 with CheckBox

use of org.gwtbootstrap3.client.ui.CheckBox in project drools-wb by kiegroup.

the class RuleAttributeWidget method checkBoxEditor.

private Widget checkBoxEditor(final RuleAttribute at, final boolean isReadOnly) {
    final CheckBox box = new CheckBox();
    box.setEnabled(!isReadOnly);
    if (at.getValue() == null || at.getValue().isEmpty()) {
        box.setValue(false);
        at.setValue(FALSE_VALUE);
    } else {
        box.setValue((at.getValue().equals(TRUE_VALUE)));
    }
    box.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            at.setValue((box.getValue()) ? TRUE_VALUE : FALSE_VALUE);
        }
    });
    return box;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) CheckBox(org.gwtbootstrap3.client.ui.CheckBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 7 with CheckBox

use of org.gwtbootstrap3.client.ui.CheckBox in project drools-wb by kiegroup.

the class RuleModellerActionSelectorPopup method getContent.

@Override
public Widget getContent() {
    if (position == null) {
        positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Bottom(), String.valueOf(this.model.rhs.length));
        positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Top(), "0");
        for (int i = 1; i < model.rhs.length; i++) {
            positionCbo.addItem(GuidedRuleEditorResources.CONSTANTS.Line0(i), String.valueOf(i));
        }
    } else {
        // if position is fixed, we just add one element to the drop down.
        positionCbo.addItem(String.valueOf(position));
        positionCbo.setSelectedIndex(0);
    }
    if (oracle.getDSLConditions().size() == 0 && oracle.getFactTypes().length == 0) {
        layoutPanel.addRow(new HTML("<div class='highlight'>" + GuidedRuleEditorResources.CONSTANTS.NoModelTip() + "</div>"));
    }
    // only show the drop down if we are not using fixed position.
    if (position == null) {
        HorizontalPanel hp0 = new HorizontalPanel();
        hp0.add(new HTML(GuidedRuleEditorResources.CONSTANTS.PositionColon()));
        hp0.add(positionCbo);
        hp0.add(new InfoPopup(GuidedRuleEditorResources.CONSTANTS.PositionColon(), GuidedRuleEditorResources.CONSTANTS.ActionPositionExplanation()));
        layoutPanel.addRow(hp0);
        layoutPanel.addRow(new HTML("<hr/>"));
    }
    choices = makeChoicesListBox();
    choicesPanel.add(choices);
    layoutPanel.addRow(choicesPanel);
    // DSL might be prohibited (e.g. editing a DRL file. Only DSLR files can contain DSL)
    if (ruleModeller.isDSLEnabled()) {
        CheckBox chkOnlyDisplayDSLConditions = new CheckBox();
        chkOnlyDisplayDSLConditions.setText(GuidedRuleEditorResources.CONSTANTS.OnlyDisplayDSLActions());
        chkOnlyDisplayDSLConditions.setValue(onlyShowDSLStatements);
        chkOnlyDisplayDSLConditions.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            public void onValueChange(ValueChangeEvent<Boolean> event) {
                onlyShowDSLStatements = event.getValue();
                choicesPanel.setWidget(makeChoicesListBox());
            }
        });
        layoutPanel.addRow(chkOnlyDisplayDSLConditions);
    }
    return layoutPanel;
}
Also used : CheckBox(org.gwtbootstrap3.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) HTML(com.google.gwt.user.client.ui.HTML) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 8 with CheckBox

use of org.gwtbootstrap3.client.ui.CheckBox in project drools-wb by kiegroup.

the class AuditLogViewImpl method makeEventTypeCheckBox.

private Widget makeEventTypeCheckBox(final String eventType, final Boolean isEnabled) {
    final CheckBox chkEventType = new CheckBox(AuditLogEntryCellHelper.getEventTypeDisplayText(eventType));
    chkEventType.setValue(Boolean.TRUE.equals(isEnabled));
    chkEventType.addValueChangeHandler((ValueChangeEvent<Boolean> event) -> {
        auditLog.getAuditLogFilter().getAcceptedTypes().put(eventType, event.getValue());
    });
    // BZ-996942: Use one column layout.
    chkEventType.setWordWrap(false);
    return new Column(ColumnSize.MD_2) {

        {
            add(chkEventType);
        }
    };
}
Also used : ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) Column(org.gwtbootstrap3.client.ui.Column) CheckBox(org.gwtbootstrap3.client.ui.CheckBox)

Example 9 with CheckBox

use of org.gwtbootstrap3.client.ui.CheckBox in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testHideMetadataClickHandlerWhenVetoExceptionIsNotRaised.

@Test
public void testHideMetadataClickHandlerWhenVetoExceptionIsNotRaised() throws Exception {
    final MetadataCol52 clone = mock(MetadataCol52.class);
    final CheckBox checkBox = mock(CheckBox.class);
    final ClickEvent clickEvent = mock(ClickEvent.class);
    final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
    doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
    doReturn(clone).when(metadataColumn).cloneColumn();
    final ClickHandler clickHandler = presenter.hideMetadataClickHandler(modeller, checkBox, metadataColumn);
    clickHandler.onClick(clickEvent);
    verify(clone).setHideColumn(checkBox.getValue());
    verify(activeDecisionTable).updateColumn(metadataColumn, clone);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) CheckBox(org.gwtbootstrap3.client.ui.CheckBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Example 10 with CheckBox

use of org.gwtbootstrap3.client.ui.CheckBox 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)

Aggregations

CheckBox (org.gwtbootstrap3.client.ui.CheckBox)14 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)5 Test (org.junit.Test)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)2 HTML (com.google.gwt.user.client.ui.HTML)2 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)2 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)2 ColumnLabelWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget)2 DeleteColumnManagementAnchorWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget)2 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 Widget (com.google.gwt.user.client.ui.Widget)1 Date (java.util.Date)1 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)1 ModelSynchronizer (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer)1 RuleAttributeWidget (org.drools.workbench.screens.guided.rule.client.editor.RuleAttributeWidget)1