コード例 #1
0
ファイル: CheckGroup.java プロジェクト: hurrong/wicket
  @Override
  protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    // No longer applicable, breaks XHTML validation.
    tag.remove("disabled");
    tag.remove("name");
  }
コード例 #2
0
 @Override
 protected void onComponentTag(final ComponentTag tag) {
   super.onComponentTag(tag);
   // our component tag is not actually the input that is submitted
   if (tag.getAttributes().containsKey("name")) {
     tag.remove("name");
   }
 }
コード例 #3
0
ファイル: CheckBox.java プロジェクト: bollinger/wicket
  /**
   * Processes the component tag.
   *
   * @param tag Tag to modify
   * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
   */
  @Override
  protected void onComponentTag(final ComponentTag tag) {
    checkComponentTag(tag, "input");
    checkComponentTagAttribute(tag, "type", "checkbox");

    final String value = getValue();
    final IConverter<Boolean> converter = getConverter(Boolean.class);
    final Boolean checked = converter.convertToObject(value, getLocale());

    if (Boolean.TRUE.equals(checked)) {
      tag.put("checked", "checked");
    } else {
      // In case the attribute was added at design time
      tag.remove("checked");
    }

    // remove value attribute, because it overrides the browser's submitted value, eg a [input
    // type="checkbox" value=""] will always submit as false
    tag.remove("value");

    // Should a roundtrip be made (have onSelectionChanged called) when the
    // checkbox is clicked?
    if (wantOnSelectionChangedNotifications()) {
      CharSequence url = urlForListener(new PageParameters());

      Form<?> form = findParent(Form.class);
      if (form != null) {
        tag.put("onclick", form.getJsForInterfaceUrl(url));
      } else {
        // NOTE: do not encode the url as that would give invalid
        // JavaScript
        tag.put(
            "onclick",
            "window.location.href='"
                + url
                + (url.toString().indexOf('?') > -1 ? "&" : "?")
                + getInputName()
                + "=' + this.checked;");
      }
    }

    super.onComponentTag(tag);
  }
コード例 #4
0
 protected void onComponentTag(final ComponentTag tag) {
   tag.remove("wicket:enclosure");
   super.onComponentTag(tag);
 }