List of usage examples for com.google.gwt.user.client.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:org.datacleaner.monitor.dashboard.widgets.ColumnParameterizedMetricPresenter.java
License:Open Source License
private Widget createMetricWidget(final MetricIdentifier metric) { final MetricIdentifier activeMetric = isActiveMetric(metric); final MetricIdentifier metricToReturn; if (activeMetric == null) { metricToReturn = metric;/*from ww w. j a v a2 s.c o m*/ } else { metricToReturn = activeMetric; } final CheckBox checkBox = new CheckBox(); checkBox.setTitle(metric.getDisplayName()); checkBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (checkBox.getValue().booleanValue()) { _selectedMetrics.add(metricToReturn); } else { _selectedMetrics.remove(metricToReturn); } } }); if (activeMetric == null) { checkBox.setValue(false); } else { checkBox.setValue(true); _selectedMetrics.add(metricToReturn); } return checkBox; }
From source file:org.daxplore.presenter.client.ui.PerspectiveCheckboxPanel.java
License:Open Source License
/** * Get a list of the indexes of the selected perspective options. * /*from w w w .j a va2 s. com*/ * @return the selected option indexes */ public List<Integer> getPerspectiveOptions() { List<Integer> altList = new LinkedList<Integer>(); for (CheckBox c : checkboxList) { if (c.getValue()) { try { altList.add(Integer.parseInt(c.getFormValue())); } catch (NumberFormatException e) { e.printStackTrace(); } } } return altList; }
From source file:org.drools.guvnor.client.admin.RuleVerifierManager.java
License:Apache License
public RuleVerifierManager() { PrettyFormLayout form = new PrettyFormLayout(); form.addHeader(images.ruleVerification(), new HTML(constants.EditRulesVerificationConfiguration())); form.startSection(constants.AutomaticVerification()); final CheckBox enableOnlineValidator = new CheckBox(); enableOnlineValidator.setValue(WorkingSetManager.getInstance().isAutoVerifierEnabled()); form.addAttribute(constants.Enabled(), enableOnlineValidator); HorizontalPanel actions = new HorizontalPanel(); form.addAttribute("", actions); Button btnSave = new Button(constants.SaveChanges()); btnSave.setTitle(constants.SaveAllChanges()); btnSave.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { WorkingSetManager.getInstance().setAutoVerifierEnabled(enableOnlineValidator.getValue()); Window.alert(constants.AllChangesHaveBeenSaved()); }/* w ww .j a va 2 s .c om*/ }); actions.add(btnSave); form.endSection(); initWidget(form); }
From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.RuleAttributeWidget.java
License:Apache License
private Widget checkBoxEditor(final RuleAttribute at) { final CheckBox box = new CheckBox(); if (at.value == null) { box.setValue(true);/*from w w w . j a v a2 s.c om*/ at.value = TRUE_VALUE; } else { box.setValue((at.value.equals(TRUE_VALUE))); } box.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { at.value = (box.getValue()) ? TRUE_VALUE : FALSE_VALUE; } }); return box; }
From source file:org.drools.guvnor.client.asseteditor.drools.serviceconfig.KBaseConfigPanel.java
License:Apache License
private TreeItem buildTreeItem(final TreeItem parent, final String text, final ImageResource image, final AssetReference asset) { if (asset != null) { for (int i = 0; i < parent.getChildCount(); i++) { if (parent.getChild(i).getUserObject() == null) { continue; }//from ww w .j av a2 s. co m final AssetReference currentAsset = (AssetReference) parent.getChild(i).getUserObject(); if (currentAsset.getName().equals(text)) { return parent.getChild(i); } } } final CheckBox checkBox = new CheckBox(treeItemFormat(text, image)); final TreeItem newTreeItem = parent.addItem(checkBox); newTreeItem.setUserObject(asset); checkBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final CheckBox me = ((CheckBox) event.getSource()); boolean checked = me.getValue(); if (newTreeItem.getChildCount() > 0) { for (int i = 0; i < newTreeItem.getChildCount(); i++) { defineState(newTreeItem.getChild(i), checked); } } } private void defineState(TreeItem currentItem, boolean checked) { ((CheckBox) currentItem.getWidget()).setValue(checked); if (currentItem.getChildCount() > 0) { for (int i = 0; i < currentItem.getChildCount(); i++) { defineState(currentItem.getChild(i), checked); } } } }); parent.setState(true, false); newTreeItem.setState(true, false); return newTreeItem; }
From source file:org.drools.guvnor.client.decisiontable.ActionInsertFactPopup.java
License:Apache License
private Widget doInsertLogical() { HorizontalPanel hp = new HorizontalPanel(); final CheckBox cb = new CheckBox(); cb.setValue(editingCol.isInsertLogical()); cb.setText(""); cb.setEnabled(!isReadOnly);// www . j ava2 s. c o m if (!isReadOnly) { cb.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { if (sce.isGlobalVariable(editingCol.getBoundName())) { cb.setEnabled(false); editingCol.setInsertLogical(false); } else { editingCol.setInsertLogical(cb.getValue()); } } }); } hp.add(cb); hp.add(new InfoPopup(Constants.INSTANCE.LogicallyInsertANewFact(), Constants.INSTANCE.LogicallyAssertAFactTheFactWillBeRetractedWhenTheSupportingEvidenceIsRemoved())); return hp; }
From source file:org.drools.guvnor.client.decisiontable.ActionSetFieldPopup.java
License:Apache License
private Widget doUpdate() { HorizontalPanel hp = new HorizontalPanel(); final CheckBox cb = new CheckBox(); cb.setValue(editingCol.isUpdate());/*from w w w . j a va 2 s .c o m*/ cb.setText(""); cb.setEnabled(!isReadOnly); if (!isReadOnly) { cb.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { if (sce.isGlobalVariable(editingCol.getBoundName())) { cb.setEnabled(false); editingCol.setUpdate(false); } else { editingCol.setUpdate(cb.getValue()); } } }); } hp.add(cb); hp.add(new InfoPopup(Constants.INSTANCE.UpdateFact(), Constants.INSTANCE.UpdateDescription())); return hp; }
From source file:org.drools.guvnor.client.decisiontable.ConditionPopup.java
License:Apache License
protected void showNewPatternDialog() { final FormStylePopup pop = new FormStylePopup(); pop.setTitle(Constants.INSTANCE.CreateANewFactPattern()); final ListBox types = new ListBox(); for (int i = 0; i < sce.getFactTypes().length; i++) { types.addItem(sce.getFactTypes()[i]); }/*from w w w . j a v a2 s . c o m*/ pop.addAttribute(Constants.INSTANCE.FactType(), types); final TextBox binding = new BindingTextBox(); binding.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { binding.setText(binding.getText().replace(" ", "")); } }); pop.addAttribute(Constants.INSTANCE.Binding(), binding); //Patterns can be negated, i.e. "not Pattern(...)" final CheckBox chkNegated = new CheckBox(); chkNegated.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { boolean isPatternNegated = chkNegated.getValue(); binding.setEnabled(!isPatternNegated); } }); pop.addAttribute(Constants.INSTANCE.negatePattern(), chkNegated); Button ok = new Button(Constants.INSTANCE.OK()); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { boolean isPatternNegated = chkNegated.getValue(); String ft = types.getItemText(types.getSelectedIndex()); String fn = isPatternNegated ? "" : binding.getText(); if (!isPatternNegated) { if (fn.equals("")) { Window.alert(Constants.INSTANCE.PleaseEnterANameForFact()); return; } else if (fn.equals(ft)) { Window.alert(Constants.INSTANCE.PleaseEnterANameThatIsNotTheSameAsTheFactType()); return; } else if (!isBindingUnique(fn)) { Window.alert(Constants.INSTANCE.PleaseEnterANameThatIsNotAlreadyUsedByAnotherPattern()); return; } } //Create new pattern editingPattern = new Pattern52(); editingPattern.setFactType(ft); editingPattern.setBoundName(fn); editingPattern.setNegated(isPatternNegated); //Clear Field and Operator when pattern changes editingCol.setFactField(null); editingCol.setOperator(null); //Set-up UI entryPointName.setText(editingPattern.getEntryPointName()); cwo.selectItem(editingPattern.getWindow().getOperator()); makeLimitedValueWidget(); makeDefaultValueWidget(); displayCEPOperators(); doPatternLabel(); doValueList(); doCalculationType(); doOperatorLabel(); pop.hide(); } }); pop.addAttribute("", ok); pop.show(); }
From source file:org.drools.guvnor.client.decisiontable.DTCellValueWidgetFactory.java
License:Apache License
/** * An editor for whether the column is hidden or not * //from w w w . j av a 2 s .co m * @param col * @return */ public static CheckBox getHideColumnIndicator(final DTColumnConfig52 col) { final CheckBox chkHide = new CheckBox(); chkHide.setValue(col.isHideColumn()); chkHide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { col.setHideColumn(chkHide.getValue()); } }); return chkHide; }
From source file:org.drools.guvnor.client.decisiontable.GuidedDecisionTableWidget.java
License:Apache License
private Widget newColumn() { AddButton addButton = new AddButton(); addButton.setText(Constants.INSTANCE.NewColumn()); addButton.setTitle(Constants.INSTANCE.AddNewColumn()); addButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { final FormStylePopup pop = new FormStylePopup(); pop.setModal(false);/* w ww .j a v a 2 s . co m*/ //List of basic column types final ListBox choice = new ListBox(); choice.setVisibleItemCount(NewColumnTypes.values().length); choice.addItem(Constants.INSTANCE.AddNewMetadataOrAttributeColumn(), NewColumnTypes.METADATA_ATTRIBUTE.name()); choice.addItem(SECTION_SEPARATOR); choice.addItem(Constants.INSTANCE.AddNewConditionSimpleColumn(), NewColumnTypes.CONDITION_SIMPLE.name()); choice.addItem(SECTION_SEPARATOR); choice.addItem(Constants.INSTANCE.SetTheValueOfAField(), NewColumnTypes.ACTION_UPDATE_FACT_FIELD.name()); choice.addItem(Constants.INSTANCE.SetTheValueOfAFieldOnANewFact(), NewColumnTypes.ACTION_INSERT_FACT_FIELD.name()); choice.addItem(Constants.INSTANCE.RetractAnExistingFact(), NewColumnTypes.ACTION_RETRACT_FACT.name()); //Checkbox to include Advanced Action types final CheckBox chkIncludeAdvancedOptions = new CheckBox( SafeHtmlUtils.fromString(Constants.INSTANCE.IncludeAdvancedOptions())); chkIncludeAdvancedOptions.setValue(false); chkIncludeAdvancedOptions.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (chkIncludeAdvancedOptions.getValue()) { addItem(3, Constants.INSTANCE.AddNewConditionBRLFragment(), NewColumnTypes.CONDITION_BRL_FRAGMENT.name()); addItem(Constants.INSTANCE.WorkItemAction(), NewColumnTypes.ACTION_WORKITEM.name()); addItem(Constants.INSTANCE.WorkItemActionSetField(), NewColumnTypes.ACTION_WORKITEM_UPDATE_FACT_FIELD.name()); addItem(Constants.INSTANCE.WorkItemActionInsertFact(), NewColumnTypes.ACTION_WORKITEM_INSERT_FACT_FIELD.name()); addItem(Constants.INSTANCE.AddNewActionBRLFragment(), NewColumnTypes.ACTION_BRL_FRAGMENT.name()); } else { removeItem(NewColumnTypes.CONDITION_BRL_FRAGMENT.name()); removeItem(NewColumnTypes.ACTION_WORKITEM.name()); removeItem(NewColumnTypes.ACTION_WORKITEM_UPDATE_FACT_FIELD.name()); removeItem(NewColumnTypes.ACTION_WORKITEM_INSERT_FACT_FIELD.name()); removeItem(NewColumnTypes.ACTION_BRL_FRAGMENT.name()); } pop.center(); } private void addItem(int index, String item, String value) { for (int itemIndex = 0; itemIndex < choice.getItemCount(); itemIndex++) { if (choice.getValue(itemIndex).equals(value)) { return; } } choice.insertItem(item, value, index); } private void addItem(String item, String value) { for (int itemIndex = 0; itemIndex < choice.getItemCount(); itemIndex++) { if (choice.getValue(itemIndex).equals(value)) { return; } } choice.addItem(item, value); } private void removeItem(String value) { for (int itemIndex = 0; itemIndex < choice.getItemCount(); itemIndex++) { if (choice.getValue(itemIndex).equals(value)) { choice.removeItem(itemIndex); break; } } } }); //OK button to create column final Button ok = new Button(Constants.INSTANCE.OK()); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { String s = choice.getValue(choice.getSelectedIndex()); if (s.equals(NewColumnTypes.METADATA_ATTRIBUTE.name())) { showMetaDataAndAttribute(); } else if (s.equals(NewColumnTypes.CONDITION_SIMPLE.name())) { showConditionSimple(); } else if (s.equals(NewColumnTypes.CONDITION_BRL_FRAGMENT.name())) { showConditionBRLFragment(); } else if (s.equals(NewColumnTypes.ACTION_UPDATE_FACT_FIELD.name())) { showActionSet(); } else if (s.equals(NewColumnTypes.ACTION_INSERT_FACT_FIELD.name())) { showActionInsert(); } else if (s.equals(NewColumnTypes.ACTION_RETRACT_FACT.name())) { showActionRetract(); } else if (s.equals(NewColumnTypes.ACTION_WORKITEM.name())) { showActionWorkItemAction(); } else if (s.equals(NewColumnTypes.ACTION_WORKITEM_UPDATE_FACT_FIELD.name())) { showActionWorkItemActionSet(); } else if (s.equals(NewColumnTypes.ACTION_WORKITEM_INSERT_FACT_FIELD.name())) { showActionWorkItemActionInsert(); } else if (s.equals(NewColumnTypes.ACTION_BRL_FRAGMENT.name())) { showActionBRLFragment(); } pop.hide(); } private void showMetaDataAndAttribute() { // show choice of attributes Image image = new Image(DroolsGuvnorImageResources.INSTANCE.config()); image.setAltText(Constants.INSTANCE.Config()); final FormStylePopup pop = new FormStylePopup(image, Constants.INSTANCE.AddAnOptionToTheRule()); final ListBox list = RuleAttributeWidget.getAttributeList(); //This attribute is only used for Decision Tables list.addItem(GuidedDecisionTable52.NEGATE_RULE_ATTR); // Remove any attributes already added for (AttributeCol52 col : guidedDecisionTable.getAttributeCols()) { for (int iItem = 0; iItem < list.getItemCount(); iItem++) { if (list.getItemText(iItem).equals(col.getAttribute())) { list.removeItem(iItem); break; } } } final Image addbutton = DroolsGuvnorImages.INSTANCE.NewItem(); final TextBox box = new TextBox(); box.setVisibleLength(15); list.setSelectedIndex(0); list.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { AttributeCol52 attr = new AttributeCol52(); attr.setAttribute(list.getItemText(list.getSelectedIndex())); dtable.addColumn(attr); refreshAttributeWidget(); pop.hide(); } }); addbutton.setTitle(Constants.INSTANCE.AddMetadataToTheRule()); addbutton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { String metadata = box.getText(); if (!isUnique(metadata)) { Window.alert( Constants.INSTANCE.ThatColumnNameIsAlreadyInUsePleasePickAnother()); return; } MetadataCol52 met = new MetadataCol52(); met.setHideColumn(true); met.setMetadata(metadata); dtable.addColumn(met); refreshAttributeWidget(); pop.hide(); } private boolean isUnique(String metadata) { for (MetadataCol52 mc : guidedDecisionTable.getMetadataCols()) { if (metadata.equals(mc.getMetadata())) { return false; } } return true; } }); DirtyableHorizontalPane horiz = new DirtyableHorizontalPane(); horiz.add(box); horiz.add(addbutton); pop.addAttribute(Constants.INSTANCE.Metadata1(), horiz); pop.addAttribute(Constants.INSTANCE.Attribute(), list); pop.show(); } private void showConditionSimple() { final ConditionCol52 column = makeNewConditionColumn(); ConditionPopup dialog = new ConditionPopup(getSCE(), guidedDecisionTable, new ConditionColumnCommand() { public void execute(Pattern52 pattern, ConditionCol52 column) { //Update UI dtable.addColumn(pattern, column); refreshConditionsWidget(); } }, column, true, isReadOnly); dialog.show(); } private void showConditionBRLFragment() { final BRLConditionColumn column = makeNewConditionBRLFragment(); switch (guidedDecisionTable.getTableFormat()) { case EXTENDED_ENTRY: BRLConditionColumnViewImpl popup = new BRLConditionColumnViewImpl(sce, guidedDecisionTable, true, asset, column, clientFactory, eventBus); popup.setPresenter(BRL_CONDITION_PRESENTER); popup.show(); break; case LIMITED_ENTRY: LimitedEntryBRLConditionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLConditionColumnViewImpl( sce, guidedDecisionTable, true, asset, (LimitedEntryBRLConditionColumn) column, clientFactory, eventBus); limtedEntryPopup.setPresenter(LIMITED_ENTRY_BRL_CONDITION_PRESENTER); limtedEntryPopup.show(); break; } } private void showActionInsert() { final ActionInsertFactCol52 afc = makeNewActionInsertColumn(); ActionInsertFactPopup ins = new ActionInsertFactPopup(getSCE(), guidedDecisionTable, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, afc, true, isReadOnly); ins.show(); } private void showActionSet() { final ActionSetFieldCol52 afc = makeNewActionSetColumn(); ActionSetFieldPopup set = new ActionSetFieldPopup(getSCE(), guidedDecisionTable, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, afc, true, isReadOnly); set.show(); } private void showActionRetract() { final ActionRetractFactCol52 arf = makeNewActionRetractFact(); ActionRetractFactPopup popup = new ActionRetractFactPopup(guidedDecisionTable, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, arf, true, isReadOnly); popup.show(); } private void showActionWorkItemAction() { final ActionWorkItemCol52 awi = makeNewActionWorkItem(); ActionWorkItemPopup popup = new ActionWorkItemPopup(clientFactory, packageUUID, guidedDecisionTable, GuidedDecisionTableWidget.this, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, awi, true, isReadOnly); popup.show(); } private void showActionWorkItemActionSet() { final ActionWorkItemSetFieldCol52 awisf = makeNewActionWorkItemSetField(); ActionWorkItemSetFieldPopup popup = new ActionWorkItemSetFieldPopup(getSCE(), guidedDecisionTable, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, awisf, true, isReadOnly); popup.show(); } private void showActionWorkItemActionInsert() { final ActionWorkItemInsertFactCol52 awiif = makeNewActionWorkItemInsertFact(); ActionWorkItemInsertFactPopup popup = new ActionWorkItemInsertFactPopup(getSCE(), guidedDecisionTable, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, awiif, true, isReadOnly); popup.show(); } private void showActionBRLFragment() { final BRLActionColumn column = makeNewActionBRLFragment(); switch (guidedDecisionTable.getTableFormat()) { case EXTENDED_ENTRY: BRLActionColumnViewImpl popup = new BRLActionColumnViewImpl(sce, guidedDecisionTable, true, asset, column, clientFactory, eventBus); popup.setPresenter(BRL_ACTION_PRESENTER); popup.show(); break; case LIMITED_ENTRY: LimitedEntryBRLActionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLActionColumnViewImpl( sce, guidedDecisionTable, true, asset, (LimitedEntryBRLActionColumn) column, clientFactory, eventBus); limtedEntryPopup.setPresenter(LIMITED_ENTRY_BRL_ACTION_PRESENTER); limtedEntryPopup.show(); break; } } private void newActionAdded(ActionCol52 column) { dtable.addColumn(column); refreshActionsWidget(); } }); //If a separator is clicked disable OK button choice.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int itemIndex = choice.getSelectedIndex(); if (itemIndex < 0) { return; } ok.setEnabled(!choice.getValue(itemIndex).equals(SECTION_SEPARATOR)); } }); pop.setTitle(Constants.INSTANCE.AddNewColumn()); pop.addAttribute(Constants.INSTANCE.TypeOfColumn(), choice); pop.addAttribute("", chkIncludeAdvancedOptions); pop.addAttribute("", ok); pop.show(); } private ConditionCol52 makeNewConditionColumn() { switch (guidedDecisionTable.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryConditionCol52(); default: return new ConditionCol52(); } } private ActionInsertFactCol52 makeNewActionInsertColumn() { switch (guidedDecisionTable.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryActionInsertFactCol52(); default: return new ActionInsertFactCol52(); } } private ActionSetFieldCol52 makeNewActionSetColumn() { switch (guidedDecisionTable.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryActionSetFieldCol52(); default: return new ActionSetFieldCol52(); } } private ActionRetractFactCol52 makeNewActionRetractFact() { switch (guidedDecisionTable.getTableFormat()) { case LIMITED_ENTRY: LimitedEntryActionRetractFactCol52 ler = new LimitedEntryActionRetractFactCol52(); ler.setValue(new DTCellValue52("")); return ler; default: return new ActionRetractFactCol52(); } } private ActionWorkItemCol52 makeNewActionWorkItem() { //WorkItems are defined within the column and always boolean (i.e. Limited Entry) in the table return new ActionWorkItemCol52(); } private ActionWorkItemSetFieldCol52 makeNewActionWorkItemSetField() { //Actions setting Field Values from Work Item Result Parameters are always boolean (i.e. Limited Entry) in the table return new ActionWorkItemSetFieldCol52(); } private ActionWorkItemInsertFactCol52 makeNewActionWorkItemInsertFact() { //Actions setting Field Values from Work Item Result Parameters are always boolean (i.e. Limited Entry) in the table return new ActionWorkItemInsertFactCol52(); } private BRLActionColumn makeNewActionBRLFragment() { switch (guidedDecisionTable.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryBRLActionColumn(); default: return new BRLActionColumn(); } } private BRLConditionColumn makeNewConditionBRLFragment() { switch (guidedDecisionTable.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryBRLConditionColumn(); default: return new BRLConditionColumn(); } } }); return addButton; }