I don't know about the mini veil, but shouldn't your label and button be set up
something like this:
In the class add a member that is your model string and then modify it in in
the AjaxButton#onSubmit(...)
String modelString = ""
...
final Label label = new Label("testLabel", new Model<String>("")
{
@Override
protected String getObject()
{
return modelString;
}
});
...
AjaxButton button = new AjaxButton("testVeil")
{
@Override
protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1)
{
modelString = "" + new Random().nextLong();
arg0.addComponent(label);
}
}
I have not used setDefaultModelObject(...) before. I read that you shouldn't
set a model object this way. Maybe that is causing a problem?
Warren
Jing Ge (Besitec IT DEHAM) wrote:
Hello,
After doing this change, the project can be compiled and run. But I get
another problem.
Here is my test code:
final Label label = new Label("testLabel", new
Model<String>(""));
add(label);
Form form = new Form("testForm");
AjaxButton button = new AjaxButton("testVeil") {
@Override
protected void onSubmit(AjaxRequestTarget arg0, Form<?>
arg1) {
try {
Thread.sleep(5000);
label.setDefaultModelObject("" + new
Random().nextLong());
arg0.addComponent(label);
} catch (InterruptedException ex) {
Logger.getLogger(HomePage.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
button.add(new Veil());
form.add(button);
add(form);
After the application is deployed and running, the ajax button is
disabled. Did I do something wrong?
Best regards!
Jing Ge
-----Original Message-----
From: Jing Ge (Besitec IT DEHAM) [mailto:[email protected]]
Sent: Mittwoch, 17. Juni 2009 10:18
To: [email protected]
Subject: RE: wicketstuff mini veil
Hello,
Should it be:
super.bind(component);
if (this.component != null) {
.........
}
regards!
Jing Ge
-----Original Message-----
From: Jing Ge (Besitec IT DEHAM) [mailto:[email protected]]
Sent: Mittwoch, 17. Juni 2009 10:15
To: [email protected]
Subject: wicketstuff mini veil
Hallo,
I have checked out the source code and taken a look at the class Veil. I
found the following code:
public void bind(Component component)
{
super.bind(component);
if (component != null)
{
throw new IllegalStateException(
"This behavior is
already bound to component. An instance of this behavior cannot be
reused between components. Bound component: "
+ this.component.toString());
}
this.component = component;
}
From the code we can see, the component will be checked after binding.
If it is null, an exception will be thrown.
Well, actually, I don't get it. Since the component can not be null
after binding, the exception will be always thrown. Show me if I am
wrong.
Has anyone ever used the mini veil? Could anyone give me hand? Thanks.
Best regards!
Jing Ge
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Thanks,
Warren Bell
909-645-8864
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]