Inside my panel I am adding a listView to a table with a detachable Model:
Edit:
public class TaskDetailsPanel extends Panel {
...
public TaskDetailsPanel(String id, CompoundPropertyModel<LongRunningTask> model) {
super(id, model);
Task task = (LongRunningTask) getDefaultModelObject();
List<Timeframe> testList = task.getTimeframes();
DetachableTimeframeModel dtm = new DetachableTimeframeModel(new Model<Task>(task));
ListView frames = new ListView("frame", dtm) {
@Override
protected void populateItem(ListItem item) {
Timeframe tf = (Timeframe) item.getModelObject();
item.add(new Label("time", "von - bis"));
item.add(new Label("sentFiles", String.valueOf(tf.getSentFiles())));
item.add(new Label("receivedFiles", String.valueOf(tf.getReceivedFiles())));
item.add(new Label("missingMsgIds", String.valueOf(tf.getMissingMsgIds())));
item.add(new Label("receivedMsgIds", String.valueOf(tf.getReceivedMsgIds())));
}
};
frames.setOutputMarkupId(true);
add(frames);
...
}
}
Here is my custom detable Model:
class DetachableTimeframeModel extends LoadableDetachableModel {
LongRunningTask task;
public DetachableTimeframeModel(LongRunningTask t) {
task = t;
}
@Override
protected List<Timeframe> load() {
return task.getTimeframes();
}
}
When I define a new list List (e.g. ArrayList) inside the panel and add items to it, then it works. But when the list comes from another javabean then it fails.
What am I missing?