« Return to Thread: Enum in search

Re: Enum in search

by Pablo Gra\~na :: Rate this Message:

Reply to Author | View in Thread

The modifications for enums where really simple:

1- Create a new component EnumSearchField. It is a copy of
AssociationSearchField, but using an EnumSelect component instead of
HibernateAssociationSelect. We also bound:

        <binding name="allowNone" value="true"/>
        <binding name="noneLabel" value="literal:"/>

2- Created a CustomSearchBlocks page with:

<!-- A block used to input the search condition on an enum. It is a combo box
with an option to ignore this field in the search. -->
<div jwcid="enumSearch@Block">
   <li>
     <label class="desc">
       <span jwcid="@Insert"
         value="ognl:descriptor.displayName"/>
     </label>
     <span jwcid="@EnumSearchField"
       propertyDescriptor="ognl:descriptor"
       class="select large"/>
   </li>
</div>

3- Added this enumSearch block to the list of search block of the
searchBlockFinder service:

     <!-- A custom search field for an enum. -->
     <entry>
       <key>
         <value>
           supportsExtension('org.trails.descriptor.EnumReferenceDescriptor')
         </value>
       </key>
       <bean class="org.apache.tapestry.util.ComponentAddress">
         <constructor-arg  index="0">
           <value>CustomSearchBlocks</value>
         </constructor-arg>
         <constructor-arg  index="1">
           <value>enumSearch</value>
         </constructor-arg>
       </bean>
     </entry>


I did the same for the AssociationSearchField component to bind the allowNone
and noneLabel properties.

regards

Ken in nashua wrote:

> Alejandro is the uthority on what goes ito the project.
>  
> It makes sense to show the diffs...
>  
> Are you doing this in tapestry script? Or under the hood tapestry
> component+handlers... ?
>
> Will it jive with j2ee enums model? Are you parsing int's or strings or
> both?
>  
> Wondering how complicated it is.
>  
> Anyway, if you shoot up some code I believe Alejandro will advise.
>  
> The dynamic select's seem a bit on the custom side for me (not valid to
> place in the project).
>  
> Nice to hear from users out there...
>  
> So how do you like 1.2-SNAPSHOT ?
>  
> - cheers
>
> Best regards
> Ken in nashua
>
>
>
>  > Date: Mon, 7 Jul 2008 11:13:48 -0300
>  > From: pablo.grana@...
>  > To: users@...
>  > Subject: [trails-users] Enum in search
>  >
>  > Hi there.
>  >
>  > We added search by enums in our project. Can that be incorporated in the
>  > project? We did it as an extension to trails, but I can send a diff
> against
>  > 1.2-SNAPSHOT this week if you like.
>  >
>  > We also added the NONE search option in the association search block.
>  >
>  > And somebody in the team implemented 'cascaded combos': when one
> combo changes,
>  > the other combos are refreshed based on this changing combo. For example:
>  >
>  > Client -> Project -> Task. Create a new task and select a client.
> This populates
>  > the project combo with the projects of that client.
>  >
>  > And finally, 2 minor things: an unbalanced <li> and a clarification
> in the
>  > message for an exception.
>  >
>  > I can send diffs for these.
>  >
>  > regards
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  > http://xircles.codehaus.org/manage_email
>  >
>  >
>
>
> ------------------------------------------------------------------------
> Making the world a better place one message at a time. Check out the i'm
> Talkathon.
> <http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace>




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Enum in search