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