so you are saying that this little piece of code:
TextField tf =3D new TextField(qid + "Cat", new PropertyModel(pojoObj,
"text"));
boolean test =3D pojoObject.getText().equals(tf.getModelObject());
then test is false?
On 10/28/05, Chantal Ackermann <[EMAIL PROTECTED]> wrote:
Hello all, hello Igor,
thanks for your helpful reply.
I adjusted the code so that only the return of
TextField.getModelObjectAsString is set in the approriate POJO, which
is then written to the database, and the ComboBox gets updated. The
backend routines are all called as expected.
but...
I still do not get a value from the TextField. I tried PropertyModel
and Model and both have a null ModelObject and thus return an empty
string on getModelObjectAsString().
Here is my logging output with Model:
INFO - NaviPage -
NewCategoryButton.onSubmit():semNaviButton
INFO - NaviPage - TextField Model:
Model:classname=3D[wicket.model.Model]:nestedModel=3D[null]:
object=3D[nul=
l]
INFO - NaviPage - TextField ModelObject: null
INFO - NaviPage - TextField ModelObjectString:
with PropertyModel:
INFO - NaviPage -
NewCategoryButton.onSubmit():semNaviButton
INFO - NaviPage - TextField Model:
Model:classname=3D[wicket.model.PropertyModel]:attached=3Dfalse:
nestedModel=3D[null]:expression=3D[text]:propertyType=3D[null]
INFO - NaviPage - TextField ModelObject: null
INFO - NaviPage - TextField ModelObjectString:
Instantiation of the TextField with Model:
TextField tf =3D new TextField(qid + "Cat", new Model());
with PropertyModel:
TextField tf =3D new TextField(qid + "Cat", new PropertyModel(pojoObj,
"text"));
The onSubmit Method of the Button Subtype:
public void onSubmit()
{
log.info("NewCategoryButton.onSubmit():" + getId());
IModel m =3D textField.getModel();
log.info("TextField Model: " + m);
log.info("TextField ModelObject: " + textField.getModelObject());
log.info("TextField ModelObjectString: " +
textField.getModelObjectAsString());
ids.setText(textField.getModelObjectAsString());
getDao().merge(ids);
choice.setChoices(getDao().findAllFromClass(ids.getClass()));
choice.updateModel();
}
I did realize though, that the nested Model was the wrong way to go.
But why is the Model Object null? IMHO this one is the object that is
used to return the String value from, inside getModelObjectAsString.
Do
I have to set it myself? (I thought at least PropertyModel would use
my
POJO?) I can't find a hint in the API.
I am quite sure that I missed something crucially substantial about
Models... ^^
Best regards,
Chantal
From: "Igor Vaynberg" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Subject: RE: [Wicket-user] Accessing the PropertyModel of a TextField
(former How can a model wrap more than one POJO)
Date: Wed, 26 Oct 2005 09:36:57 -0700
Reply-To: wicket-user@lists.sourceforge.net
The nested model does not refer to your object, it refers to a model
nested
inside the current model (notice the Imodel return type). Some models
support this, others don't. The property model does not. It has its
own
internal pointer to your object. To get the text from the textfield
simply
do: textfield.getModelObjectAsString() - this does the following -
retrieve
the model from the textfield which is your property model, calls
getModelObject on the property model which retrieves the property
from
your
model object, and then casts that to a string all in one convinient
step.
-Igor
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
------=_Part_2386_20491034.1130508895300
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
so you are saying that this little piece of code:<br>
<br>
TextField tf =3D new TextField(qid + "Cat", new
PropertyModel(poj=
oObj, "text"));<br>
boolean test =3D pojoObject.getText().equals(tf.getModelObject());<br>
<br>
then test is false?<br>
<br>
<br><br><div><span class=3D"gmail_quote">On 10/28/05, <b
class=3D"gmail_sen=
dername">Chantal Ackermann</b> <<a
href=3D"mailto:[EMAIL PROTECTED]
de">[EMAIL PROTECTED]</a>> wrote:</span><blockquote
class=3D"gmai=
l_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin:
0pt 0p=
t 0pt 0.8ex; padding-left: 1ex;">
Hello all, hello Igor,<br><br>thanks for your helpful reply.<br><br>I
adjus=
ted the code so that only the return
of<br>TextField.getModelObjectAsString=
is set in the approriate POJO, which<br>is then written to the
database, a=
nd the ComboBox gets updated. The
<br>backend routines are all called as
expected.<br><br>but...<br><br>I sti=
ll do not get a value from the TextField. I tried PropertyModel<br>and
Mode=
l and both have a null ModelObject and thus return an empty<br>string
on ge=
tModelObjectAsString().
<br><br>Here is my logging output with Model:<br><br>INFO -
NaviPage
&=
nbsp;
-<br>NewCategoryButton.onSubmit():semNaviButton<br>INFO -
NaviPage
&=
nbsp;
- TextField
Model:<br>Model:classname=3D[wicket.model.Model]:nestedModel=3D=
[null]:object=3D[null]<br>INFO -
NaviPage
&=
nbsp;
- TextField ModelObject: null<br>INFO -
NaviPage
&=
nbsp;
- TextField ModelObjectString:<br><br>with
PropertyModel:<br><br>INFO =
-
NaviPage
&=
nbsp;
-<br>NewCategoryButton.onSubmit():semNaviButton<br>INFO -
NaviPage
&=
nbsp;
- TextField
Model:<br>Model:classname=3D[wicket.model.PropertyModel]:attach=
ed=3Dfalse:<br>nestedModel=3D[null]:expression=3D[text]:
propertyType=3D[nul=
l]<br>INFO -
NaviPage
&=
nbsp;
- TextField ModelObject: null<br>INFO -
NaviPage
&=
nbsp;
- TextField ModelObjectString:<br><br><br>Instantiation of the
TextField wi=
th Model:<br><br>TextField tf =3D new TextField(qid + "Cat",
new =
Model());<br><br>with PropertyModel:<br><br>TextField tf =3D new
TextField(=
qid + "Cat", new PropertyModel(pojoObj,
<br>"text"));<br><br>The onSubmit Method of the Button
Subtype:<b=
r><br>
&nb=
sp; public void
onSubmit()<br> &nbs=
p;
{=
<br>
 =
;
lo=
g.info("NewCategoryButton.onSubmit():"
+
getId());<br>
=
&nb=
sp; IModel
m =3D
textField.getModel();<br> &n=
bsp;
 =
; log.info("TextField
Model: " +
m);<br> &nbs=
p;
&=
nbsp; log.info("TextField
ModelObject: " +
textField.getModelObject());<br> &nb=
sp;
=
log.info("
TextField
ModelObjectString: "
+<br>textField.getModelObjectAsString());<br>&nbs=
p;
&=
nbsp;
ids.setTex=
t(textField.getModelObjectAsString());<br>
&nb=
sp;
=
getDao().merge(ids);<br>
&nb=
sp;
=
choice.setChoices
(getDao().findAllFromClass(ids.getClass()));<br>
&nb=
sp;
=
choice.updateModel();
<br> &n=
bsp;
 =
; }<br><br>I did realize though, that the nested Model was
the w=
rong way to go.<br>But why is the Model Object null? IMHO this one is
the o=
bject that is
<br>used to return the String value from, inside
getModelObjectAsString. Do=
<br>I have to set it myself? (I thought at least PropertyModel would
use my=
<br>POJO?) I can't find a hint in the API.<br><br>I am quite sure that
I mi=
ssed something crucially substantial about
<br>Models... ^^<br><br>Best regards,<br>Chantal<br><br>> From:
"Ig=
or Vaynberg" <<a
href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
rivesec.com</a>><br>> To: <<a
href=3D"mailto:[EMAIL PROTECTED]
rceforge.net">
wicket-user@lists.sourceforge.net</a>><br>> Subject: RE:
[Wicket-user=
] Accessing the PropertyModel of a TextField<br>> (former How can a
mode=
l wrap more than one POJO)<br>> Date: Wed, 26 Oct 2005 09:36:57
-0700
<br>> Reply-To: <a
href=3D"mailto:wicket-user@lists.sourceforge.net">wic=
[EMAIL PROTECTED]</a><br>><br>> The nested model
does no=
t refer to your object, it refers to a model<br>> nested<br>>
inside =
the current model (notice the Imodel return type). Some models
<br>> support this, others don't. The property model does not. It
has it=
s own<br>> internal pointer to your object. To get the text from
the tex=
tfield<br>> simply<br>> do: textfield.getModelObjectAsString() -
this=
does the following -
<br>> retrieve<br>> the model from the textfield which is your
proper=
ty model, calls<br>> getModelObject on the property model which
retrieve=
s the property from<br>> your<br>> model object, and then casts
that =
to a string all in one convinient
<br>> step.<br>><br>>
-Igor<br>><br><br><br><br>---------------=
----------------------------------------<br>This SF.Net email is
sponsored =
by the JBoss Inc.<br>Get Certified Today * Register for a JBoss
Training Co=
urse
<br>Free Certification Exam for All Training Attendees Through End of
2005<=
br>Visit <a
href=3D"http://www.jboss.com/services/certification">http://www=
.jboss.com/services/certification</a> for more
information<br>_____________=
__________________________________
<br>Wicket-user mailing list<br><a
href=3D"mailto:[EMAIL PROTECTED]
orge.net">Wicket-user@lists.sourceforge.net</a><br><a
href=3D"https://lists=
.sourceforge.net/lists/listinfo/wicket-user">https://
lists.sourceforge.net/=
lists/listinfo/wicket-user
</a><br></blockquote></div><br>
------=_Part_2386_20491034.1130508895300--
--__--__--
Message: 3
Date: Fri, 28 Oct 2005 16:23:53 +0200
From: Juergen Donnerstag <[EMAIL PROTECTED]>
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Make
wicket.markup.html.navigation.paging.PagingNavigationLink non-final.
Reply-To: wicket-user@lists.sourceforge.net
Why? What is your use case?
Juergen
On 10/28/05, Janne Hietam=E4ki <[EMAIL PROTECTED]> wrote:
Hi,
Class wicket.markup.html.navigation.paging.PagingNavigationLink is
final, but
wicket.markup.html.navigation.paging.PagingNavigationIncrementLink is
not. Could these both be non-final?
Thanks.
--
Janne Hietam=E4ki
Cemron Ltd
http://www.cemron.com/
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
--__--__--
Message: 4
Date: Fri, 28 Oct 2005 16:27:22 +0200
From: Davide Savazzi <[EMAIL PROTECTED]>
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] replace ognl.
Reply-To: wicket-user@lists.sourceforge.net
On 10/27/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
That NPE is already handled.
When you do a get a and somewhere in the line a null is encountered
then
null is returned
Great!!!
I still am thinking of a way to create the null object then this can
be
automatic if the object
i have to create has a default constructor and a setMethod is there
for
that object on its parent.
Wow, that's exactly what I need!!! So I don't have to create empty
objects in my model anymore!
For example the parent object could implement an interface called
INullHandler with one method createObject(property)
Then the parent object is responsable for making the missing field
that =
it
has.
But don't know about this because such an interface is wicket
specific (=
so
ui specific) and the objects are or can be database things
Those worlds should be seperate.
The interface could be optional: if the parent implements this
interface, Wicket uses it, otherwise it tries the default child object
constructor.
--
Davide Savazzi
--__--__--
Message: 5
Date: Fri, 28 Oct 2005 17:36:18 +0300
From: =?ISO-8859-1?Q?Janne_Hietam=E4ki?= <[EMAIL PROTECTED]>
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Make
wicket.markup.html.navigation.paging.PagingNavigationLink
non-final.
Reply-To: wicket-user@lists.sourceforge.net
Juergen Donnerstag wrote:
Why? What is your use case?
Juergen
I need to have an OnClickScript on my paging links to do some ajaxian
stuff.
--
Janne Hietamäki
Cemron Ltd
http://www.cemron.com/
--__--__--
Message: 6
Date: Fri, 28 Oct 2005 08:40:51 -0700
From: Phil Kulak <[EMAIL PROTECTED]>
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] replace ognl.
Reply-To: wicket-user@lists.sourceforge.net
I like the idea of being able to plug in OGNL if you really need it.
Now that I think about it, I've got a couple ChoiceRenderers that call
functions using OGNL. Although, it probably would be very easy to
rewrite these by just implementing the interface myself, and much more
efficient.
--__--__--
Message: 7
Date: Fri, 28 Oct 2005 08:57:05 -0700
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] DropDownChoice and RadioChoice
From: "David Ruberg" <[EMAIL PROTECTED]>
Organization: nondesign
Reply-To: wicket-user@lists.sourceforge.net
On Fri, 28 Oct 2005 01:39:54 -0700, Johan Compagner
<[EMAIL PROTECTED]>
wrote:
this looks like the most commor error people are making with this.
I will try to see if i can check this earlier and really throw a
better
error.
The problem looks like that youre Selected object is not the same as
youre
List obect
It has to be of the same type!
what is returned from USState.getStates()?
something like a State object yes?
With a code property?
So then the seleted value must also be a state object (and not the
code
property!!)
I youre selected value is the code property. Then you need to give the
Choice a list of Codes.
(so not states)
i see that youre display value is the same as the id value (both are
the
code)
so you don't have to give a choicerender to the Choice constructor.
Thanks for the reply.
In my first post, I had a couple of issues, and I don't want to lose
sight
of the other, because it is actually a bigger problem. That is in the
case that I do just use a simple list of strings, like this:
new DropDownChoice("id", LIST_OF_STRINGS);
I don't get any default values (either "Choose One" or from my
properties
file), instead the default selected value is the first in the list.
If I
do this:
new DropDownChoice("id", new Model(), LIST_OF_STRINGS)
I get the a default value, but it will always be marked as selected in
the
html, in addition to whatever is actually selected, so what is actually
selected is never persisted to the object model.
About ChoiceRenderer:
The case above with display value the same as id value - I need to be
able
to have them be different in other cases.
I do remeber seeing something about the selected object being of the
same
type, and I tested that, and it seemed to work, but I need to persist
just
the code String into the model, not the USState object.
Perhaps I don't understand the intended usage here.
It seems like the type of thing I want to do must be fairly common.
Say I
want to list US States by full name, but persist the abbreviation
(code)
in my model. A map of Strings in the front end (display, value) to a
String in the model (value). Is there a simple way to do this?
--__--__--
Message: 8
Date: Fri, 28 Oct 2005 09:06:34 -0700
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] DropDownChoice and RadioChoice
From: "David Ruberg" <[EMAIL PROTECTED]>
Organization: nondesign
Reply-To: wicket-user@lists.sourceforge.net
On Fri, 28 Oct 2005 01:22:39 -0700, Dipu <[EMAIL PROTECTED]> wrote:
I think you should have your own implementation of the choice renderer
for this, and should override the getDisplayValue method.
something like
public String getDisplayValue(Object object)
{
USState state = (USState )object
return state.getCode();
}
and add tthe drop down as
new DropDownChoice("id", Lsit of State Objects, new YourRenderer());
hope this helps
Cheers
Dipu
Thanks.
I tried implementing my own ChoiceRenderer, but the problem was the
cast.
Sometimes I would get passed in a String instead of a USState. I think
this may be related what Johan mentioned in the other thread, about the
selected object not being the same type as the List object. The
problem
is, I don't want to select the object and place it in my model, I just
want a String. I built the USState objects because that is how the
framework seems to want you to do it if you want to have full control
over
the option display and value.
I hope that makes sense.
David
--__--__--
Message: 9
Date: Fri, 28 Oct 2005 09:03:56 -0700
From: Eelco Hillenius <[EMAIL PROTECTED]>
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] beforeCallComponent and afterCallComponent
Reply-To: wicket-user@lists.sourceforge.net
Yeah, we have done some ofline discussing on this topic too. For 1.2.
we could start thinking about a better model for handling urls.
Something like:
A. The creation of urls (e.g. for a link). Instead of letting urlFor
doing the whole url construction, we could have a strategy for this
(Igor wondered why we didn't have this in the first place). Now the
trick is (imo) that we should combine idea of reachability with the
idea of state management. That would mean letting components
contribute to that url constructing. Like: strategy implements the
'url stub' and collects the component's contribitions to this url.
What a url would look like however would be strategy dependend, so the
strategy has to know how to collect specific info. Strategy 1 could
result in a url like we have now, strategy 2 could result in something
like http://myhost/myapp/admin?path=3D3,form1=3D12341,form2=3Dsome
other
key. I'm just thinking out loud, but the plan is to have something
that enables us to be really smart with state handling; the above
example has form1 that has a detachable model with an object key
12341... that's the only thing needed for that form to be
reconstructed, as the rest (in my example the form has only components
with compound property models nested) can be derived. Oh, and this has
been about urls so far, but I really mean something a little bit more
abstract, so that a strategy can decide whether to end up with an
actual url, or something like a set of hidden form fields. Maybe.
B. The parsing of a request. Again this would be done by strategies.
The idea would be to 'mount' strategies to url patterns (akin to
mounting servlets and I think Tapestry's application services work
like that?). Steps would be like:
1. request comes in, Wicket looks for the mounted strategy for this
specific request.
2. strategy parses the request and tries to get/ rebuild the component
tree. Two concrete case are: a strategy that just needs the page id,
and gets it out of the session, and a strategy for bookmarkable pages
that needs the class name to create a page instance and then passes in
the url parameters. But if we think this through well, we could end up
having the ability to work with pages that doesn't have to be stored
in the session, but that can be reacreated on a request.
3. now that the component tree is available, optionally execute a
listener method. Again the strategy decides when/ how this is done.
It's easier to talk about this than write it down in a short time.
Anyway, I think something like above is the direction we need to go
for the ultra scalability.
Eelco
On 10/28/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
My question about this is can anybody name a Page that isn't a
webpage?
And that would also have a own requestcycle? that doesn't use a
componentListener?
Why i ask this. Could componentListener handling not pushed to
RequestCycle?
What is so WEB about it?
On 10/28/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
On 10/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Regarding the newly added 'around functionality' of WebRequestCycle
a=
nd
WebPage.
I certainly welcome this addition in the background of Spring
integration and AOP, but I see some problems with this implementation.
First of all we now have a new dependency to HTML markup in
WebRequestCycle.java:
WebPage are meant for HTML markup, which is why they have the prefix
"Web". The base clase Page is meant to be independent.
import wicket.markup.html.WebPage;
....
if (page instanceof WebPage)
{
((WebPage)page).beforeCallComponent(component, method);
}
......
if (page instanceof WebPage)
{
((WebPage)page).afterCallComponent(component, method);
}
Secondly WebPage.java has a new dependency on java.lang.reflect :
Is that realy a problem? It is not a dependency to another jar,
isn't i=
t?
import java.lang.reflect.Method;
....
public void beforeCallComponent(final Component component, final
Meth=
od
method)
public void afterCallComponent(final Component component, final
Metho=
d
method)
IMHO this lifecycle notification would be solved more elegant, if
the
latter two methods were moved into WebRequestCycle instead, serving as
hooks:
So your WebRequestCyle implementations will than look like
if (component is MyPageA)
...
else if (component is MyPageB)
..
else
else
else
Not sure, this is the better approach. Turning your argumentation
around, one could say: create a common base BasePage which implements
before/afterXXX and invoke an appropriate implementation in
MyWebRequestCycle if you realy want to do that. Actually, I like the
current implementation a little bit better.
/** Unchanged javadoc **/
protected void beforeCallComponent(final Component component, final
Method method) {}
/** Unchanged javadoc **/
protected void afterCallComponent(final Component component, final
Method method) {}
I see the following benefits:
- no new dependencies as described above
- the reflection stuff is isolated in WebRequestCycle, were it's
alre=
ady
used
- more flexible since project specific subclasses of WebRequestCycle
could easily
... apply their aspects (e.g. inject dependencies with Spring) from
*outside* of their pages
... forward these lifecyle notifications into their pages (as the
current implementation) if they really need to.
Please reread the javadoc of beforeCallComponent() and
afterCallComponent() as if they were already located in
WebRequestCycle,
IMHO they make much more sense there.
Thanks
Sven
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of
200=
5
Visit http://www.jboss.com/services/certification for
more information
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of
2005
Visit http://www.jboss.com/services/certification for
more information
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
--__--__--
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
End of Wicket-user Digest