Thank you, Marijn. I've actually looked over the model page a few
times in the past. I guess I just don't have a full handle on
models, in general. Using the LoadableDetachableModel did resolve my
problem - thanks! Below are the working code snippets:
public Gbrowse(String id, String position, String[] sources) {
super(id);
setPosition(position);
setSources(sources);
Label label = new Label("gbrowse", new
LoadableDetachableModel() {
@Override
protected Object load() {
return getGbrowse(getPosition(), getSources());
}
});
label.setEscapeModelStrings(false);
add(label);
}
gbrowse = new Gbrowse("gbrowse", getPosition(), new String[]
{"CHOPCNVs", "CHOPCNVRs", "CHOPCNVBlocks"});
gbrowse.setOutputMarkupId(true);
form.add(gbrowse);
...
//submit button
AjaxSubmitLink asl = new AjaxSubmitLink("submit") {
public void onSubmit(AjaxRequestTarget target, Form form) {
try {
gbrowse.setPosition(position);
target.addComponent(gbrowse);
...
I'd like for the position to automatically get updated, instead of
having to call setPosition(). I feel like this can be accomplished
using LoadableDetachableModel, as well. I tried replacing getPosition
() with a LoadableDetachableModel that returns getPosition() in the
load() method during the instantiation of Gbrowse, but it looks to
always be null. I'm happy to have it working, but I'd like to use
the LDM if that's that way to go. Any advice? Thanks, again.
Ryan
On Jul 29, 2008, at 11:43 AM, Martijn Dashorst wrote:
Read this page: http://cwiki.apache.org/WICKET/working-with-wicket-
models.html
And after that:
public Gbrowse(String id, final String position, final String[]
sources) {
super(id);
Label label = new Label("gbrowse", new
LoadableDetachableModel() { @Override Object load() { return
getGbrowse(position,sources); });
label.setEscapeModelStrings(false);
add(label);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]