You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Simeon Koptelov <si...@gmail.com> on 2005/02/15 08:00:38 UTC

Complex form component that delegates to another component.

Hello.

I'm writing a form component for selection from a list. The trick is
that I have very many (~5K) values in list, so cannot load them all at
once. I decided to create a component that will allow a search for
possible values by keyword and display in PropertySelection only found
ones. The problem is that I want my component to delegate the
selection capabilites to PropertySelection it contains; but
PropertySelection requires to be contained in form. My component is
form element, not the form itself. How can I perform the delegation?
So far my component's spec looks like this:


<component-specification class="com.fis.web.components.OrganizationSelector"
    allow-body="no"
    allow-informal-parameters="no"
>
    <description>
        Allows to quickly select an organization by performing LIKE
search on name's substring
        and selecting the result from found organizations.
    </description>
    
    <property-specification name="searchString"
    	type="java.lang.String"
    	persistent="yes"
    />
    
    <property-specification name="foundOrganizations"
        type="com.fis.web.components.OrganizationSelector$OrganizationSelectionModel"
        persistent="yes"
    	initial-value="createEmptyModel()"
    />
    
    <property-specification name="selectedOrganization"
        type="com.fis.domain.Organization"
        persistent="yes"
    />
    
	<component id="searchForm" type="core:Form">
        <binding name="listener" expression="listeners.find" />
    </component>
    
    <component id="searchStringField" type="core:TextField">
        <binding name="value" expression="searchString" />
    </component>
    
    <component id="foundSelect" type="core:PropertySelection">
        <binding name="model" expression="foundOrganizations" />
        <binding name="value" expression="selectedOrganization" />
    </component>

</component-specification>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Complex form component that delegates to another component.

Posted by Kent Tong <ke...@cpttm.org.mo>.
Simeon Koptelov <simeon.koptelov <at> gmail.com> writes:

> I'm writing a form component for selection from a list. The trick is
> that I have very many (~5K) values in list, so cannot load them all at
> once. I decided to create a component that will allow a search for
> possible values by keyword and display in PropertySelection only found
> ones. The problem is that I want my component to delegate the
> selection capabilites to PropertySelection it contains; but
> PropertySelection requires to be contained in form. My component is
> form element, not the form itself. How can I perform the delegation?
> So far my component's spec looks like this:

Why not create a PropertySelectionModel instead of a new 
component? For example:

class OrganizationsFoundModel implements IPropertySelectionModel  {
  public OrganizationsFoundModel(String searchString) {
    ...
  }
}

Then use this model with a PropertySelection component.

However, I'd rather move this function into your domain.
Components, IPropertySelectionModel and etc belong to
the UI layer. Searching should belong to your domain
layer.



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org