我正在尝试将以下代码从wicket-1.4.9转换为wicket-6.x / 7.x,但未获得解决方案。请帮忙,因为我是Apache Wicket的新手
@Override
protected IFeedbackMessageFilter[] getFilters() {
final List<IFeedbackMessageFilter> filters = new ArrayList<IFeedbackMessageFilter>();
getPage().visitChildren(FeedbackPanel.class, new IVisitor<FeedbackPanel>() {
@Override
public Object component(FeedbackPanel component) {
if (pageFeedback.equals(component)) {
return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
filters.add(component.getFilter());
return CONTINUE_TRAVERSAL;
}
});
return filters.toArray(new IFeedbackMessageFilter[filters.size()]);
}
答案 0 :(得分:0)
应该是这样的:
@Override
protected IFeedbackMessageFilter[] getFilters() {
final List<IFeedbackMessageFilter> filters = new ArrayList<IFeedbackMessageFilter>();
getPage().visitChildren(FeedbackPanel.class, new IVisitor<FeedbackPanel, Void>() {
@Override
public void component(FeedbackPanel component, IVisit<Void> visit) {
if (pageFeedback.equals(component)) {
visit.dontGoDeeper();
return;
}
filters.add(component.getFilter());
}
});
return filters.toArray(new IFeedbackMessageFilter[filters.size()]);
}