List of usage examples for com.google.gwt.user.client.ui CheckBox setValue
@Override public void setValue(Boolean value)
From source file:org.kie.guvnor.guided.dtable.client.widget.ActionSetFieldPopup.java
License:Apache License
private Widget doUpdate() { HorizontalPanel hp = new HorizontalPanel(); final CheckBox cb = new CheckBox(); cb.setValue(editingCol.isUpdate()); cb.setText(""); cb.setEnabled(!isReadOnly);//w ww . ja v a2s.co m if (!isReadOnly) { cb.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { if (oracle.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.kie.guvnor.guided.dtable.client.widget.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);/*from www .j av a2s .c o 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 final Image image = ImageResources508.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 : model.getAttributeCols()) { for (int iItem = 0; iItem < list.getItemCount(); iItem++) { if (list.getItemText(iItem).equals(col.getAttribute())) { list.removeItem(iItem); break; } } } final Image addbutton = ImageResources508.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 : model.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(oracle, model, 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 (model.getTableFormat()) { case EXTENDED_ENTRY: BRLConditionColumnViewImpl popup = new BRLConditionColumnViewImpl(path, oracle, model, column, eventBus, true, isReadOnly); popup.setPresenter(BRL_CONDITION_PRESENTER); popup.show(); break; case LIMITED_ENTRY: LimitedEntryBRLConditionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLConditionColumnViewImpl( path, oracle, model, (LimitedEntryBRLConditionColumn) column, eventBus, true, isReadOnly); limtedEntryPopup.setPresenter(LIMITED_ENTRY_BRL_CONDITION_PRESENTER); limtedEntryPopup.show(); break; } } private void showActionInsert() { final ActionInsertFactCol52 afc = makeNewActionInsertColumn(); ActionInsertFactPopup ins = new ActionInsertFactPopup(oracle, model, 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(oracle, model, 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(model, 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(path, model, 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(oracle, model, 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(oracle, model, new GenericColumnCommand() { public void execute(DTColumnConfig52 column) { newActionAdded((ActionCol52) column); } }, awiif, true, isReadOnly); popup.show(); } private void showActionBRLFragment() { final BRLActionColumn column = makeNewActionBRLFragment(); switch (model.getTableFormat()) { case EXTENDED_ENTRY: BRLActionColumnViewImpl popup = new BRLActionColumnViewImpl(path, oracle, model, column, eventBus, true, isReadOnly); popup.setPresenter(BRL_ACTION_PRESENTER); popup.show(); break; case LIMITED_ENTRY: LimitedEntryBRLActionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLActionColumnViewImpl( path, oracle, model, (LimitedEntryBRLActionColumn) column, eventBus, true, isReadOnly); 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 (model.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryConditionCol52(); default: return new ConditionCol52(); } } private ActionInsertFactCol52 makeNewActionInsertColumn() { switch (model.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryActionInsertFactCol52(); default: return new ActionInsertFactCol52(); } } private ActionSetFieldCol52 makeNewActionSetColumn() { switch (model.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryActionSetFieldCol52(); default: return new ActionSetFieldCol52(); } } private ActionRetractFactCol52 makeNewActionRetractFact() { switch (model.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 (model.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryBRLActionColumn(); default: return new BRLActionColumn(); } } private BRLConditionColumn makeNewConditionBRLFragment() { switch (model.getTableFormat()) { case LIMITED_ENTRY: return new LimitedEntryBRLConditionColumn(); default: return new BRLConditionColumn(); } } }); return addButton; }
From source file:org.kie.guvnor.guided.dtable.client.widget.GuidedDecisionTableWidget.java
License:Apache License
private void refreshAttributeWidget() { this.attributeConfigWidget.clear(); if (model.getMetadataCols().size() > 0) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.Metadata1())); attributeConfigWidget.add(hp);/*from w ww . ja v a2s. c o m*/ } for (MetadataCol52 atc : model.getMetadataCols()) { HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(new HTML(" ")); if (!isReadOnly) { hp.add(removeMeta(atc)); } final SmallLabel label = makeColumnLabel(atc); hp.add(label); final MetadataCol52 at = atc; final CheckBox hide = new CheckBox(Constants.INSTANCE.HideThisColumn()); hide.setStyleName("form-field"); hide.setValue(atc.isHideColumn()); hide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setHideColumn(hide.getValue()); dtable.setColumnVisibility(at, !at.isHideColumn()); setColumnLabelStyleWhenHidden(label, hide.getValue()); } }); hp.add(new HTML(" ")); hp.add(hide); attributeConfigWidget.add(hp); } if (model.getAttributeCols().size() > 0) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.Attributes())); attributeConfigWidget.add(hp); } for (AttributeCol52 atc : model.getAttributeCols()) { final AttributeCol52 at = atc; HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(new HTML(" ")); if (!isReadOnly) { hp.add(removeAttr(at)); } final SmallLabel label = makeColumnLabel(atc); hp.add(label); final TextBox defaultValue = new TextBox(); final DTCellValue52 dcv = at.getDefaultValue(); defaultValue.setStyleName("form-field"); defaultValue.setText((dcv == null ? "" : dcv.getStringValue())); defaultValue.setEnabled(!isReadOnly); defaultValue.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { at.setDefaultValue(new DTCellValue52(defaultValue.getText())); } }); if (at.getAttribute().equals(RuleAttributeWidget.SALIENCE_ATTR)) { hp.add(new HTML(" ")); final CheckBox useRowNumber = new CheckBox(Constants.INSTANCE.UseRowNumber()); useRowNumber.setStyleName("form-field"); useRowNumber.setValue(at.isUseRowNumber()); useRowNumber.setEnabled(!isReadOnly); hp.add(useRowNumber); hp.add(new SmallLabel("(")); final CheckBox reverseOrder = new CheckBox(Constants.INSTANCE.ReverseOrder()); reverseOrder.setStyleName("form-field"); reverseOrder.setValue(at.isReverseOrder()); reverseOrder.setEnabled(at.isUseRowNumber() && !isReadOnly); useRowNumber.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setUseRowNumber(useRowNumber.getValue()); reverseOrder.setEnabled(useRowNumber.getValue()); dtable.updateSystemControlledColumnValues(); } }); reverseOrder.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setReverseOrder(reverseOrder.getValue()); dtable.updateSystemControlledColumnValues(); } }); hp.add(reverseOrder); hp.add(new SmallLabel(")")); } hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.DefaultValue())); hp.add(defaultValue); final CheckBox hide = new CheckBox(Constants.INSTANCE.HideThisColumn()); hide.setStyleName("form-field"); hide.setValue(at.isHideColumn()); hide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setHideColumn(hide.getValue()); dtable.setColumnVisibility(at, !at.isHideColumn()); setColumnLabelStyleWhenHidden(label, hide.getValue()); } }); hp.add(new HTML(" ")); hp.add(hide); attributeConfigWidget.add(hp); setupColumnsNote(); } }
From source file:org.kie.guvnor.guided.rule.client.editor.RuleAttributeWidget.java
License:Apache License
private Widget checkBoxEditor(final RuleAttribute at, final boolean isReadOnly) { final CheckBox box = new CheckBox(); box.setEnabled(!isReadOnly);//from w ww .jav a2 s.c o m if (at.getValue() == null) { box.setValue(true); at.setValue(TRUE_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; }
From source file:org.kie.guvnor.guided.rule.client.editor.RuleModellerActionSelectorPopup.java
License:Apache License
@Override public Widget getContent() { if (position == null) { positionCbo.addItem(Constants.INSTANCE.Bottom(), String.valueOf(this.model.rhs.length)); positionCbo.addItem(Constants.INSTANCE.Top(), "0"); for (int i = 1; i < model.rhs.length; i++) { positionCbo.addItem(Constants.INSTANCE.Line0(i), String.valueOf(i)); }/*from w ww . j a v a 2 s. c om*/ } else { //if position is fixed, we just add one element to the drop down. positionCbo.addItem(String.valueOf(position)); positionCbo.setSelectedIndex(0); } if (completions.getDSLConditions().size() == 0 && completions.getFactTypes().length == 0) { layoutPanel.addRow(new HTML("<div class='highlight'>" + Constants.INSTANCE.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(Constants.INSTANCE.PositionColon())); hp0.add(positionCbo); hp0.add(new InfoPopup(Constants.INSTANCE.PositionColon(), Constants.INSTANCE.ActionPositionExplanation())); layoutPanel.addRow(hp0); } choices = makeChoicesListBox(); choicesPanel.add(choices); layoutPanel.addRow(choicesPanel); HorizontalPanel hp = new HorizontalPanel(); Button ok = new Button(Constants.INSTANCE.OK()); hp.add(ok); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { selectSomething(); } }); Button cancel = new Button(Constants.INSTANCE.Cancel()); hp.add(cancel); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); CheckBox chkOnlyDisplayDSLConditions = new CheckBox(); chkOnlyDisplayDSLConditions.setText(Constants.INSTANCE.OnlyDisplayDSLActions()); chkOnlyDisplayDSLConditions.setValue(bOnlyShowDSLConditions); chkOnlyDisplayDSLConditions.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { bOnlyShowDSLConditions = event.getValue(); choicesPanel.setWidget(makeChoicesListBox()); } }); layoutPanel.addRow(chkOnlyDisplayDSLConditions); layoutPanel.addRow(hp); this.setAfterShow(new Command() { public void execute() { choices.setFocus(true); } }); return layoutPanel; }
From source file:org.kie.guvnor.guided.rule.client.editor.RuleModellerConditionSelectorPopup.java
License:Apache License
@Override public Widget getContent() { if (position == null) { positionCbo.addItem(Constants.INSTANCE.Bottom(), String.valueOf(this.model.lhs.length)); positionCbo.addItem(Constants.INSTANCE.Top(), "0"); for (int i = 1; i < model.lhs.length; i++) { positionCbo.addItem(Constants.INSTANCE.Line0(i), String.valueOf(i)); }//from w w w. jav a 2 s. c o m } else { //if position is fixed, we just add one element to the drop down. positionCbo.addItem(String.valueOf(position)); positionCbo.setSelectedIndex(0); } if (completions.getDSLConditions().size() == 0 && completions.getFactTypes().length == 0) { layoutPanel.addRow(new HTML("<div class='highlight'>" + Constants.INSTANCE.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(Constants.INSTANCE.PositionColon())); hp0.add(positionCbo); hp0.add(new InfoPopup(Constants.INSTANCE.PositionColon(), Constants.INSTANCE.ConditionPositionExplanation())); layoutPanel.addRow(hp0); } choices = makeChoicesListBox(); choicesPanel.add(choices); layoutPanel.addRow(choicesPanel); HorizontalPanel hp = new HorizontalPanel(); Button ok = new Button(Constants.INSTANCE.OK()); hp.add(ok); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { selectSomething(); } }); Button cancel = new Button(Constants.INSTANCE.Cancel()); hp.add(cancel); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); CheckBox chkOnlyDisplayDSLConditions = new CheckBox(); chkOnlyDisplayDSLConditions.setText(Constants.INSTANCE.OnlyDisplayDSLConditions()); chkOnlyDisplayDSLConditions.setValue(bOnlyShowDSLConditions); chkOnlyDisplayDSLConditions.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { bOnlyShowDSLConditions = event.getValue(); choicesPanel.setWidget(makeChoicesListBox()); } }); layoutPanel.addRow(chkOnlyDisplayDSLConditions); layoutPanel.addRow(hp); this.setAfterShow(new Command() { public void execute() { choices.setFocus(true); } }); return layoutPanel; }
From source file:org.kie.guvnor.metadata.client.widget.MetadataWidget.java
License:Apache License
/** * This binds a field, and returns a check box editor for it. * @param bind Interface to bind to.// ww w . java 2s . c o m * @param toolTip tool tip. * @return */ private Widget editableBoolean(final FieldBooleanBinding bind, final String toolTip) { if (!readOnly) { final CheckBox box = new CheckBox(); box.setTitle(toolTip); box.setValue(bind.getValue()); box.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { boolean b = box.getValue(); bind.setValue(b); } }); return box; } else { final CheckBox box = new CheckBox(); box.setValue(bind.getValue()); box.setEnabled(false); return box; } }
From source file:org.nsesa.editor.gwt.amendment.client.ui.document.amendments.AmendmentsPanelViewImpl.java
License:EUPL
/** * Mark as selected the check boxes associated to the given id-s * * @param ids A list of id-s to identify the amendment controllers */// w w w.j a v a2 s. c o m @Override public void selectAmendmentControllers(List<String> ids) { // deselect all for (Map.Entry<String, CheckBox> entry : checkBoxes.entrySet()) { entry.getValue().setValue(false); } for (String id : ids) { CheckBox checkBox = checkBoxes.get(id); if (checkBox != null) { checkBox.setValue(true); } } }
From source file:org.onebusaway.webapp.gwt.oba_application.view.ResultsFilterPresenter.java
License:Apache License
private void buildMinimizedWidget() { _widget.add(new SpanWidget("Categories:", "ResultsFilter-Label")); for (int i = 0; i < Math.min(3, _categories.size()); i++) { SpanPanel panel = new SpanPanel(); final String categoryName = _categories.get(i); final CheckBox box = new CheckBox(); box.addStyleName(_css.ResultsFilterButton()); box.setText(categoryName);//from ww w . ja v a 2 s. co m box.setValue(_activeCategories.contains(categoryName)); box.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { boolean update = false; if (box.getValue()) update = _activeCategories.add(categoryName); else update = _activeCategories.remove(categoryName); if (update) { refreshFilter(); } } }); panel.add(box); _widget.add(panel); } }
From source file:org.onebusaway.webapp.gwt.oba_application.view.ResultsFilterPresenter.java
License:Apache License
private void buildMaxmizedWidget() { _widget.add(new SpanWidget("Categories:", "ResultsFilter-Label")); for (int i = 0; i < Math.min(3, _categories.size()); i++) { SpanPanel panel = new SpanPanel(); final String categoryName = _categories.get(i); final CheckBox box = new CheckBox(); box.addStyleName(_css.ResultsFilterButton()); box.setText(categoryName);/*from w w w.j av a 2 s .c o m*/ box.setValue(_activeCategories.contains(categoryName)); box.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { boolean update = false; if (box.getValue()) update = _activeCategories.add(categoryName); else update = _activeCategories.remove(categoryName); if (update) { refreshFilter(); } } }); panel.add(box); _widget.add(panel); } }