侦察员蚀形式模板 [英] Scout eclipse form template

查看:71
本文介绍了侦察员蚀形式模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表示我的 Scout Explorer视图的树中看到了我的应用程序模板节点下的两个子文件夹:

I see in the tree representing my applications in the Scout Explorer view that I have two subfolders under the template node :

  • 表格
  • 表单字段

我知道如何添加表单字段,而且非常简单,但是我不知道如何创建表单模板,因此无法在Internet上找到它.

I know how to add form fields and its pretty simple, but I don't know how to create a form template and I can't find it on internet.

Marko

现在,我了解了如何向发件人"模板文件夹中添加表单.您只需要添加abstract标记,然后就可以从该模板创建新表单.

Now I figure out how to add form to From template folder. You just need to add abstract tag and then you can create new form from this template.

现在,我需要将默认主机箱类从:AbstractGroupBox更改为AbstractMyGroupBox. 要理解,我需要在AbstractMyForm内进行某种设置,以使所有来自AbstractMyForm模板的表格都具有:

Now I need to change default main box class from : AbstractGroupBox to AbstractMyGroupBox. To be understand, what I need is to set somehow inside AbstractMyForm, that all form that come from AbstractMyForm template have instead :

public class TestFromForm extends AbstractMyForm

...

@Order(10.0)
@ClassId("e23ebc80-d948-4e23-aff6-ae49d3278331")
public class MainBox extends AbstractGroupBox {
    @Order(10.0)
    @ClassId("571bc88f-67ee-454d-b6ce-9616bc43bf74")
    public class OkButton extends AbstractOkButton {
    }
    @Order(20.0)
    @ClassId("66969857-002f-4689-981e-20ab60bbaf0e")
    public class CancelButton extends AbstractCancelButton {
    }
}

拥有这个:

@Order(10.0)
@ClassId("e23ebc80-d948-4e23-aff6-ae49d3278331")
public class MainBox extends AbstractMyGroupBox {

}

推荐答案

您是对的; Scout透视图中没有任何支持来创建表单模板.您需要使用IDE中的Java工具.

You are right; there isn't any support in the Scout Perspective to create a form template. You need to use the Java tooling from the IDE.

表单模板不过是扩展org.eclipse.scout.rt.client.ui.form.AbstractForm的Abstract类.模板可以位于所需的位置(有意义的位置,具体取决于您的代码组织).可能的软件包:<your_app>.client.ui.template.form.

A form template is nothing more than an Abstract class extending org.eclipse.scout.rt.client.ui.form.AbstractForm. Your template can be located where you want (where it makes sense, depending on your code organization). Possible package: <your_app>.client.ui.template.form.

这是一个最小的示例:

import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.rt.client.ui.form.AbstractForm;

public abstract class AbstractMyForm extends AbstractForm {

  /**
   * @throws ProcessingException
   */
  public AbstractMyForm() throws ProcessingException {
    super();
  }
}

表单和Mainbox

请注意,一个Form(是否与模板一起使用)只有一个MainBox(一个包含子字段树的根组框).它是在Form初始化期间加载的. (请参见基于示例的扩展答案.)

从私有方法AbstractForm.getConfiguredMainBox()的实现中,我可以推断出只有第一个实现IGroupBox的内部类被选中.

From the implementation of the private method AbstractForm.getConfiguredMainBox() I can deduce that only the first inner class implementing IGroupBox is selected.

因此,表单模板适合在表单级别上相互逻辑.有时还会有一些表单处理程序或工具按钮.

Therefore Form Templates are suitable to mutualize logic on at form level. Sometime also some form handlers or tool buttons.

如果想法是使多个表单之间的公共字段相互关联,则有可能对主框本身使用字段模板:

If the idea is to mutualize common fields between multiple forms, a possibility is to use a field template for the main box itself:

@Order(10.0)
public class MainBox extends AbstractMyTemplateGroupBox {
    //…
}


在不了解用例的情况下,很难说出应该怎么做.


Without knowing more on the use case, it is hard to tell what you should do.

这篇关于侦察员蚀形式模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆