我有一个面板,它在其中定义了一个其他面板应该去的地方。不能有任何继承,因为不仅有大量的继承,而且它们也将在整个应用程序中使用。
我想要“包含”的组件也会扩展面板本身。我希望能够像使用标记1的组件那样做,独立于组件2实现。
有可能吗?我完全知道继承是如何工作的。但是关于作文并没有多少......
stacktrace:
Last cause: The component(s) below failed to render. Possible reasons could be that: 1) you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered), 2) if your components were added in a parent container then make sure the markup for the child container includes them in <wicket:extend>.
1. [BlockingAjaxSubmitLink [Component id = link_language_add]]
2. [ListView [Component id = language_placeholder]]
3. [ListItem [Component id = 0]]
4. [LanguagePanel [Component id = language]]
5. [WebMarkupContainer [Component id = container_name]]
6. [TextField [Component id = name]]
7. [Component id = feedback_name]
8. [WebMarkupContainer [Component id = container_proficiency]]
9. [TextField [Component id = proficiency]]
10. [BlockingAjaxLink [Component id = link_remove]]
11. [ListItem [Component id = 1]]
12. [LanguagePanel [Component id = language]]
13. [WebMarkupContainer [Component id = container_name]]
14. [TextField [Component id = name]]
15. [Component id = feedback_name]
16. [WebMarkupContainer [Component id = container_proficiency]]
17. [TextField [Component id = proficiency]]
18. [BlockingAjaxLink [Component id = link_remove]]
所有这些组件都在表格内部或者至少应该在那里看到。
答案 0 :(得分:2)
好吧,我猜这是非常愚蠢的错误。
请记住WebMarkupContainer和Panel之间的区别。
小组 HAS 其自己的html文件并将其包含在内
,而
WebMarkupContainer 没有其拥有的html文件,并且只依赖于添加组件的文件中的标记。
非常感谢:)
答案 1 :(得分:1)
我明白了......好吧,试着保持这样的模式:Page - &gt;表格 - &gt;面板。而且,尝试将您的组件放在表单或面板中。
public class Page extends WebPage{
private MyForm myForm;
public Page(){
myForm = new()....;
}
}
public class MyForm extends Form<T>{
public MyForm(String id){
super(id);
}
}
public class MyPanel extends Panel{
//your components
public MyPanel(String id){
super(id);
}
}
[wicket:extend]
[form wicket:id="myForm"]
[div wicket:id="myPanel"/]
[form]
[/wicket:extend]
[wicket:panel]
[div wicket:id="myPanel"]
[/div]
[/wicket:panel]