org.apache.wicket.markup.html.border.Border类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(106)

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

Border介绍

[英]A border component has associated markup which is drawn and determines placement of markup and/or components nested within the border component.

The portion of the border's associated markup file which is to be used in rendering the border is denoted by a wicket:border tag. The children of the border component instance are then inserted into this markup, replacing the first wicket:body tag in the border's associated markup.

For example, if a border's associated markup looked like this:

<html> 
<body> 
<wicket:border> 
First <wicket:body/> Last 
</wicket:border> 
</body> 
</html>

And the border was used on a page like this:

<html> 
<body> 
<span wicket:id = "myBorder"> 
Middle 
</span> 
</body> 
</html>

Then the resulting HTML would look like this:

<html> 
<body> 
First Middle Last 
</body> 
</html>

In other words, the body of the myBorder component is substituted into the border's associated markup at the position indicated by the wicket:body tag.

Regarding wicket:body/ you have two options. Either use wicket:body/ (open-close tag) which will automatically be expanded to wicket:bodybody content</wicket:body> or use wicket:bodypreview region</wicket:body> in your border's markup. The preview region (everything in between the open and close tag) will automatically be removed.

The border body container will automatically be created for you and added to the border container. It is accessible via #getBodyContainer(). In case the body markup is not an immediate child of border (see the example below), then you must use code such as someContainer.add(getBodyContainer()) to add the body component to the correct container.

<html> 
<body> 
<wicket:border> 
<span wicket:id="someContainer"> 
<wicket:body/> 
</span> 
</wicket:border> 
</body> 
</html>

The component "someContainer" in the previous example must be added to the border, and not the body, which is achieved via #addToBorder(Component...).

#add(Component...) is an alias to getBodyContainer().add(Component...) and will add a child component to the border body as shown in the example below.

<html> 
<body> 
<span wicket:id = "myBorder"> 
<input wicket:id="name"/;> 
</span> 
</body> 
</html>

This implementation does not apply any magic with respect to component handling. In doubt think simple. But everything you can do with a MarkupContainer or Component, you can do with a Border or its Body as well.

Other methods like #remove(), #get(int), #iterator(), etc. are not aliased to work on the border's body and attention must be paid when they need to be used.
[中]边框构件具有关联的标记,该标记被绘制并确定嵌套在边框构件中的标记和/或构件的位置。
边框的关联标记文件中用于呈现边框的部分由wicket:border标记表示。然后将border组件实例的子项插入到此标记中,替换border关联标记中的第一个wicket:body标记。
例如,如果边框的关联标记如下所示:
<

<html> 
<body> 
<wicket:border> 
First <wicket:body/> Last 
</wicket:border> 
</body> 
</html>

而边框在这样的页面上使用:<

<html> 
<body> 
<span wicket:id = "myBorder"> 
Middle 
</span> 
</body> 
</html>

然后生成的HTML看起来是这样的:<

<html> 
<body> 
First Middle Last 
</body> 
</html>

换句话说,myBorder组件的主体被替换到边框的相关标记中,位置由wicket:body标记指示。
关于wicket:body/你有两个选择。使用wicket:body/(打开-关闭标记),该标记将自动扩展为wicket:body正文内容</wicket:body>,或者在边框的标记中使用wicket:body预览区域</wicket:body>。预览区域(打开和关闭标记之间的所有内容)将自动删除。
边框主体容器将自动为您创建并添加到边框容器中。可通过#getBodyContainer()访问。如果body标记不是border的直接子级(请参见下面的示例),则必须使用someContainer.add(getBodyContainer())等代码将body组件添加到正确的容器中。

<html> 
<body> 
<wicket:border> 
<span wicket:id="someContainer"> 
<wicket:body/> 
</span> 
</wicket:border> 
</body> 
</html>

上一个示例中的组件“someContainer”必须添加到边框,而不是主体,这是通过#AddToOrder(组件…)实现的。
#添加(组件…)是getBodyContainer()的别名。添加(组件…)并将向边框体添加子组件,如下面的示例所示。

<html> 
<body> 
<span wicket:id = "myBorder"> 
<input wicket:id="name"/;> 
</span> 
</body> 
</html>

此实现不会对组件处理应用任何魔法。毫无疑问,你要想得简单。但是,可以使用MarkupContainer或组件执行的所有操作,也可以使用边框或其主体执行。
其他方法,如#remove()、#get(int)、#iterator()等,在边界体上没有别名,需要使用时必须注意。

代码示例

代码示例来源:origin: de.agilecoders.wicket/wicket-bootstrap-core

@Override
  protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    Attributes.addClass(tag, "input-group");
  }
}

代码示例来源:origin: org.opensingular/wicket-utils

@Override
public BSModalBorder add(Behavior... behaviors) {
  return (BSModalBorder) super.add(behaviors);
}

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

@Override
public Border removeAll()
{
  getBodyContainer().removeAll();
  return this;
}

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

@Override
public Border remove(final Component component)
{
  if (component == body)
  {
    // in this case we do not want to redirect to body
    // container but to border's old remove.
    removeFromBorder(component);
  }
  else
  {
    getBodyContainer().remove(component);
  }
  return this;
}

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

/**
 * @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
 *      org.apache.wicket.markup.ComponentTag)
 */
@Override
protected final void onComponentTagBody(final MarkupStream markupStream,
  final ComponentTag openTag)
{
  // Remember the data for easy access by the Body component
  this.openTag = openTag;
  originalMarkupStream = getMarkupStream();
  // Remember the current position (start of border-body) of the markupstream
  beginOfBodyIndex = originalMarkupStream.getCurrentIndex();
  // body.isVisible(false) needs a little extra work. We must skip the
  // markup between <span wicket:id="myBorder"> and </span>
  if (isBodyVisible() == false)
  {
    originalMarkupStream.skipToMatchingCloseTag(openTag);
  }
  // Render the associated markup
  renderAssociatedMarkup("border",
    "Markup for a border component must begin a tag like '<wicket:border>'");
}

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

@Override
public Border replace(final Component replacement)
{
  if (body.getId().equals(replacement.getId()))
  {
    // in this case we do not want to redirect to body
    // container but to border's old remove.
    replaceInBorder(replacement);
  }
  else
  {
    getBodyContainer().replace(replacement);
  }
  return this;
}

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

/**
 * Update the 'visible' flag to indicate the existence (or lack thereof) of feedback messages
 */
@Override
protected void onBeforeRender()
{
  super.onBeforeRender();
  // Get the messages for the current page
  visible = new FeedbackCollector(getPage()).collect(getMessagesFilter()).size() > 0;
}

代码示例来源:origin: org.jabylon/rest.ui

@Override
protected void onInitialize() {
  super.onInitialize();
  final List<FormComponent<?>> formComponents = collectFormComponents();
  for (FormComponent<?> formComponent : formComponents) {
    formComponent.setOutputMarkupId(true);
  }
  final int size = formComponents.size();
  if (size > 0) {
    FormComponent<?> formComponent = formComponents.get(size - 1);
    label.add(new AttributeModifier("for", formComponent.getMarkupId()));
  }
}

代码示例来源:origin: de.agilecoders.wicket/bootstrap

@Override
  protected void onConfigure() {
    super.onConfigure();

    if(provider != null) {
      add(provider.newCssClassNameModifier());
    }
  }
}

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

addToBorder(component);
getBodyContainer().add(component);

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

/**
 * @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
 *      org.apache.wicket.markup.ComponentTag)
 */
protected final void onComponentTagBody(final MarkupStream markupStream,
  final ComponentTag openTag)
{
  // Remember the data for easy access by the Body component
  this.openTag = openTag;
  originalMarkupStream = getMarkupStream();
  // Remember the current position (start of border-body) of the markupstream
  beginOfBodyIndex = originalMarkupStream.getCurrentIndex();
  // body.isVisible(false) needs a little extra work. We must skip the
  // markup between <span wicket:id="myBorder"> and </span>
  if (body.isVisible() == false)
  {
    originalMarkupStream.skipToMatchingCloseTag(openTag);
  }
  // Render the associated markup
  renderAssociatedMarkup("border",
    "Markup for a border component must begin a tag like '<wicket:border>'");
}

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

/**
 * Gets the container associated with &lt;wicket:body&gt;
 * 
 * @return The border body container
 */
public final BorderBodyContainer getBodyContainer()
{
  if (body == null)
  {
    body = (BorderBodyContainer)get(BODY_ID);
  }
  return body;
}

代码示例来源:origin: org.opensingular/singular-wicket-utils

@Override
public BSModalBorder addOrReplace(Component... children) {
  return (BSModalBorder) super.addOrReplace(children);
}

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

/**
 * Update the 'visible' flag to indicate the existence (or lack thereof) of feedback messages
 */
@Override
protected void onBeforeRender()
{
  super.onBeforeRender();
  // Get the messages for the current page
  visible = new FeedbackCollector(getPage()).collect(getMessagesFilter()).size() > 0;
}

代码示例来源:origin: de.agilecoders.wicket/bootstrap

@Override
protected void onInitialize() {
  super.onInitialize();
  final List<FormComponent<?>> formComponents = findFormComponents();
  for (final FormComponent<?> fc : formComponents) {
    fc.setOutputMarkupId(true);
    label.add(new AttributeModifier("for", fc.getMarkupId()));
  }
}

代码示例来源:origin: de.agilecoders.wicket/bootstrap

@Override
  protected void onConfigure() {
    super.onConfigure();

    Components.hideIfModelIsEmpty(title);
    image.setVisible(!Strings.isNullOrEmpty(getDefaultModelObjectAsString()));
  }
}

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

@Override
public Border replace(final Component replacement)
{
  if (body.getId().equals(replacement.getId()))
  {
    // in this case we do not want to redirect to body
    // container but to border's old remove.
    replaceInBorder(replacement);
  }
  else
  {
    getBodyContainer().replace(replacement);
  }
  return this;
}

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

@Override
public Border remove(final Component component)
{
  if (component == body)
  {
    // in this case we do not want to redirect to body
    // container but to border's old remove.
    removeFromBorder(component);
  }
  else
  {
    getBodyContainer().remove(component);
  }
  return this;
}

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

addToBorder(component);
getBodyContainer().add(component);

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

/**
 * Gets the container associated with &lt;wicket:body&gt;
 * 
 * @return The border body container
 */
public final BorderBodyContainer getBodyContainer()
{
  if (body == null)
  {
    body = (BorderBodyContainer)get(BODY_ID);
  }
  return body;
}

相关文章