Thank you Robert!
To give you a way of looking at my problem.
Bean Customizing has some usual properties that are read only, like
symbol, isDeclared, etc. but only one property that is writeable, the
value. The read only properties provide meaning to the person fostering
the Customizing instance.
Now there is the usual approach that I prepare a distinct page (which in
fact I did) to collect the value for the Customizing instance. This page
displays the rest of the bean in a verbose mode to the user. Straight
forward, no problem.
Anyway, I'm just curious: Since I can imagine many occasions where a
bean not only would hold data but also some semantics on the data that
would be useful to be displayed to a person editing this bean. Is there
a standard way to get this job done by BeanEditor/ BeanModel?
To pick up your snippet: On my concrete BeanModel for bean Customizing I
would need something like
BeanModel<Customizing> getModel() {
BeanModel<Customizing> model = beanModelSource.createDisplayModel(
Customizing.class, messages );
// property description is read only but contains information on how the
// fostering of this Customizing instance will influence the behaviour of
// the application
model.display( "description" );
return model;
}
Is there a way to get this done? Would be nice somehow.
Michael
Zeigler schrieb:
So:
1) createDisplayModel() acts the same as createModel(...,false,...);
and createEditModel is like createModel(...,true,...)
So if you have your bean, the @NonVisual properties won't show up
for editing or display. Using createDisplayModel will add all
properties with a getter that aren't otherwise marked as @NonVisual,
and using createEditModel will only add the properties will getters
and setters. But once you have the model, you can manipulate it
anyway you want. For example:
BeanModel<MyBean> getModel() {
BeanModel<MyBean> model =
beanModelSource.createDisplayModel(MyBean.class,messages);
model.exclude("someProp");
return model;
}
Robert
On Jun 8, 2009, at 6/810:38 AM , Michael Gerzabek wrote:
Hi,
BeanModelSource now has deprecated create(..) in favor of
createDisplayModel(..) and createEditModel(..). This is a nice
feature leaving me with one question:
I want to edit a bean that has some properties that should not be
displayed at all (@NonVisual), some properties that should be
displayed but not enabled for editing. Those properties can have
setters but some also don't have setters at all. And then there are
some properties that should be editable. How would I achive this?
Thanks for your help,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org