简体   繁体   English

Scout Eclipse TablePage模板

[英]Scout Eclipse TablePage Template

I want to create AbstractTemplatePageWithTable as template. 我想创建AbstractTemplatePageWithTable作为模板。

My problem is that when you create template : 我的问题是,当您创建模板时:

 MyPageTemplateTablePage
           |
           ---> MyTable Extends AbstractTable

or in code 或用代码

public abstract class MyPageTemplateTablePage extends AbstractExtensiblePageWithTable<MyTable> {

  @Override
  protected String getConfiguredTitle() {

    return TEXTS.get("bla bla");
  }


  public abstract class MyTable extends AbstractExtensibleTable {


  }
}

But When I create Page from this template it create "only" page. 但是,当我从此模板创建Page时,它将创建“仅”页面。

 @PageData(MyPageTablePageData.class)
 public class MyPageTablePage extends MyPageTemplateTablePage {

   @Override
   protected String getConfiguredTitle() {

     return TEXTS.get("MyPage");
    }
  }

What I would want is that it is created : 我想要的是创建它:

@PageData(MyPageTablePageData.class)
 public class MyPageTablePage extends MyPageTemplateTablePage {

   @Override
   protected String getConfiguredTitle() {

     return TEXTS.get("MyPage");
    }

    @Order(10.0)
    public class table extends MyPageTemplateTablePage.MyTable {


    }
  }

Because when you create template, it should be user-friendly and provide table. 因为创建模板时,它应该是用户友好的并提供表格。 Is there some annotation or something to convince scout-eclipse creator of class to create this table to. 是否有一些注解或其他东西可以说服类的侦察员创建者创建此表。

It is really hard to have wizards that suit all needs in the Scout SDK. 在Scout SDK中很难拥有适合所有需求的向导。 Since Scout is plain Java you can organize the code as you like. 由于Scout是纯Java,因此您可以根据需要组织代码。 There are 2 classes: Table and TablePage having the Table as inner class of the TablePage is convenient but not mandatory especially if you are preparing templates. 有2类: TableTablePage具有Table作为内部类的TablePage是方便,但不是强制性的,特别是如果你正在准备模板。

If you have logic on your table (like common methods or inner classes for menus or columns) I recommend you to create a first Table template: 如果您在表上有逻辑(例如常用方法或菜单或列的内部类),则建议您创建第一个Table模板:

public abstract class AbstractMyTable extends AbstractTable {
  //some custom logic.
}

Then you can define a TablePage template using Generic. 然后,您可以使用Generic定义TablePage模板。 You can even restrict the table to be from type AbstractMyTable 您甚至可以将表限制为AbstractMyTable类型

public abstract class AbstractMyTablePage<T extends AbstractMyTable> extends AbstractPageWithTable<T> {
  //some custom logic.
}

You might lose some of the SDK support using this pattern, but when you create a new table page you can modify your code to use your table template and your table page template: 使用此模式可能会失去一些SDK支持,但是在创建新的表格页面时,您可以修改代码以使用表格模板和表格页面模板:

@PageData(XxxxTablePageData.class)
public class XxxxTablePage extends AbstractMyTablePage<Table> {

  @Order(1000.0)
  public class Table extends AbstractMyTable {

  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM