com.google.gwt.user.client.ui.CheckBox类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(13.3k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中com.google.gwt.user.client.ui.CheckBox类的一些代码示例,展示了CheckBox类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CheckBox类的具体详情如下:
包路径:com.google.gwt.user.client.ui.CheckBox
类名称:CheckBox

CheckBox介绍

[英]A standard check box widget. This class also serves as a base class for com.google.gwt.user.client.ui.RadioButton.

Built-in Bidi Text Support

This widget is capable of automatically adjusting its direction according to its content. This feature is controlled by #setDirectionEstimator or passing a DirectionEstimator parameter to the constructor, and is off by default.

CSS Style Rules

.gwt-CheckBox the outer element .gwt-CheckBox-disabled applied when Checkbox is disabled

Example

com.google.gwt.examples.CheckBoxExample
[中]一个标准的复选框小部件。该类还用作com的基类。谷歌。gwt。使用者客户用户界面。无线电按钮。
####内置Bidi文本支持
此小部件能够根据其内容自动调整其方向。此功能由#setDirectionStimator控制,或将DirectionStimator参数传递给构造函数,默认情况下关闭。
####CSS样式规则
.gwt复选框显示外部元素。禁用复选框时应用gwt复选框禁用
####范例
通用域名格式。谷歌。gwt。例子。复选框示例

代码示例

代码示例来源:origin: kaaproject/kaa

/**
 * Instantiates a new CtlSchemasViewImpl.
 */
public CtlSchemasViewImpl() {
 super(true);
 if (displayShowHigherLevelScopeCheckBox()) {
  showHigherScopeCheckBox = new CheckBox(Utils.constants.displayHigherScopes());
  showHigherScopeCheckBox.addStyleName(Utils.kaaAdminStyle.bAppContentTitle());
  Element.as(showHigherScopeCheckBox.getElement().getChild(0))
    .getStyle().setMarginRight(10, Unit.PX);
  showHigherScopeCheckBox.setValue(defaultShowHigherLevelScopes());
  appendToolbarWidget(showHigherScopeCheckBox);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * This method is called when a widget is detached from the browser's
 * document. Overridden because of IE bug that throws away checked state and
 * in order to clear the event listener off of the <code>inputElem</code>.
 */
@Override
protected void onUnload() {
 // Clear out the inputElem's event listener (breaking the circular
 // reference between it and the widget).
 DOM.setEventListener(inputElem, null);
 setValue(getValue());
}

代码示例来源:origin: kaaproject/kaa

@Override
protected void initDetailsTable() {
 Label authorLabel = new Label(Utils.constants.author());
 createdUsername = new KaaAdminSizedTextBox(-1, false);
 createdUsername.setWidth("100%");
 detailsTable.setWidget(0, 1, createdUsername);
 authorLabel.setVisible(!create);
 createdUsername.setVisible(!create);
 Label dateTimeCreatedLabel = new Label(Utils.constants.dateTimeCreated());
 createdDateTime = new KaaAdminSizedTextBox(-1, false);
 createdDateTime.setWidth("100%");
 name.addInputHandler(this);
 mandatory = new CheckBox();
 mandatory.setWidth("100%");
 Label mandatoryLabel = new Label(Utils.constants.mandatory());
 detailsTable.setWidget(3, 0, mandatoryLabel);
 detailsTable.setWidget(3, 1, mandatory);
 mandatory.addValueChangeHandler(this);
  getSaveButtonWidget().setVisible(false);
  name.setEnabled(false);
  mandatory.setEnabled(false);
  description.getTextArea().setEnabled(false);

代码示例来源:origin: stackoverflow.com

final LinearLayout attractedTo = (LinearLayout) findViewById(R.id.register_attracted_to);

final CheckBox male = new CheckBox(this);
male.setText("Male");
male.setTextColor(getResources().getColor(R.color.foreground_text));
attractedTo.addView(male);

final CheckBox female = new CheckBox(this);
female.setText("Female");
female.setTextColor(getResources().getColor(R.color.foreground_text));
attractedTo.addView(female);

代码示例来源:origin: kaaproject/kaa

@Override
protected void resetImpl() {
 name.setValue("");
 name.setEnabled(true);
 nameLabel.addStyleName(REQUIRED);
 weight.setValue(null);
 weight.setEnabled(true);
 weightLabel.addStyleName(REQUIRED);
 description.setValue("");
 createdUsername.setValue("");
 createdDateTime.setValue("");
 addProfileFilterButton.setVisible(!create);
 addConfigurationButton.setVisible(!create);
 addTopicButton.setVisible(!create);
 profileFiltersGrid.setEnableActions(true);
 configurationsGrid.setEnableActions(true);
 includeDeprecatedProfileFilters.setVisible(!create);
 includeDeprecatedProfileFilters.setValue(false);
 includeDeprecatedConfigurations.setVisible(!create);
 includeDeprecatedConfigurations.setValue(false);
}

代码示例来源:origin: stackoverflow.com

LinearLayout featuresTable = (LinearLayout) findViewById(R.id.failure_reasonslist);
// use loop 
CheckBox feature1 = new CheckBox(this);
featuresTable.addView(feature1 );

代码示例来源:origin: stackoverflow.com

if (type == TYPE.CHECKBOXES){
   LinearLayout myPanel = new LinearLayout(this);
   for (int i = 0; i < n ; i++){
     CheckBox chk=new CheckBox(this);  
     chk.setText("Hello");
     myPanel.addView(chk); 
   }
   myRootPanel.addView(myPanel);
}

代码示例来源:origin: stackoverflow.com

LinearLayout llsomething = new LinearLayout(this);
 Checkbox cbSomething = new CheckBox(this);
 TextView tvSomething = new TextView(this);
 tvSomething.setText(R.string.something);
 llsomething.addView(cbSomething);
 llsomething.addView(tvSomething);

代码示例来源:origin: stackoverflow.com

@Override
 public void onCreate(Bundle savedInstanceState) {
 LinearLayout ll = (LinearLayout)findViewById(R.id.linearLayout2);
 //add checkboxes
     for(int i = 0; i < 6; i++) {
       CheckBox cb = new CheckBox(this);
       cb.setText("Dynamic Checkbox " + i);
       cb.setId(i+6);
       ll.addView(cb);
     }
 }

代码示例来源:origin: org.jboss.errai/errai-bus

final Label titleBarLabel = new Label("An Error Occurred in the Bus");
titleBarLabel.getElement().getStyle().setFontSize(10, Style.Unit.PT);
titleBarLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLDER);
titleBarLabel.getElement().getStyle().setColor("white");
final HorizontalPanel buttonPanel = new HorizontalPanel();
final CheckBox showFurtherErrors = new CheckBox();
showFurtherErrors.setValue(showErrors);
showFurtherErrors.setText("Show further errors");
showFurtherErrors.getElement().getStyle().setFontSize(10, Style.Unit.PT);
showFurtherErrors.getElement().getStyle().setColor("white");
showFurtherErrors.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
 @Override
 public void onValueChange(final ValueChangeEvent<Boolean> booleanValueChangeEvent) {
final Button disconnectFromServer = new Button("Disconnect Bus");
disconnectFromServer.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(final ClickEvent event) {
final Button clearErrors = new Button("Clear Log");
clearErrors.addClickHandler(new ClickHandler() {
 @Override

代码示例来源:origin: stackoverflow.com

CheckBox checkbox = new CheckBox(this);
checkbox.setText("completed");
checkbox.setTextSize(TypedValue.COMPLEX_UNIT_PT, 10);
checkbox.setTextColor(Color.BLACK);
checkbox.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

LinearLayout layout = (LinearLayout)findViewById(R.id.layoutku);
layout.addView(checkbox);

代码示例来源:origin: stackoverflow.com

final LinearLayout layout = new LinearLayout(this);
 ScrollView scrollView = new ScrollView(this);
 layout.setOrientation(LinearLayout.VERTICAL);
  CheckBox[] t=new CheckBox[15];
  for (i=0;i<currentBattery.temperatureNumber;i++)
  {               
    t[i]=new CheckBox(this);
    t[i].setText("title");
    t[i].setChecked(false);
    t[i].setOnCheckedChangeListener(this);
    scrollView.addView(t[i]);      
  }

代码示例来源:origin: kaaproject/kaa

Label authorLabel = new Label(Utils.constants.author());
createdUsername = new KaaAdminSizedTextBox(-1, false);
createdUsername.setWidth("100%");
detailsTable.setWidget(row, 1, createdUsername);
authorLabel.setVisible(!create);
createdUsername.setVisible(!create);
includeDeprecatedProfileFilters = new CheckBox(Utils.constants.includeDeprecated());
setCheckBoxStyle(includeDeprecatedProfileFilters);
addProfileFilterButton = new Button(Utils.constants.addProfileFilter());
addProfileFilterButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
addProfileFilterButton.getElement()
includeDeprecatedProfileFilters.setVisible(!create);
profileFiltersGrid.setVisible(!create);
includeDeprecatedConfigurations = new CheckBox(Utils.constants.includeDeprecated());
setCheckBoxStyle(includeDeprecatedConfigurations);
includeDeprecatedConfigurations.setVisible(!create);
configurationsGrid.setVisible(!create);

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-java-ext-lang-client

private void createTreeElement(
  final TreeItem root, String changeName, List<PreviewNode> children) {
 FlowPanel element = new FlowPanel();
 element.getElement().getStyle().setFloat(LEFT);
 CheckBox itemCheckBox = new CheckBox();
 itemCheckBox.setValue(true);
 itemCheckBox.getElement().getStyle().setFloat(LEFT);
 itemCheckBox.getElement().getStyle().setMarginTop(3, PX);
 Label name = new Label(changeName);
 name.addClickHandler(
   event -> {
    delegate.onSelectionChanged(containerChanges.get(root));
    root.setSelected(true);
   });
 name.getElement().getStyle().setFloat(LEFT);
 element.add(itemCheckBox);
 element.add(name);
 element.getElement().getParentElement().getStyle().setMargin(1, PX);
 itemCheckBox.addValueChangeHandler(
   event -> {
    checkChildrenState(root, event.getValue());

代码示例来源:origin: org.opennms.features/org.opennms.features.node-page-list

private Widget createWidget() {
  m_errorLabel.setText("hello");
  Button ok = new Button("OK");
  ok.addClickHandler(new ClickHandler() {
   @Override
   public void onClick(ClickEvent event) {
  final CheckBox check = new CheckBox();
  check.setText("Don't show again for 24hours");
  check.addClickHandler(new ClickHandler() {
  m_layoutPanel.setHeight("125px");
  m_caption.getElement().getStyle().setBackgroundColor("#ebebeb");
  m_caption.setText("Error");
  m_layoutPanel.addNorth(m_caption, 2);

代码示例来源:origin: fjfd/microscope

y2range.addBlurHandler(refreshgraph);
y2range.addKeyPressHandler(refreshgraph);
ylog.addClickHandler(new AdjustYRangeCheckOnClick(ylog, yrange));
y2log.addClickHandler(new AdjustYRangeCheckOnClick(y2log, y2range));
ylog.addClickHandler(refreshgraph);
y2log.addClickHandler(refreshgraph);
wxh.addBlurHandler(refreshgraph);
wxh.addKeyPressHandler(refreshgraph);
horizontalkey.addClickHandler(refreshgraph);
keybox.addClickHandler(refreshgraph);
nokey.addClickHandler(refreshgraph);
smooth.addClickHandler(refreshgraph);
y2range.setText("[0:]");
y2range.setEnabled(false);
y2log.setEnabled(false);
table.setText(0, 0, "From");
  hbox.add(now);
  table.setWidget(0, 1, hbox);
autoreload.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
  @Override
  public void onValueChange(final ValueChangeEvent<Boolean> event) {

代码示例来源:origin: org.jboss.ballroom/widgets

public CheckBoxItem(String name, String title) {
  super(name, title);
  checkBox = new CheckBox();
  checkBox.setName(name);
  checkBox.setTitle(SWITCH_TO_EXPRESSION_TITLE);
  checkBox.setTabIndex(0);
  checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
    @Override
    public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
  setUndefined(false);
  checkBox.addClickHandler(new  ClickHandler() {
    @Override
    public void onClick(ClickEvent clickEvent) {
  textBox = new TextBox();
  textBox.setTitle("Shift click for regular input");
  textBox.addClickHandler(new  ClickHandler() {
    @Override
    public void onClick(ClickEvent clickEvent) {
  panel = new HorizontalPanel();
  panel.add(checkBoxWrapper);
  panel.add(textBoxWrapper);

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-java-ext-lang-client

updateFullNames.addValueChangeHandler(event -> patternField.setEnabled(event.getValue()));
updateDelegateUpdating.addValueChangeHandler(
  event -> updateMarkDeprecated.setEnabled(event.getValue()));
configureLabel.addClickHandler(
  event -> {
   if (isUpdateSimilarlyVariables()) {
newName.addKeyUpHandler(
  event -> {
  });
updateSimilarlyVariables.addValueChangeHandler(
  event -> {
   if (event.getValue()) {
    configureLabel.getElement().getStyle().setCursor(POINTER);
    configureLabel.getElement().getStyle().setColor(Style.getPrimaryHighlightsColor());
   } else {
    configureLabel.getElement().getStyle().setCursor(DEFAULT);
    configureLabel.getElement().getStyle().setColor(Style.getButtonDisabledFontColor());

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

String getMessagePreview(final EIURI instanceURI, final String instanceLabel) {
  final Person fromInfo = new Person( fromNameText.getText(), fromEmailText.getText(), fromTitleText.getText(), fromLabName.getText(), institutionNameText.getText(), institutionSelect.getItemText(institutionSelect.getSelectedIndex()) );
  final TributaryRequestDetailInfo requestDetailInfo = new TributaryRequestDetailInfo( instanceURI, instanceLabel, descriptionText.getText(), additionalInfoText.getText(), agreeToCiteCheckBox.getValue(), agreeToShareCheckBox.getValue() );
  final ContactBean msg = new TributaryBean( fromInfo, requestDetailInfo, subject, ccEmailCheckBox.getValue() );
  // this will deliver html in case that's what the message will use, or plain-text if no html:
  showGlasspane();
  InstancePage.contactService.getMessageContent( SessionContext.getSessionId(), msg, true, new RootAsyncCallback<String>() {
    @Override
    public void onSuccess(String result) {
      if ( result != null ) {
        contentPreview = result;
        new TributaryPreviewPanel( contentPreview ) ;
        hideGlasspane();
      } else {
        Window.alert( "Error obtaining message text.  Please check required fields." );
      }
    }
  });
  return "Still only a mock-message: working on the async callback....";
}

代码示例来源:origin: org.geomajas/geomajas-client-gwt2-example-jar

private LayerWidget(final Layer layer) {
    setWidth("100%");
    Button removeBtn = new Button("Refresh");
    removeBtn.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        layer.refresh();
      }
    });
    add(removeBtn);
    if (layer instanceof LabelsSupported) {
      final LabelsSupported labelsSupported = (LabelsSupported) layer;
      CheckBox labeledCheckBox = new CheckBox("Labeled");
      labeledCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          labelsSupported.setLabeled(!labelsSupported.isLabeled());
          layer.refresh();
        }
      });
      add(labeledCheckBox);
    }
    add(new Label(layer.getTitle()));
    setStyleName(ExampleBase.getShowcaseResource().css().sampleRow());
  }
}

相关文章