Hi Filip,
it's good to hear that it is just a leftover, so I can ignore it and
stop wondering.
Thanks again for your help!
Tobias
Filip S. Adamsen schrieb:
Hi,
On 2008-04-15 19:13, Tobias Wehrum wrote:
Thank you, Filip!
Looking through the page you suggested, I found the missing piece of
code:
--------------------------------------------------
public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
configuration)
{
configuration.add(Status.class, "status");
}
--------------------------------------------------
And now it works! :)
Great. :)
Just because I'm curious: What does contributeTranslatorDefaultSource
do? Using it didn't seem to have any effect.
Well, it's a leftover from earlier on when you had to contribute to
both TranslatorSource and TranslatorDefaultSource. It was kind of
awkward so it was changed.
Tobias
-Filip
Tobias Wehrum schrieb:
Hi there,
yes, maybe I caused confusion. To further point out what I'm trying
to do: I just want to output whatever value Status.toString() will
return to me, for example in a grid. When I add the property to the
BeanModel, tapestry has no problems calling toString()
automatically; but at the moment, like I said, I have to add it
first to the BeanModel, and I want to automatize this. (When it
comes to input, I will implement t:parameter for it.)
Regards,
Tobias
Filip S. Adamsen schrieb:
Oh, sorry, didn't catch that all you want to edit is a String
property from another class. I don't know what else there is to do,
then.
-Filip
On 2008-04-15 18:41, Filip S. Adamsen wrote:
Hi,
You might need to add a new property editor, see Adding New
Property Editors at
http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html.
-Filip
On 2008-04-15 18:37, Tobias Wehrum wrote:
Hi there,
I have a class named "Status" which implements toString(). But
still when I have class A, which has a property of type Status, I
always have to add the Status property to the BeanModel with
model.add("myStatus").
Obviously implementing toString() isn't enough to teach my the
BeanModel a new trick. So I tried to contribute a TypeCoercer and
a TranslatorSource, but neither of them seems to work.
My try on TypeCoercer:
--------------------------------------------------
public static void
contributeTypeCoercer(Configuration<CoercionTuple> configuration)
{
Coercion<Status, String> coercionStatusString = new
Coercion<Status, String>()
{
public String coerce(Status input)
{
return input.toString();
}
};
configuration.add(new CoercionTuple<Status,
String>(Status.class, String.class, coercionStatusString)); }
--------------------------------------------------
My try on TranslatorSource:
--------------------------------------------------
public static void
contributeTranslatorDefaultSource(MappedConfiguration<Class,
Translator> configuration) {
configuration.add(Status.class, new StatusTranslator());
}
public static void
contributeTranslatorSource(MappedConfiguration<String,
Translator> configuration) {
configuration.add("status", new StatusTranslator());
}
--------------------------------------------------
--------------------------------------------------
public class StatusTranslator implements Translator<Status> {
public Class<Status> getType() {
return Status.class;
}
public Status parseClient(String arg0, Messages arg1)
throws ValidationException {
throw new ValidationException("StatusTranslator cannot
implement parseClient()");
}
public String toClient(Status arg0) {
return arg0.toString();
}
}
--------------------------------------------------
Am I missing something? Or am I on a complete wrong path?
Any hints on how to solve my problem are welcome.
Thanks in advance,
Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]