Hello,
I got stuck writing my own editor.
I have a Phone class with three String fields countryPrefix, prefix, code.

I would like to render a simple text input field and translate the input to a Phone class object. But I get the following exception.
org.apache.tapestry5.internal.services.RenderQueueException
Render queue error in BeginRender[PhoneBlock:phone]: Parameter 'translate' of component PhoneBlock:phone is bound to null. This parameter is not allowed to be null.

The line below ( FieldTranslator translator = context.getTranslator(phone);) is returning null

Do you have any idea? I read carefully the following pages

http://tapestry.apache.org/tapestry5/guide/beaneditform.html
http://wiki.apache.org/tapestry/Tapestry5HowToCreateAPropertyEditBlock?highlight=%28propertyeditblock%29
http://wiki.apache.org/tapestry/Tapestry5LocalizedDateField (This one worked)

Here is my code

In my AppModule I have
public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String> configuration) {
       configuration.add(Phone.class, "phoneNumber");
   }

public static void contributeBeanBlockSource(Configuration<BeanBlockContribution> configuration) { configuration.add(new BeanBlockContribution("phoneNumber", "PhoneBlock", "phone", true));
   }

In my pages package I have the following page class  in java/mypackage/pages
public class PhoneBlock {

   @Property
   @Environmental
   private PropertyEditContext context;

   @Component(parameters =
           {"value=context.propertyValue", "label=prop:context.label",
"translate=prop:phoneTranslator", "validate=prop:phoneValidator", "clientId=prop:context.propertyId", "annotationProvider=context"})
   private TextField phone;

public FieldValidator getPhoneValidator() {
       FieldValidator fieldValidator = context.getValidator(phone);
       return fieldValidator;
   }

   public FieldTranslator getPhoneTranslator() {
       FieldTranslator translator = context.getTranslator(phone);
       return translator;
   }

}

The corresponding PhoneBook.tml in resources/mypackage/pages

<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>

   <t:block id="phone">
       <t:label for="phone"/>
       <t:textfield t:id="phone" size="10"/>
   </t:block>

</div>

--
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to