« Return to Thread: Enum in search

Re: Enum in search

by Kalle Korhonen-2 :: Rate this Message:

Reply to Author | View in Thread

Looks good to me. There's already a Tapestry @InitialValue annotation (for pages & components) so I wonder if it'd be better to use a different name, or just use the Tapestry annotation and process it differently for entities. @PossibleValues looks interesting - I've typically achieved somewhat similar effect with security annotation @ViewRequiresAssociation, but this is more useful when you arbitrarily want to limit the value pool. Can you open separate issues for each of these: @InitialValue, @PossibleValues and enum search and attach diffs (with relative paths) to them? If they are prepared against the trunk, they'd be pretty easy to add on.

Kalle

On Mon, Jul 7, 2008 at 8:35 AM, Pablo Gra~na <pablo.grana@...> wrote:
About the dynamic selects, the implementation is generic enough, I guess:

We added two annotations:

@InitialValue
@PossibleValues

As an example, imagine you have client -> project -> task. task is not directly mapped to client, only through the corresponding project. So InitialValue annotates a transient attribute named client:

 @Transient
 @InitialValue("project.client")
 private Client client;

so to populate the client property, it evaluates the propect.client expression. (project can be null, in which case no client is pre-selected).

And the client drop down is obtained evaluating another expression:

 @PossibleValues("client.projects")
 @ManyToOne
 private Project project;

client.projects gives the list of projects for a client. If client is null (not yet selected), the project drop down is empty.

This cascading can be chained to any limit (well, we tested it with three chained combos).

This forces to declare both sides of a many-to-one relation.

Hope it is clear enough.

Alejandro, what do you think?


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