Hi,

I want to add a new property editor to show a dropdown-select from a Java List
of Strings.

I dont know where to put my AppPropertyEditBlocks.java and
AppPropertyEditBlocks.tml files.

If I put them under my services, I get the error:

org.apache.tapestry5.internal.services.RenderQueueException
Render queue error in
BeginRender[tour/Request:beaneditform.editor.propertyeditor]: Unable to locate
a block to edit property 'guideList' (with data type 'dropdown') of object
[EMAIL PROTECTED]: Unable to resolve
'AppPropertyEditBlocks' to a known page name. Available page names: (blank),
Appointm.....

If I put them under my pages, I get the error:

org.apache.tapestry5.internal.services.RenderQueueException
Render queue error in
BeginRender[tour/Request:beaneditform.editor.propertyeditor]: Unable to locate
a block to edit property 'guideList' (with data type 'dropdown') of object
[EMAIL PROTECTED]: Embedded component
'select' has no type. You should specify a type in the component template, or
define the component inside class
de.startext.tapestry.hida.pages.AppPropertyEditBlocks using the @Component
annotation on a private instance variable.

I added the following lines to my AppModule class:

    @SuppressWarnings("unchecked")
    public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
configuration)
    {
      configuration.add(DropDownList.class, "dropdown");
    }

    public void contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
    {
        configuration.add(new BeanBlockContribution("dropdown",
"AppPropertyEditBlocks", "dropdown", true));
    }

I followed these instructions:

http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html
http://wiki.apache.org/tapestry/Tapestry5HowToCreateAPropertyEditBlock

my AppPropertyEditBlocks.java:
public class AppPropertyEditBlocks
{
    @Environmental
    private PropertyEditContext context;
    @SuppressWarnings("unused")
    @Component(parameters =
    {"value=selected",
            "label=prop:context.label",
            "encoder=valueEncoderForSelected",
            "model=selectModelForDropDownList",
            "validate=prop:context.validator",
            "clientId=prop:context.propertyId"})
    private Select selectList;

    public PropertyEditContext getContext() { return context; }
    public int getSelected() {
        return ((DropDownList)this.context.getPropertyValue()).getSelected();
    }
    public void setSelected(int value) {
        ((DropDownList)this.context.getPropertyValue()).setSelected(value);
    }
    @SuppressWarnings("unchecked")
    public ValueEncoder getValueEncoderForSelected() {
        return new ValueEncoder() {
            public String toClient(Object value) { return
((Integer)value).toString();}
            public Object toValue(String clientValue) { return new
Integer(clientValue);}
        };
    }
}

my AppPropertyEditBlocks.tml-file:
<div xml:space="default"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<t:block t:id="dropdown">
<t:label for="select"/>
<input t:id="select"/>
</t:block>
</div>

Any help would be great!

Thanks, Mark

--
Mark Weißenberg
Tel. +49 228 9599630
startext Unternehmensberatung GmbH
Kennedyallee 2, D-53175 Bonn
Geschäftsführer Paul Bantzer, HRB Bonn 2741
Sitz der Gesellschaft: Bonn

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to