我正在使用一个应用程序,在该应用程序中,我需要将一组子面板添加到属于页面一部分的其他包含父面板。
一次可以有 1 到 3 个父面板,父面板之间总共可以有 7 个子面板。
我把它放到了所有东西都被正确添加的地方,但是当试图对通过检票口中继器添加的这些面板进行样式设置时,我的正常方法都不起作用。
我已经尝试覆盖 ListView 的 populateItem 方法,如下所示:https ://cwiki.apache.org/WICKET/listview-and-other-repeaters.html和https://cwiki.apache.org/WICKET/page -with-dynamic-components.html
add(new ListView<ParentPanel>("parentPanels", panels) {
@Override
protected void populateItem(ListItem<ParentPanel> item) {
ParentPanel temp = (ParentPanel) item.getModelObject();
temp.add(new AttributeAppender("class", new Model<String>("panelClass"), ""));
item.add(temp);
}
});
...或在标记中:
<wicket:container wicket:id="listOfPanels">
<wicket:panel wicket:id="panelClass"/>
</wicket:container>
...甚至将属性修饰符添加到要添加的面板的构造函数中。
这一切似乎都被忽略了。我错过了一些基本的东西吗?如果我不必计算要添加的面板的数量和类型,这将不是问题,但是使用中继器会删除样式吗?