You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nazarhussain_s <na...@gmail.com> on 2013/01/10 11:12:20 UTC

How to implement Multiple Select component for a SortedMap model in Tapestry 4

Hi, 
     I am trying to implement multiple select in my project for an already
existing single select functionality. The single select is being done using
a custom component which implements IPropertySelectionModel. As it is only
possible to use Select Component for multiple select I am facing currently
one issue.
The source for my IPropertySelectionModel is a SortedMap. How to use the
same source in case of a Select Component. I have written a cumbersome code
in case of a select but I am unsure how to use a SortedMap for a model
rather than a list of Account types.Can anybody provide inputs as to how to
use a SortedMap in a multiple Select Component 

Existing Model 
--------------
setAccountTypeSelectionModel(new DefaultSelectionModelSer((AccountType[])
accountTypes.keySet().toArray(new AccountType[accountTypes.size()]), this,
PresentationChoice.ALL));

//accountTypes is a SortedMap having all account types

Existing HTML
-------------


Existing Page
-------------
<property name="accountTypeSelectionModel" persist="session"/>
<component id="accountType" type="PropertySelection">
        <binding name="model" value="accountTypeSelectionModel"/>
        <binding name="size" value="literal:4"/>
        <binding name="value" value="filter.accountTypes"/>
        <binding name="class" value="literal:standardAccountDropDown"/>
</component>

New HTML
----------
<select jwcid="@Select" multiple="ognl:true" id="accountType">
   
     <option jwcid="@Option"
selected="ognl:selectedAccountTypes[currentAccountTypeIndex]"
label="ognl:currentAccountType"/>
    
</select>

New Model
----------
public abstract SortedMap getAccountTypes();
public abstract AccountType getCurrentAccountType();
public abstract void setSelectedAccountTypes(boolean[] accountTypes);
public abstract void setAccountTypes(SortedMap accountTypes);
public abstract void setCurrentAccountTypeIndex(int index);
public abstract void setCurrentAccountType(AccountType currentAccountType);









--
View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-implement-Multiple-Select-component-for-a-SortedMap-model-in-Tapestry-4-tp5719232.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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