org.apache.wicket.util.lang.Objects.cloneModel()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(79)

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

Objects.cloneModel介绍

[英]Makes a deep clone of an object by serializing and deserializing it. The object must be fully serializable to be cloned. This method will not clone wicket Components, it will just reuse those instances so that the complete component tree is not copied over only the model data.
[中]通过序列化和反序列化对象来对其进行深度克隆。对象必须完全可序列化才能克隆。这种方法不会克隆wicket组件,它只会重用这些实例,这样完整的组件树就不会只复制模型数据。

代码示例

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

/**
 * This method should be implemented by subclasses to provide behavior for the clear button.
 * 
 * @param button
 *            the 'clear' button
 * 
 */
@SuppressWarnings("unchecked")
protected void onClearSubmit(Button button)
{
  Form<Object> form = (Form<Object>)button.getForm();
  form.setDefaultModelObject(Objects.cloneModel(originalState));
}

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

/**
 * Constructor
 * 
 * @param id
 *            component id
 * @param form
 *            filter form of the filter toolbar
 * @param goModel
 *            model for the label of the 'go' button
 * @param clearModel
 *            model for the label of the 'clear' button
 */
public GoAndClearFilter(String id, FilterForm<?> form, IModel<String> goModel,
  IModel<String> clearModel)
{
  super(id, goModel);
  originalState = Objects.cloneModel(form.getDefaultModelObject());
  clear = new Button("clear", clearModel)
  {
    private static final long serialVersionUID = 1L;
    @Override
    public void onSubmit()
    {
      onClearSubmit(this);
    }
  };
  clear.setDefaultFormProcessing(true);
  add(clear);
}

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

originalModel = (IModel)Objects.cloneModel(model);

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

originalModel = (IModel<?>)Objects.cloneModel(model);

相关文章