com.vaadin.ui.CheckBox.addValueChangeListener()方法的使用及代码示例

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

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

CheckBox.addValueChangeListener介绍

暂无

代码示例

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

@Override
  public Registration addValueChangeListener(ValueChangeListener<Boolean> listener) {
    return checkBox.addValueChangeListener(listener);
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Creates a reset checkbox which can enable / disable a date field.<p>
 *
 * @param box the check box
 * @param field the date field
 */
private void initResetCheckbox(CheckBox box, final DateField field) {
  box.addValueChangeListener(new ValueChangeListener() {
    private static final long serialVersionUID = 1L;
    public void valueChange(ValueChangeEvent event) {
      Boolean value = (Boolean)(event.getProperty().getValue());
      if (value.booleanValue()) {
        field.clear();
        field.setEnabled(false);
      } else {
        field.setEnabled(true);
      }
    }
  });
}

代码示例来源:origin: peholmst/vaadin4spring

private CheckBox createViewCheckbox(String caption, final String viewName) {
  final CheckBox checkBox = new CheckBox(caption, true);
  checkBox.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
    @Override
    public void valueChange(HasValue.ValueChangeEvent<Boolean> valueChangeEvent) {
      if (checkBox.getValue()) {
        allowedViews.add(viewName);
      } else {
        allowedViews.remove(viewName);
      }
    }
  });
  return checkBox;
}

代码示例来源:origin: org.opencms/opencms-core

@SuppressWarnings("synthetic-access")
  public Object generateCell(final Table source, final Object itemId, final Object columnId) {
    CheckBox cb = getCheckBox(itemId);
    cb.setValue(Boolean.valueOf(source.isSelected(itemId)));
    cb.addValueChangeListener(new ValueChangeListener() {
      private static final long serialVersionUID = 1L;
      public void valueChange(ValueChangeEvent event) {
        boolean val = ((Boolean)(event.getProperty().getValue())).booleanValue();
        if (val) {
          source.select(itemId);
        } else {
          source.unselect(itemId);
        }
      }
    });
    return cb;
  }
});

代码示例来源:origin: eclipse/hawkbit

private CheckBox createTargetVisibleField() {
  final CheckBox checkBox = new CheckBox();
  checkBox.setId(UIComponentIdProvider.METADATA_TARGET_VISIBLE_ID);
  checkBox.setCaption(i18n.getMessage("metadata.targetvisible"));
  checkBox.addValueChangeListener(this::onCheckBoxChange);
  return checkBox;
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private CheckBox createTargetVisibleField() {
  final CheckBox checkBox = new CheckBox();
  checkBox.setId(UIComponentIdProvider.METADATA_TARGET_VISIBLE_ID);
  checkBox.setCaption(i18n.getMessage("metadata.targetvisible"));
  checkBox.addValueChangeListener(this::onCheckBoxChange);
  return checkBox;
}

代码示例来源:origin: org.opennms.features.topology.plugins/org.opennms.features.topology.plugins.browsers

button.setData(property.getValue());
button.setValue(isSelected((Integer) property.getValue()));
button.addValueChangeListener(new ValueChangeListener() {

代码示例来源:origin: org.opennms.features/vaadin-surveillance-views

public Object generateCell(Table source, final Object itemId, Object columnId) {
    CheckBox checkBox = new CheckBox();
    checkBox.setImmediate(true);
    checkBox.setDescription("Make this Surveillance View configuration the default");
    final View view = m_beanItemContainer.getItem(itemId).getBean();
    checkBox.setValue(SurveillanceViewProvider.getInstance().getSurveillanceViewConfiguration().getDefaultView().equals(view.getName()));
    checkBox.addValueChangeListener(new Property.ValueChangeListener() {
      @Override
      public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
        boolean newValue = ((Boolean) valueChangeEvent.getProperty().getValue());
        if (newValue) {
          SurveillanceViewProvider.getInstance().getSurveillanceViewConfiguration().setDefaultView(view.getName());
        }
        m_table.refreshRowCache();
        SurveillanceViewProvider.getInstance().save();
        ((SurveillanceViewsConfigUI) getUI()).notifyMessage("Data saved", "Default surveillance view");
      }
    });
    return checkBox;
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Constructor.<p>
 *
 * @param app the source search app instance
 */
public CmsSourceSearchForm(CmsSourceSearchApp app) {
  m_app = app;
  CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null);
  initFields();
  m_replace.addValueChangeListener(new ValueChangeListener() {
    private static final long serialVersionUID = 1L;
    public void valueChange(ValueChangeEvent event) {
      updateReplace();
    }
  });
  m_searchType.addValueChangeListener(new ValueChangeListener() {
    private static final long serialVersionUID = 1L;
    public void valueChange(ValueChangeEvent event) {
      changedSearchType();
    }
  });
  m_search.addClickListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
    public void buttonClick(ClickEvent event) {
      search();
    }
  });
  updateReplace();
  changedSearchType();
}

代码示例来源:origin: eclipse/hawkbit

private CheckBox enableMaintenanceWindowControl() {
  final CheckBox enableMaintenanceWindow = new CheckBox(
      getI18n().getMessage("caption.maintenancewindow.enabled"));
  enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
  enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
  enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
  enableMaintenanceWindow.addValueChangeListener(event -> {
    final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
    maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
    maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
    enableSaveButton(!isMaintenanceWindowEnabled);
    maintenanceWindowLayout.clearAllControls();
  });
  return enableMaintenanceWindow;
}

代码示例来源:origin: eclipse/hawkbit

private VerticalLayout initView() {
  final Label label = new Label(i18n.getMessage("label.auto.assign.description"));
  checkBox = new CheckBox(i18n.getMessage("label.auto.assign.enable"));
  checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID);
  checkBox.setImmediate(true);
  checkBox.addValueChangeListener(this);
  setTableEnabled(false);
  final VerticalLayout verticalLayout = new VerticalLayout();
  verticalLayout.addComponent(label);
  verticalLayout.addComponent(checkBox);
  verticalLayout.addComponent(dsTable);
  return verticalLayout;
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private CheckBox enableMaintenanceWindowControl() {
  final CheckBox enableMaintenanceWindow = new CheckBox(
      getI18n().getMessage("caption.maintenancewindow.enabled"));
  enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
  enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
  enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
  enableMaintenanceWindow.addValueChangeListener(event -> {
    final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
    maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
    maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
    enableSaveButton(!isMaintenanceWindowEnabled);
    maintenanceWindowLayout.clearAllControls();
  });
  return enableMaintenanceWindow;
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private VerticalLayout initView() {
  final Label label = new Label(i18n.getMessage("label.auto.assign.description"));
  checkBox = new CheckBox(i18n.getMessage("label.auto.assign.enable"));
  checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID);
  checkBox.setImmediate(true);
  checkBox.addValueChangeListener(this);
  setTableEnabled(false);
  final VerticalLayout verticalLayout = new VerticalLayout();
  verticalLayout.addComponent(label);
  verticalLayout.addComponent(checkBox);
  verticalLayout.addComponent(dsTable);
  return verticalLayout;
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private CheckBox enableMaintenanceWindowControl() {
  final CheckBox enableMaintenanceWindow = new CheckBox(
      getI18n().getMessage("caption.maintenancewindow.enabled"));
  enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
  enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
  enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
  enableMaintenanceWindow.addValueChangeListener(event -> {
    final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
    maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
    maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
    enableSaveButton(!isMaintenanceWindowEnabled);
    maintenanceWindowLayout.clearAllControls();
  });
  return enableMaintenanceWindow;
}

代码示例来源:origin: eclipse/hawkbit

private CheckBox enableMaintenanceWindowControl() {
  final CheckBox enableMaintenanceWindow = new CheckBox(
      getI18n().getMessage("caption.maintenancewindow.enabled"));
  enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
  enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
  enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
  enableMaintenanceWindow.addValueChangeListener(event -> {
    final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
    maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
    maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
    enableSaveButton(!isMaintenanceWindowEnabled);
    maintenanceWindowLayout.clearAllControls();
  });
  return enableMaintenanceWindow;
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private DurationConfigField(final String id) {
  super(2, 2);
  this.addStyleName("duration-config-field");
  this.setSpacing(true);
  this.setImmediate(true);
  this.setColumnExpandRatio(1, 1.0F);
  durationField.setId(id + ".field");
  checkBox.setId(id + ".checkbox");
  this.addComponent(checkBox, 0, 0);
  this.setComponentAlignment(checkBox, Alignment.MIDDLE_LEFT);
  this.addComponent(durationField, 1, 0);
  this.setComponentAlignment(durationField, Alignment.MIDDLE_LEFT);
  checkBox.addValueChangeListener(event -> checkBoxChange());
  durationField.addValueChangeListener(event -> notifyConfigurationChanged());
}

代码示例来源:origin: eclipse/hawkbit

private DurationConfigField(final String id) {
  super(2, 2);
  this.addStyleName("duration-config-field");
  this.setSpacing(true);
  this.setImmediate(true);
  this.setColumnExpandRatio(1, 1.0F);
  durationField.setId(id + ".field");
  checkBox.setId(id + ".checkbox");
  this.addComponent(checkBox, 0, 0);
  this.setComponentAlignment(checkBox, Alignment.MIDDLE_LEFT);
  this.addComponent(durationField, 1, 0);
  this.setComponentAlignment(durationField, Alignment.MIDDLE_LEFT);
  checkBox.addValueChangeListener(event -> checkBoxChange());
  durationField.addValueChangeListener(event -> notifyConfigurationChanged());
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

actionAutocloseCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX);
actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled());
actionAutocloseCheckBox.addValueChangeListener(this);
actionAutocloseConfigurationItem.addChangeListener(this);
gridLayout.addComponent(actionAutocloseCheckBox, 0, 0);
actionAutocleanupCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLEANUP_CHECKBOX);
actionAutocleanupCheckBox.setValue(actionAutocleanupConfigurationItem.isConfigEnabled());
actionAutocleanupCheckBox.addValueChangeListener(this);
actionAutocleanupConfigurationItem.addChangeListener(this);
gridLayout.addComponent(actionAutocleanupCheckBox, 0, 1);

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private void init() {
  final Panel rootPanel = new Panel();
  rootPanel.setSizeFull();
  rootPanel.addStyleName("config-panel");
  final VerticalLayout vLayout = new VerticalLayout();
  vLayout.setMargin(true);
  vLayout.setSizeFull();
  final Label header = new Label(i18n.getMessage("configuration.rollout.title"));
  header.addStyleName("config-panel-header");
  vLayout.addComponent(header);
  final HorizontalLayout hLayout = new HorizontalLayout();
  hLayout.setSpacing(true);
  hLayout.setImmediate(true);
  approvalCheckbox = SPUIComponentProvider.getCheckBox("", "", null, false, "");
  approvalCheckbox.setId(UIComponentIdProvider.ROLLOUT_APPROVAL_ENABLED_CHECKBOX);
  approvalCheckbox.setValue(approvalConfigurationItem.isConfigEnabled());
  approvalCheckbox.addValueChangeListener(this);
  approvalConfigurationItem.addChangeListener(this);
  hLayout.addComponent(approvalCheckbox);
  hLayout.addComponent(approvalConfigurationItem);
  final Link linkToApprovalHelp = SPUIComponentProvider
      .getHelpLink(uiProperties.getLinks().getDocumentation().getRollout());
  hLayout.addComponent(linkToApprovalHelp);
  hLayout.setComponentAlignment(linkToApprovalHelp, Alignment.BOTTOM_RIGHT);
  vLayout.addComponent(hLayout);
  rootPanel.setContent(vLayout);
  setCompositionRoot(rootPanel);
}

代码示例来源:origin: eclipse/hawkbit

private void init() {
  final Panel rootPanel = new Panel();
  rootPanel.setSizeFull();
  rootPanel.addStyleName("config-panel");
  final VerticalLayout vLayout = new VerticalLayout();
  vLayout.setMargin(true);
  vLayout.setSizeFull();
  final Label header = new Label(i18n.getMessage("configuration.rollout.title"));
  header.addStyleName("config-panel-header");
  vLayout.addComponent(header);
  final HorizontalLayout hLayout = new HorizontalLayout();
  hLayout.setSpacing(true);
  hLayout.setImmediate(true);
  approvalCheckbox = SPUIComponentProvider.getCheckBox("", "", null, false, "");
  approvalCheckbox.setId(UIComponentIdProvider.ROLLOUT_APPROVAL_ENABLED_CHECKBOX);
  approvalCheckbox.setValue(approvalConfigurationItem.isConfigEnabled());
  approvalCheckbox.addValueChangeListener(this);
  approvalConfigurationItem.addChangeListener(this);
  hLayout.addComponent(approvalCheckbox);
  hLayout.addComponent(approvalConfigurationItem);
  final Link linkToApprovalHelp = SPUIComponentProvider
      .getHelpLink(i18n, uiProperties.getLinks().getDocumentation().getRollout());
  hLayout.addComponent(linkToApprovalHelp);
  hLayout.setComponentAlignment(linkToApprovalHelp, Alignment.BOTTOM_RIGHT);
  vLayout.addComponent(hLayout);
  rootPanel.setContent(vLayout);
  setCompositionRoot(rootPanel);
}

相关文章