本文整理汇总了Java中com.google.gwt.user.client.ui.CheckBox.addClickHandler方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.addClickHandler方法的具体用法?Java CheckBox.addClickHandler怎么用?Java CheckBox.addClickHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.CheckBox
的用法示例。
在下文中一共展示了CheckBox.addClickHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FacetPanel
import com.google.gwt.user.client.ui.CheckBox; //导入方法依赖的package包/类
public FacetPanel(FacetSerializable facet) {
List<FacetMember> members = facet.getMembers();
for ( Iterator memberIt = members.iterator(); memberIt.hasNext(); ) {
FacetMember member = (FacetMember) memberIt.next();
String name = member.getName();
int count = member.getCount();
CheckBox check = new CheckBox(name+" ("+count+")");
check.setFormValue(facet.getName());
check.setName(name);
check.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent click) {
CheckBox source = (CheckBox) click.getSource();
eventBus.fireEventFromSource(new FacetChangeEvent(), source);
}
});
panel.add(check);
}
mainPanel.add(panel);
initWidget(mainPanel);
}
示例2: createUI
import com.google.gwt.user.client.ui.CheckBox; //导入方法依赖的package包/类
private void createUI(final boolean isMandatory, final CheckBox checkBox, final Node newNode, final TreeItem childTree) {
if (newNode.getParent().getLabel().getKey().equals("BatchClassModules")
|| newNode.getLabel().getKey().equals("BatchClassModules")) {
checkBox.setEnabled(Boolean.FALSE);
checkBox.setValue(Boolean.TRUE);
newNode.getLabel().setMandatory(Boolean.TRUE);
} else {
if (isMandatory) {
checkBox.setEnabled(Boolean.TRUE);
checkBox.setValue(Boolean.FALSE);
} else {
if (importExisting.getValue().equalsIgnoreCase(TRUE)) {
checkBox.setEnabled(Boolean.TRUE);
checkBox.setValue(Boolean.FALSE);
newNode.getLabel().setMandatory(Boolean.FALSE);
} else if (importExisting.getValue().equalsIgnoreCase(FALSE)) {
checkBox.setEnabled(Boolean.FALSE);
checkBox.setValue(Boolean.TRUE);
newNode.getLabel().setMandatory(Boolean.TRUE);
}
}
if (checkBox != null && checkBox.isEnabled()) {
checkBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean checked = ((CheckBox) event.getSource()).getValue();
newNode.getLabel().setMandatory(checked);
setParentItemsUI(childTree.getParentItem(), checked, newNode);
setChildItemsUI(childTree, checked, newNode);
}
});
}
}
}
示例3: addNotifyButton
import com.google.gwt.user.client.ui.CheckBox; //导入方法依赖的package包/类
protected void addNotifyButton(
final ProjectWatchInfo.Type type, ProjectWatchInfo info, int row, int col) {
final CheckBox cbox = new CheckBox();
cbox.addClickHandler(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final Boolean oldVal = info.notify(type);
info.notify(type, cbox.getValue());
cbox.setEnabled(false);
AccountApi.updateWatchedProject(
"self",
info,
new GerritCallback<JsArray<ProjectWatchInfo>>() {
@Override
public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
cbox.setEnabled(true);
}
@Override
public void onFailure(Throwable caught) {
cbox.setEnabled(true);
info.notify(type, oldVal);
cbox.setValue(oldVal);
super.onFailure(caught);
}
});
}
});
cbox.setValue(info.notify(type));
table.setWidget(row, col, cbox);
}
示例4: RebaseDialog
import com.google.gwt.user.client.ui.CheckBox; //导入方法依赖的package包/类
public RebaseDialog(
final Project.NameKey project,
final String branch,
final Change.Id changeId,
final boolean sendEnabled) {
super(Util.C.rebaseTitle(), null);
this.sendEnabled = sendEnabled;
sendButton.setText(Util.C.buttonRebaseChangeSend());
// Create the suggestion box to filter over a list of recent changes
// open on the same branch. The list of candidates is primed by the
// changeParent CheckBox (below) getting enabled by the user.
base =
new SuggestBox(
new HighlightSuggestOracle() {
@Override
protected void onRequestSuggestions(Request request, Callback done) {
String query = request.getQuery().toLowerCase();
List<ChangeSuggestion> suggestions = new ArrayList<>();
for (ChangeInfo ci : candidateChanges) {
if (changeId.equals(ci.legacyId())) {
continue; // do not suggest current change
}
String id = String.valueOf(ci.legacyId().get());
if (id.contains(query) || ci.subject().toLowerCase().contains(query)) {
suggestions.add(new ChangeSuggestion(ci));
if (suggestions.size() >= 50) { // limit to 50 suggestions
break;
}
}
}
done.onSuggestionsReady(request, new Response(suggestions));
}
});
base.getElement().setAttribute("placeholder", Util.C.rebasePlaceholderMessage());
base.setStyleName(Gerrit.RESOURCES.css().rebaseSuggestBox());
// The changeParent checkbox must be clicked to load into browser memory
// a list of open changes from the same project and same branch that this
// change may rebase onto.
changeParent = new CheckBox(Util.C.rebaseConfirmMessage());
changeParent.addClickHandler(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (changeParent.getValue()) {
ChangeList.query(
PageLinks.projectQuery(project)
+ " "
+ PageLinks.op("branch", branch)
+ " is:open -age:90d",
Collections.<ListChangesOption>emptySet(),
new GerritCallback<ChangeList>() {
@Override
public void onSuccess(ChangeList result) {
candidateChanges = Natives.asList(result);
updateControls(true);
}
@Override
public void onFailure(Throwable err) {
updateControls(false);
changeParent.setValue(false);
super.onFailure(err);
}
});
} else {
updateControls(false);
}
}
});
// add the checkbox and suggestbox widgets to the content panel
contentPanel.add(changeParent);
contentPanel.add(base);
contentPanel.setStyleName(Gerrit.RESOURCES.css().rebaseContentPanel());
}
示例5: buildScopePopup
import com.google.gwt.user.client.ui.CheckBox; //导入方法依赖的package包/类
/**
* Rebuild the popup from scratch with all of the scopes that we have from the last time we were
* presented.
*/
private void buildScopePopup() {
scopePanel.clear();
additionalScopePanel.clear();
Set<TextBox> oldEditors = Sets.newLinkedHashSet(freeFormEditors);
freeFormEditors.clear();
// Hide the service scopes label if there aren't any.
hasScopesText.setVisible(!scopesFromDiscovery.isEmpty());
noScopesText.setVisible(scopesFromDiscovery.isEmpty());
// Show different text on the free-form scopes section when there are discovery scopes.
optionalAdditionalScopes.setVisible(!scopesFromDiscovery.isEmpty());
for (final Map.Entry<String, AuthScope> scope : scopesFromDiscovery.entrySet()) {
// Add the check box to the table.
CheckBox scopeToggle = new CheckBox();
SafeHtmlBuilder safeHtml = new SafeHtmlBuilder();
safeHtml.appendEscaped(scope.getKey()).appendHtmlConstant("<br><span>")
.appendEscaped(scope.getValue().getDescription()).appendHtmlConstant("</span>");
scopeToggle.setHTML(safeHtml.toSafeHtml());
scopeToggle.addStyleName(style.discoveryScopeSelector());
scopePanel.add(scopeToggle);
// When the box is checked, add our scope to the selected list.
scopeToggle.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
CheckBox checkBox = (CheckBox) event.getSource();
if (checkBox.getValue()) {
selectedScopes.add(scope.getKey());
} else {
selectedScopes.remove(scope.getKey());
}
}
});
// Enable the check box if the scope is selected.
scopeToggle.setValue(selectedScopes.contains(scope.getKey()));
}
// Process any scopes that are extra.
for (TextBox editor : oldEditors) {
if (!editor.getValue().trim().isEmpty()) {
addFreeFormEditorRow(editor.getValue(), true);
}
}
// There should always be one empty editor.
addFreeFormEditorRow("", false);
}