當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckBox.addClickHandler方法代碼示例

本文整理匯總了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);
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:24,代碼來源:FacetPanel.java

示例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);
				}

			});
		}
	}

}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:39,代碼來源:ImportBatchClassView.java

示例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);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:36,代碼來源:MyWatchesTable.java

示例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());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:78,代碼來源:RebaseDialog.java

示例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);
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:59,代碼來源:AuthView.java


注:本文中的com.google.gwt.user.client.ui.CheckBox.addClickHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。