如何在检票口 6.x 或 7.x 中使用受保护的 IFeedbackMessageFilter[] getFilters()
How to use protected IFeedbackMessageFilter[] getFilters() in wicket 6.x or 7.x
我正在尝试将以下代码从 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()]);
}
应该是这样的:
@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()]);
}
我正在尝试将以下代码从 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()]);
}
应该是这样的:
@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()]);
}