org.apache.wicket.markup.html.form.CheckBox类的使用及代码示例

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

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

CheckBox介绍

[英]HTML checkbox input component.

Java:

form.add(new CheckBox("bool"));

HTML:

<input type="checkbox" wicket:id="bool" />

A CheckBox always has a valid therefore values from methods FormComponent#setRequired(boolean) and FormComponent#isRequired() are not taken into account.
[中]HTML复选框输入组件。
爪哇:

form.add(new CheckBox("bool"));

HTML:

<input type="checkbox" wicket:id="bool" />

复选框始终具有有效的值,因此不考虑来自FormComponent#setRequired(布尔)和FormComponent#isRequired()方法的值。

代码示例

代码示例来源:origin: org.geoserver.web/gs-web-sec-core

public BasicAuthFilterPanel(String id, IModel<BasicAuthenticationFilterConfig> model) {
    super(id, model);

    add(new CheckBox("useRememberMe"));
  }
}

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

CheckBox selectAllCheckbox() {
  CheckBox sa = new CheckBox("selectAll", new PropertyModel(this, "selectAllValue"));
  sa.setOutputMarkupId(true);
  sa.add(new AjaxFormComponentUpdatingBehavior("onclick") {
    @Override
    protected void onUpdate(AjaxRequestTarget target) {
      // select all the checkboxes
      setSelection(selectAllValue);
      
      // update table and the checkbox itself
      target.addComponent(getComponent());
      target.addComponent(listContainer);
      
      // allow subclasses to play on this change as well
      onSelectionUpdate(target);
    }
    
  });
  return sa;
}

代码示例来源:origin: org.geoserver.community/gs-pgraster

public FormComponent[] getDependentFormComponents() {
  if (enabled.getModelObject()) {
    return advancedConfigPanel.getDependentFormComponents();
  } else {
    return new FormComponent[] {urlFormComponent};
  }
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * @see org.apache.wicket.markup.html.form.IOnChangeListener#onSelectionChanged()
 */
public void onSelectionChanged()
{
  convertInput();
  updateModel();
  onSelectionChanged(getModelObject());
}

代码示例来源:origin: micromata/projectforge

/**
 * @see org.projectforge.web.wicket.flowlayout.ComponentWrapperPanel#getComponentOutputId()
 */
@Override
public String getComponentOutputId()
{
 checkBox.setOutputMarkupId(true);
 return checkBox.getMarkupId();
}

代码示例来源:origin: de.alpharogroup/jaulp-wicket-components

/**
 * Factory method for create a new {@link CheckBox}.
 *
 * @param id
 *            the id
 * @param model
 *            the model
 * @return the new {@link CheckBox}
 */
public static CheckBox newCheckBox(final String id, final IModel<Boolean> model)
{
  final CheckBox checkBox = new CheckBox(id, model);
  checkBox.setOutputMarkupId(true);
  return checkBox;
}

代码示例来源:origin: inductiveautomation/ignition-sdk-examples

private CheckBox newStepCheckboxField(final ModbusConfigurationEntry configEntry) {
  final CheckBox checkboxField = new CheckBox("step",
      new PropertyModel<Boolean>(configEntry, "designatorRange.step"));
  checkboxField.add(new OnChangeAjaxBehavior() {
    @Override
    protected void onUpdate(AjaxRequestTarget target) {
      configEntry.getDesignatorRange().setStep(checkboxField.getModelObject());
    }
  });
  return checkboxField;
}

代码示例来源:origin: org.geoserver.web/web-security

public UserGroupServicePanel(String id, IModel<T> model) {
  super(id, model);
  
  add(new PasswordEncoderChoice("passwordEncoderName").add(new OnChangeAjaxBehavior() {
    @Override
    protected void onUpdate(AjaxRequestTarget target) {
      if (recodeCheckBox.isVisible()) {
        recodeCheckBox.setEnabled(true);
        target.addComponent(recodeCheckBox);
      }
    }
  }));
  boolean canCreateStore=false;
  SecurityUserGroupServiceConfig config = model.getObject();
  try {
    GeoServerUserGroupService s = 
      (GeoServerUserGroupService) Class.forName(config.getClassName()).newInstance();
    canCreateStore=s.canCreateStore();
  } catch (Exception e) {
    // do nothing
  }
  
  recodeCheckBox= new CheckBox("recodeExistingPasswords", Model.of(false));
  recodeCheckBox.setOutputMarkupId(true);
  recodeCheckBox.setVisible(canCreateStore);
  recodeCheckBox.setEnabled(false);
  add(recodeCheckBox);
  add(new PasswordPolicyChoice("passwordPolicyName"));
}

代码示例来源:origin: net.sourceforge.wicketwebbeans/wicketwebbeans

/**
   * Construct a new BooleanField.
   *
   * @param id the Wicket id for the editor.
   * @param model the model.
   * @param metaData the meta data for the property.
   * @param viewOnly true if the component should be view-only.
   */
  public BooleanField(String id, IModel model, ElementMetaData metaData, boolean viewOnly)
  {
    super(id, model, metaData, viewOnly);

    CheckBox checkBox =  new CheckBox("component", model) ;
    checkBox.setEnabled(!viewOnly);
    add(checkBox);
  }
}

代码示例来源:origin: org.geoserver.web/gs-web-core

protected CheckBox selectOneCheckbox(Item<T> item) {
  CheckBox cb = new CheckBox("selectItem", new SelectionModel(item.getIndex()));
  cb.setOutputMarkupId(true);
  cb.setVisible(selectable);
  cb.add(
      new AjaxFormComponentUpdatingBehavior("click") {
        private static final long serialVersionUID = -2419184741329470638L;
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
          if (Boolean.FALSE.equals(getComponent().getDefaultModelObject())) {
            selectAllValue = false;
            target.add(selectAll);
          }
          onSelectionUpdate(target);
        }
      });
  return cb;
}

代码示例来源:origin: theonedev/onedev

@Override
protected void onInitialize() {
  super.onInitialize();
  
  add(input = new CheckBox("input", Model.of(getModelObject())));
  
  input.add(new AjaxFormComponentUpdatingBehavior("change"){
    @Override
    protected void onUpdate(AjaxRequestTarget target) {
      onPropertyUpdating(target);
    }
    
  });
  input.setLabel(Model.of(getDescriptor().getDisplayName(this)));
}

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

/**
 * @param id
 *            The component ID
 * @param boxes
 *            checkBoxes this selector will control
 */
public CheckBoxSelector(String id, CheckBox... boxes)
{
  super(id);
  for (CheckBox box : boxes)
  {
    connectedCheckBoxes.add(box);
    box.add(cleanup);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-addon-hst-configuration-editor-frontend

private void addHstRepositoryBasedMenuConfiguration() {
  CheckBox repositoryBased = new CheckBox("repobased");
  repositoryBased.setOutputMarkupId(true);
  repositoryBased.setEnabled(!getLockInfo().isLocked());
  form.add(repositoryBased);
  CheckBox foldersOnly = new CheckBox("foldersOnly");
  foldersOnly.setOutputMarkupId(true);
  foldersOnly.setEnabled(!getLockInfo().isLocked());
  form.add(foldersOnly);
  TextField depth = new TextField("depth");
  depth.setOutputMarkupId(true);
  depth.add(new RangeValidator(0l, null));
  depth.setEnabled(!getLockInfo().isLocked());
  form.add(depth);
}

代码示例来源:origin: theonedev/onedev

@Override
protected void onUpdate(AjaxRequestTarget target) {
  if (administratorInput.getModelObject())
    canCreateProjectsInput.setModelObject(true);
  target.add(canCreateProjectsInput);
}

代码示例来源:origin: theonedev/onedev

@Override
protected void onConfigure() {
  super.onConfigure();
  setEnabled(!administratorInput.getModelObject());
}

代码示例来源:origin: micromata/projectforge

/**
 * @param id
 * @param model
 * @param labelString If null then a classic checkbox is used.
 * @param wantOnSelectionChangedNotifications if true then wantOnSelectionChangedNotifications method returns true.
 * @see CheckBox#wantOnSelectionChangedNotifications()
 */
public CheckBoxButton(final String id, final IModel<Boolean> model, final String labelString,
  final boolean wantOnSelectionChangedNotifications)
{
 super(id);
 this.wantOnSelectionChangedNotifications = wantOnSelectionChangedNotifications;
 checkBox = new CheckBox(WICKET_ID, model) {
  @Override
  public void onSelectionChanged(final Boolean newSelection)
  {
   CheckBoxButton.this.onSelectionChanged(newSelection);
  }
  @Override
  protected boolean wantOnSelectionChangedNotifications()
  {
   return CheckBoxButton.this.wantOnSelectionChangedNotifications();
  }
 };
 checkBox.setOutputMarkupId(true);
 init(labelString);
 labelContainer.add(checkBox);
}

代码示例来源:origin: org.geoserver.community/gs-netcdf-ghrsst

@Override
  protected void onEvent(AjaxRequestTarget target) {
    enabled.processInput();
    boolean enableSettings = Boolean.TRUE.equals(enabled.getModelObject());
    settings.visitChildren(
        (component, visit) -> {
          component.setEnabled(enableSettings);
        });
    target.add(settings);
  }
});

代码示例来源:origin: org.geoserver.web/gs-web-core

private void disableDimension(
    Class<?> type, final WebMarkupContainer configs, Label noAttributeMessage) {
  // no attributes of the required type, no party
  enabled.setEnabled(false);
  enabled.setModelObject(false);
  configs.setVisible(false);
  ParamResourceModel typeName =
      new ParamResourceModel("AttributeType." + type.getSimpleName(), null);
  ParamResourceModel error =
      new ParamResourceModel("missingAttribute", this, typeName.getString());
  noAttributeMessage.setDefaultModelObject(error.getString());
}

代码示例来源:origin: org.geoserver.web/web-security

@Override
  protected void onUpdate(AjaxRequestTarget target) {
    if (recodeCheckBox.isVisible()) {
      recodeCheckBox.setEnabled(true);
      target.addComponent(recodeCheckBox);
    }
  }
}));

代码示例来源:origin: org.geoserver.web/web-sec-core

@Override
  protected void onUpdate(AjaxRequestTarget target) {
    for (CheckBox cb : methodList) {
      cb.setEnabled(chainWrapper.isMatchHTTPMethod());
      target.addComponent(cb);
    }
  }                        
}));

相关文章