org.apache.wicket.markup.html.form.Button.onComponentTag()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(112)

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

Button.onComponentTag介绍

[英]Processes the component tag. A value attribute is added with the value of the model object, if available. An onclick attribute is added if the subclass specified javascript.

NOTE. For a <button> the value attribute is not rendered, markup needs to be added within the button to display the button's label.
[中]处理组件标记。值属性将与模型对象的值一起添加(如果可用)。如果子类指定了javascript,则会添加onclick属性。
笔记对于<button>值属性未呈现,需要在按钮内添加标记以显示按钮的标签。

代码示例

代码示例来源:origin: org.wicketstuff/wicketstuff-stateless

@Override
protected void onComponentTag(ComponentTag tag)
{
  // WICKET-5594 prevent non-Ajax submit
  tag.put("type", "button");
  super.onComponentTag(tag);
}

代码示例来源:origin: apache/wicket

@Override
  protected void onComponentTag(ComponentTag tag)
  {
    String tagName = tag.getName();
    if (!("input".equalsIgnoreCase(tagName) || "button".equalsIgnoreCase(tagName)))
    {
      String msg = String.format("%s must be used only with <input type=\"submit\"> or <input type=\"submit\"> markup elements. " +
          "The fallback functionality doesn't work for other markup elements. " +
          "Component path: %s, markup element: <%s>.",
          AjaxFallbackButton.class.getSimpleName(), getClassRelativePath(), tagName);
      findMarkupStream().throwMarkupException(msg);
    }

    super.onComponentTag(tag);
  }
}

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

@Override
  protected void onComponentTag(ComponentTag tag)
  {
    String tagName = tag.getName();
    if (!("input".equalsIgnoreCase(tagName) || "button".equalsIgnoreCase(tagName)))
    {
      String msg = String.format("%s must be used only with <input type=\"submit\"> or <input type=\"submit\"> markup elements. " +
          "The fallback functionality doesn't work for other markup elements. " +
          "Component path: %s, markup element: <%s>.",
          AjaxFallbackButton.class.getSimpleName(), getClassRelativePath(), tagName);
      findMarkupStream().throwMarkupException(msg);
    }

    super.onComponentTag(tag);
  }
}

代码示例来源:origin: org.wicketstuff/wicketstuff-datatable-autocomplete

@Override
protected void onComponentTag(ComponentTag tag)
{
  // this allows the button to be used in a repeater
  tag.setName("input");
  tag.setHasNoCloseTag(true);
  super.onComponentTag(tag);
  tag.getAttributes().put("type", "submit");
}

代码示例来源:origin: org.wicketstuff/datatable-autocomplete

@Override
protected void onComponentTag(ComponentTag tag) {
  // this allows the button to be used in a repeater
  tag.setName("input");
  tag.setHasNoCloseTag(true);
  
  
  
  super.onComponentTag(tag);
  
  tag.getAttributes().put("type", "submit");
}

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

/**
 * Processes the component tag.
 * 
 * @param tag
 *            Tag to modify
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
@Override
protected final void onComponentTag(final ComponentTag tag)
{
  checkComponentTag(tag, "input");
  checkComponentTagAttribute(tag, "type", "image");
  final IResource resource = getImageResource();
  if (resource != null)
  {
    localizedImageResource.setResource(resource);
  }
  final ResourceReference resourceReference = getImageResourceReference();
  if (resourceReference != null)
  {
    localizedImageResource.setResourceReference(resourceReference);
  }
  localizedImageResource.setSrcAttribute(tag);
  super.onComponentTag(tag);
}

代码示例来源:origin: apache/wicket

/**
 * Processes the component tag.
 * 
 * @param tag
 *            Tag to modify
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
@Override
protected final void onComponentTag(final ComponentTag tag)
{
  checkComponentTag(tag, "input");
  checkComponentTagAttribute(tag, "type", "image");
  final IResource resource = getImageResource();
  if (resource != null)
  {
    localizedImageResource.setResource(resource);
  }
  final ResourceReference resourceReference = getImageResourceReference();
  if (resourceReference != null)
  {
    localizedImageResource.setResourceReference(resourceReference);
  }
  localizedImageResource.setSrcAttribute(tag);
  super.onComponentTag(tag);
}

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

/**
 * Processes the component tag.
 * 
 * @param tag
 *            Tag to modify
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
protected final void onComponentTag(final ComponentTag tag)
{
  checkComponentTag(tag, "input");
  checkComponentTagAttribute(tag, "type", "image");
  final Resource resource = getImageResource();
  if (resource != null)
  {
    localizedImageResource.setResource(resource);
  }
  final ResourceReference resourceReference = getImageResourceReference();
  if (resourceReference != null)
  {
    localizedImageResource.setResourceReference(resourceReference);
  }
  localizedImageResource.setSrcAttribute(tag);
  super.onComponentTag(tag);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Processes the component tag.
 * 
 * @param tag
 *            Tag to modify
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
@Override
protected final void onComponentTag(final ComponentTag tag)
{
  checkComponentTag(tag, "input");
  checkComponentTagAttribute(tag, "type", "image");
  final Resource resource = getImageResource();
  if (resource != null)
  {
    localizedImageResource.setResource(resource);
  }
  final ResourceReference resourceReference = getImageResourceReference();
  if (resourceReference != null)
  {
    localizedImageResource.setResourceReference(resourceReference);
  }
  localizedImageResource.setSrcAttribute(tag);
  super.onComponentTag(tag);
}

相关文章