You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2007/08/31 16:04:53 UTC

T5 Enhanced Palette : A code contribution

Hello everyone!  I'm happy to announce I have cobbled together a new version
of the core Palette component, which I'm calling "EnhancedPalette".

The driving force behind this was a Javascript bug that caused Palette not
to select components.  (I didn't research the problem fully, but it goes
beyond the extra comma in a particular parameter list)

I figured that someone somewhere must have working JS code like this, and a
quick Google found some impressive examples at
http://www.mattkruse.com/javascript/
 (also http://www.javascripttoolbox.com/)


So far it does most of what the original Palette did, and it works in
explorer.
One Palette feature is different: it does not require you to submit the form
in order to enable/disable automatic sorting--it's done in JS and will
update your selection list on the next modification.  This was confusing for
my users, because in some cases the form submission forwards to a new page!

I will probably take out the code for moving things up and down, as well as
the associated assets, etc.

Now for some cool stuff it can do, because of the JS code written by Matt
Kruse:
The client-side autosort ability mentioned above.
You can choose to select or deselect all items, with one button.
You can choose to select only items that do not match a regular expression.
(The regular expression can be hardcoded, OR it can be specified in a text
field on the fly! My users will love this once I provide some tips. Another
possibility is to output preset regular expressions into a Select, and let
users choose that way)

Stuff I want to finish up before I post the code:

Right now with Palette and EnhancedPalette, you supply a list of source
items, and a usually blank list of selected items.  You would usually just
use the selected items from your parent page/component.
In this new version there will be extra lists that get populated that have
more to do with the delta between the initial rendered lists and the
submitted lists.  These 4 extra lists represent:

Items Added to Selection
Items Removed from Selection
Items Added to Available
Items Removed from Available

Of course there are other ways you could come up with this info, but the JS
I chose is doing it for you!

I am trying to clean it up and optimize it a bit.


Can anyone suggest whether these delta lists should be made optional
parameters, or should I just provide getters?