List of usage examples for com.google.gwt.user.client.ui CheckBox CheckBox
public CheckBox()
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);/*from w w w . j ava 2 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 v a 2 s. com 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 va 2s .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 ww . j a v a2 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.editor.QuickFindWidget.java
License:Apache License
public QuickFindWidget() { VerticalPanel container = new VerticalPanel(); VerticalPanel criteria = new VerticalPanel(); FormStyleLayout layout = new FormStyleLayout(images.systemSearch(), ""); searchBox = new SuggestBox(new SuggestOracle() { public void requestSuggestions(Request r, Callback cb) { loadShortList(r.getQuery(), archiveBox.getValue(), caseSensitiveBox.getValue(), r, cb); }// w w w.j a va2 s.co m }); HorizontalPanel srch = new HorizontalPanel(); final SimplePanel resultsP = new SimplePanel(); final ClickHandler cl = new ClickHandler() { public void onClick(ClickEvent event) { resultsP.clear(); /* QueryPagedTable table = new QueryPagedTable( searchBox.getValue(), archiveBox.getValue(), caseSensitiveBox.getValue(), clientFactory ); resultsP.add( table );*/ } }; searchBox.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { cl.onClick(null); } } }); srch.add(searchBox); layout.addAttribute(constants.FindItemsWithANameMatching(), srch); archiveBox = new CheckBox(); archiveBox.setValue(false); layout.addAttribute(constants.IncludeArchivedAssetsInResults(), archiveBox); caseSensitiveBox = new CheckBox(); caseSensitiveBox.setValue(false); layout.addAttribute(constants.IsSearchCaseSensitive(), caseSensitiveBox); Button go = new Button(constants.Search()); go.addClickHandler(cl); layout.addAttribute("", go); HorizontalPanel searchTitle = new HorizontalPanel(); searchTitle.add(new Image(images.information())); searchTitle.add(new Label(constants.EnterSearchString())); FlexTable listPanel = new FlexTable(); listPanel.setWidget(0, 0, searchTitle); PrettyFormLayout pfl = new PrettyFormLayout(); pfl.startSection(); pfl.addRow(listPanel); pfl.endSection(); criteria.add(pfl); criteria.add(layout); container.add(criteria); container.add(resultsP); initWidget(container); }
From source file:org.drools.guvnor.client.explorer.navigation.admin.widget.RepoConfigManager.java
License:Apache License
public DecoratorPanel getDbTypePanel() { FlexTable layoutA = new FlexTable(); layoutA.setCellSpacing(6);/*from w w w. j av a 2 s.c om*/ FlexCellFormatter cellFormatter = layoutA.getFlexCellFormatter(); // Add a title to the form layoutA.setHTML(0, 0, "RDBMS Info"); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); layoutA.setHTML(1, 0, constants.SelectRdbmsType()); final ListBox databaseList = getDatabaseList(); databaseList.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { ListBox listBox = (ListBox) event.getSource(); int index = listBox.getSelectedIndex(); rdbmsConf.setDbType(listBox.getItemText(index)); layoutB.setHTML(0, 0, listBox.getItemText(index) + " Info"); layoutC.setHTML(0, 0, listBox.getItemText(index) + " Info"); repoDisplayArea.setVisible(false); saveRepoConfigForm.setVisible(false); } }); if (rdbmsConf.getDbType() == null || rdbmsConf.getDbType().length() < 1) { databaseList.setSelectedIndex(0); } else { for (int i = 0; i < databaseList.getItemCount(); i++) { if (rdbmsConf.getDbType().equals(databaseList.getItemText(i))) { databaseList.setSelectedIndex(i); break; } } } databaseList.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { rdbmsConf.setDbType(databaseList.getValue(databaseList.getSelectedIndex())); } }); layoutA.setWidget(1, 1, databaseList); layoutA.setHTML(2, 0, constants.UseJndi()); final CheckBox useJndi = new CheckBox(); useJndi.setChecked(rdbmsConf.isJndi()); useJndi.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { // do not change this to isEnabled..it will always return true. boolean checked = ((CheckBox) w.getSource()).getValue(); rdbmsConf.setJndi(checked); if (checked) { noJndiInfo.setVisible(false); jndiInfo.setVisible(true); } else { noJndiInfo.setVisible(true); jndiInfo.setVisible(false); } repoDisplayArea.setVisible(false); saveRepoConfigForm.setVisible(false); } }); layoutA.setWidget(2, 1, useJndi); Button continueButton = new Button("Continue"); continueButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent w) { if (databaseList.getSelectedIndex() == 0) { Window.alert(constants.PleaseSelectRdbmsType()); return; } if (!useJndi.getValue()) { jndiInfo.setVisible(false); } vPanel2.setVisible(true); } }); layoutA.setWidget(3, 1, continueButton); DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layoutA); return decPanel; }
From source file:org.drools.guvnor.client.moduleeditor.drools.PackageBuilderWidget.java
License:Apache License
public PackageBuilderWidget(final Module conf, ClientFactory clientFactory) { this.conf = conf; this.clientFactory = clientFactory; // UI above the results table FormStyleLayout layout = new FormStyleLayout(); final VerticalPanel container = new VerticalPanel(); final VerticalPanel buildResults = new VerticalPanel(); RadioButton wholePackageRadioButton = new RadioButton("action", Constants.INSTANCE.BuildWholePackage()); RadioButton builtInSelectorRadioButton = new RadioButton("action", Constants.INSTANCE.BuildPackageUsingBuiltInSelector()); RadioButton customSelectorRadioButton = new RadioButton("action", Constants.INSTANCE.BuildPackageUsingCustomSelector()); wholePackageRadioButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); buildMode = "buildWholePackage"; }// www .jav a 2 s. c o m }); builtInSelectorRadioButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(true); customSelectorLayout.setVisible(false); buildMode = "BuiltInSelector"; } }); customSelectorRadioButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(true); buildMode = "customSelector"; } }); VerticalPanel verticalPanel = new VerticalPanel(); HorizontalPanel wholePackageRadioButtonPanel = new HorizontalPanel(); wholePackageRadioButtonPanel.add(wholePackageRadioButton); wholePackageRadioButtonPanel.add( new InfoPopup(Constants.INSTANCE.BuildWholePackage(), Constants.INSTANCE.BuildWholePackageTip())); verticalPanel.add(wholePackageRadioButtonPanel); HorizontalPanel builtInSelectorRadioButtonPanel = new HorizontalPanel(); builtInSelectorRadioButtonPanel.add(builtInSelectorRadioButton); builtInSelectorRadioButtonPanel .add(new InfoPopup(Constants.INSTANCE.BuiltInSelector(), Constants.INSTANCE.BuiltInSelectorTip())); verticalPanel.add(builtInSelectorRadioButtonPanel); HorizontalPanel customSelectorRadioButtonPanel = new HorizontalPanel(); customSelectorRadioButtonPanel.add(customSelectorRadioButton); customSelectorRadioButtonPanel .add(new InfoPopup(Constants.INSTANCE.CustomSelector(), Constants.INSTANCE.SelectorTip())); verticalPanel.add(customSelectorRadioButtonPanel); layout.addAttribute("", verticalPanel); wholePackageRadioButton.setValue(true); buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); // Build whole package layout layout.addRow(buildWholePackageLayout); // Built-in selector layout builtInSelectorLayout.addRow( new HTML(" <i>" + Constants.INSTANCE.BuildPackageUsingFollowingAssets() + "</i>")); HorizontalPanel builtInSelectorStatusPanel = new HorizontalPanel(); final CheckBox enableStatusCheckBox = new CheckBox(); enableStatusCheckBox.setValue(false); builtInSelectorStatusPanel.add(enableStatusCheckBox); builtInSelectorStatusPanel.add(new HTML( " <i>" + Constants.INSTANCE.BuildPackageUsingBuiltInSelectorStatus() + " </i>")); final ListBox statusOperator = new ListBox(); String[] vals = new String[] { "=", "!=" }; for (int i = 0; i < vals.length; i++) { statusOperator.addItem(vals[i], vals[i]); } builtInSelectorStatusPanel.add(statusOperator); final TextBox statusValue = new TextBox(); statusValue.setTitle(Constants.INSTANCE.WildCardsSearchTip()); builtInSelectorStatusPanel.add(statusValue); builtInSelectorLayout.addRow(builtInSelectorStatusPanel); HorizontalPanel builtInSelectorCatPanel = new HorizontalPanel(); final CheckBox enableCategoryCheckBox = new CheckBox(); enableCategoryCheckBox.setValue(false); builtInSelectorCatPanel.add(enableCategoryCheckBox); builtInSelectorCatPanel.add( new HTML(" <i>" + Constants.INSTANCE.BuildPackageUsingBuiltInSelectorCat() + " </i>")); final ListBox catOperator = new ListBox(); String[] catVals = new String[] { "=", "!=" }; for (int i = 0; i < catVals.length; i++) { catOperator.addItem(catVals[i], catVals[i]); } builtInSelectorCatPanel.add(catOperator); final CategoryExplorerWidget catChooser = new CategoryExplorerWidget(new CategorySelectHandler() { public void selected(String selectedPath) { } }); ScrollPanel catScroll = new ScrollPanel(catChooser); catScroll.setAlwaysShowScrollBars(true); catScroll.setSize("300px", "130px"); builtInSelectorCatPanel.add(catScroll); builtInSelectorLayout.addRow(builtInSelectorCatPanel); layout.addRow(builtInSelectorLayout); // Custom selector layout customSelectorLayout.setVisible(false); HorizontalPanel customSelectorPanel = new HorizontalPanel(); customSelectorPanel.add(new HTML( " <i>" + Constants.INSTANCE.BuildPackageUsingCustomSelectorSelector() + " </i>")); // NON-NLS final ListBox customSelector = new ListBox(); customSelector.setTitle(Constants.INSTANCE.WildCardsSearchTip()); customSelectorPanel.add(customSelector); loadCustomSelectorList(customSelector); customSelectorLayout.addRow(customSelectorPanel); layout.addRow(customSelectorLayout); final Button b = new Button(Constants.INSTANCE.BuildPackage()); b.setTitle(Constants.INSTANCE.ThisWillValidateAndCompileAllTheAssetsInAPackage()); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { doBuild(buildResults, statusOperator.getValue(statusOperator.getSelectedIndex()), statusValue.getText(), enableStatusCheckBox.getValue(), catOperator.getValue(catOperator.getSelectedIndex()), catChooser.getSelectedPath(), enableCategoryCheckBox.getValue(), customSelector.getSelectedIndex() != -1 ? customSelector.getValue(customSelector.getSelectedIndex()) : null); } }); HorizontalPanel buildStuff = new HorizontalPanel(); buildStuff.add(b); layout.addAttribute(Constants.INSTANCE.BuildBinaryPackage(), buildStuff); layout.addRow(new HTML("<i><small>" + Constants.INSTANCE.BuildingPackageNote() + "</small></i>"));// NON-NLS container.add(layout); // The build results container.add(buildResults); // UI below the results table layout = new FormStyleLayout(); Button snap = new Button(Constants.INSTANCE.CreateSnapshotForDeployment()); snap.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showSnapshotDialog(conf.getName(), null); } }); layout.addAttribute(Constants.INSTANCE.TakeSnapshot(), snap); container.add(layout); initWidget(container); }
From source file:org.drools.guvnor.client.moduleeditor.soa.SOAServiceBuilderWidget.java
License:Apache License
public SOAServiceBuilderWidget(final Module conf, ClientFactory clientFactory) { this.conf = conf; this.clientFactory = clientFactory; // UI above the results table FormStyleLayout layout = new FormStyleLayout(); final VerticalPanel container = new VerticalPanel(); final VerticalPanel buildResults = new VerticalPanel(); RadioButton wholePackageRadioButton = new RadioButton("action", constants.BuildWholeService()); RadioButton builtInSelectorRadioButton = new RadioButton("action", constants.BuildServiceUsingBuiltInSelector()); RadioButton customSelectorRadioButton = new RadioButton("action", constants.BuildServiceUsingCustomSelector()); wholePackageRadioButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); buildMode = "buildWholePackage"; }//from w w w . j a v a 2s .c o m }); builtInSelectorRadioButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(true); customSelectorLayout.setVisible(false); buildMode = "BuiltInSelector"; } }); customSelectorRadioButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(true); buildMode = "customSelector"; } }); VerticalPanel verticalPanel = new VerticalPanel(); HorizontalPanel wholePackageRadioButtonPanel = new HorizontalPanel(); wholePackageRadioButtonPanel.add(wholePackageRadioButton); wholePackageRadioButtonPanel .add(new InfoPopup(constants.BuildWholeService(), constants.BuildWholeServiceTip())); verticalPanel.add(wholePackageRadioButtonPanel); HorizontalPanel builtInSelectorRadioButtonPanel = new HorizontalPanel(); builtInSelectorRadioButtonPanel.add(builtInSelectorRadioButton); builtInSelectorRadioButtonPanel .add(new InfoPopup(constants.BuiltInServiceSelectorTip(), constants.BuiltInServiceSelectorTip())); verticalPanel.add(builtInSelectorRadioButtonPanel); HorizontalPanel customSelectorRadioButtonPanel = new HorizontalPanel(); customSelectorRadioButtonPanel.add(customSelectorRadioButton); customSelectorRadioButtonPanel .add(new InfoPopup(constants.CustomSelector(), constants.ServiceSelectorTip())); verticalPanel.add(customSelectorRadioButtonPanel); layout.addAttribute("", verticalPanel); wholePackageRadioButton.setValue(true); buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); // Build whole package layout layout.addRow(buildWholePackageLayout); // Built-in selector layout builtInSelectorLayout .addRow(new HTML(" <i>" + constants.BuildPackageUsingFollowingAssets() + "</i>")); HorizontalPanel builtInSelectorStatusPanel = new HorizontalPanel(); final CheckBox enableStatusCheckBox = new CheckBox(); enableStatusCheckBox.setValue(false); builtInSelectorStatusPanel.add(enableStatusCheckBox); builtInSelectorStatusPanel .add(new HTML(" <i>" + constants.BuildPackageUsingBuiltInSelectorStatus() + " </i>")); final ListBox statusOperator = new ListBox(); String[] vals = new String[] { "=", "!=" }; for (int i = 0; i < vals.length; i++) { statusOperator.addItem(vals[i], vals[i]); } builtInSelectorStatusPanel.add(statusOperator); final TextBox statusValue = new TextBox(); statusValue.setTitle(constants.WildCardsSearchTip()); builtInSelectorStatusPanel.add(statusValue); builtInSelectorLayout.addRow(builtInSelectorStatusPanel); HorizontalPanel builtInSelectorCatPanel = new HorizontalPanel(); final CheckBox enableCategoryCheckBox = new CheckBox(); enableCategoryCheckBox.setValue(false); builtInSelectorCatPanel.add(enableCategoryCheckBox); builtInSelectorCatPanel .add(new HTML(" <i>" + constants.BuildPackageUsingBuiltInSelectorCat() + " </i>")); final ListBox catOperator = new ListBox(); String[] catVals = new String[] { "=", "!=" }; for (int i = 0; i < catVals.length; i++) { catOperator.addItem(catVals[i], catVals[i]); } builtInSelectorCatPanel.add(catOperator); final CategoryExplorerWidget catChooser = new CategoryExplorerWidget(new CategorySelectHandler() { public void selected(String selectedPath) { } }); ScrollPanel catScroll = new ScrollPanel(catChooser); catScroll.setAlwaysShowScrollBars(true); catScroll.setSize("300px", "130px"); builtInSelectorCatPanel.add(catScroll); builtInSelectorLayout.addRow(builtInSelectorCatPanel); layout.addRow(builtInSelectorLayout); // Custom selector layout customSelectorLayout.setVisible(false); HorizontalPanel customSelectorPanel = new HorizontalPanel(); customSelectorPanel .add(new HTML(" <i>" + constants.BuildPackageUsingCustomSelectorSelector() + " </i>")); // NON-NLS final ListBox customSelector = new ListBox(); customSelector.setTitle(constants.WildCardsSearchTip()); customSelectorPanel.add(customSelector); loadCustomSelectorList(customSelector); customSelectorLayout.addRow(customSelectorPanel); layout.addRow(customSelectorLayout); final Button b = new Button(constants.BuildService()); b.setTitle(constants.ThisWillValidateAndCompileAllTheAssetsInAPackage()); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { doBuild(buildResults, statusOperator.getValue(statusOperator.getSelectedIndex()), statusValue.getText(), enableStatusCheckBox.getValue(), catOperator.getValue(catOperator.getSelectedIndex()), catChooser.getSelectedPath(), enableCategoryCheckBox.getValue(), customSelector.getSelectedIndex() != -1 ? customSelector.getValue(customSelector.getSelectedIndex()) : null); } }); HorizontalPanel buildStuff = new HorizontalPanel(); buildStuff.add(b); layout.addAttribute(constants.BuildBinaryService(), buildStuff); layout.addRow(new HTML("<i><small>" + constants.BuildingServiceNote() + "</small></i>"));// NON-NLS container.add(layout); // The build results container.add(buildResults); initWidget(container); }
From source file:org.drools.guvnor.client.ruleeditor.MetaDataWidget.java
License:Apache License
/** * This binds a field, and returns a check box editor for it. * * @param bind Interface to bind to./*from w w w. j a v a 2 s . c om*/ * @param toolTip tool tip. * @return */ private Widget editableBoolean(final FieldBooleanBinding bind, String toolTip) { if (!readOnly) { final CheckBox box = new CheckBox(); box.setTitle(toolTip); box.setChecked(bind.getValue()); ClickListener listener = new ClickListener() { public void onClick(Widget w) { boolean b = box.isChecked(); bind.setValue(b); } }; box.addClickListener(listener); return box; } else { final CheckBox box = new CheckBox(); box.setChecked(bind.getValue()); box.setEnabled(false); return box; } }
From source file:org.drools.guvnor.client.ruleeditor.MetaDataWidgetNew.java
License:Apache License
/** * This binds a field, and returns a check box editor for it. * /* ww w . jav a 2s.c om*/ * @param bind * Interface to bind to. * @param toolTip * tool tip. * @return */ private Widget editableBoolean(final FieldBooleanBinding bind, String toolTip) { if (!readOnly) { final CheckBox box = new CheckBox(); box.setTitle(toolTip); box.setValue(bind.getValue()); ClickHandler listener = new ClickHandler() { public void onClick(ClickEvent w) { boolean b = box.getValue(); bind.setValue(b); } }; box.addClickHandler(listener); return box; } else { final CheckBox box = new CheckBox(); box.setValue(bind.getValue()); box.setEnabled(false); return box; } }