Hi.
I want to have a table with a Link PropertyColumn which contains a
LinkResource. When user clicks on the link I want to be able to pass the row
model to resource first and then have the resource loaded.
I created a ResourceLinkPropertyColumn class like:
public class ResourceLinkPropertyColumnT extends PropertyColumnT, String
{
private IModel labelModel;
private ByteArrayResource resource;
public ResourceLinkPropertyColumn(IModel displayModel, IModel
labelModel, ByteArrayResource resource) {
super(displayModel, null);
this.labelModel = labelModel;
this.resource = resource;
}
@Override
public void populateItem(Item item, String componentId, IModel model) {
item.add(new LinkPanel(item, componentId, model));
}
protected void onDone(IModelT rowModel) {
}
public ByteArrayResource getResource() {
return resource;
}
public class LinkPanel extends Panel {
public LinkPanel(final Item item, final String componentId,
final IModel
model) {
super(componentId);
ResourceLink link = new ResourceLink(link, resource) {
@Override
public void onClick() {
onDone(model);
super.onClick();
}
protected void onComponentTag(ComponentTag
componentTag) {
super.onComponentTag(componentTag);
componentTag.put(target, _blank);
}
};
add(link);
IModel tmpLabelModel = labelModel;
if (labelModel == null) {
tmpLabelModel = getDataModel(model);
}
link.add(new Label(label, tmpLabelModel));
}
}
}
When I create my data table I add my column like:
columns.add(new ResourceLinkPropertyColumnUser(new
ModelString(Generate), new ModelString(Generate),new
MyByteArrayResource()) {
protected void onDone(IModelUser rowModel) {
final MyObject object = rowModel.getObject();
((MyByteArrayResource)getResource()).setMyObject(object);
}
});
The problem is that when I click the link the resource is loaded first and
then my onDone method is called.
Is there any possibility to pass the model to the resource before it is
loaded?
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-LinkResource-with-a-dynamic-resource-tp4657238.html
Sent from the Users forum mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org