On Mon, 30 Apr 2012 10:43:30 -0700 (PDT)
cmagnollay <[email protected]> wrote:

> if the map is called something like 
> 
> Map<Item, Integer> itemMap = new HashMap<Item, Integer>();
> 
> Hmm, so I would instantiate the ListView like so?
> [...]
> Is this what you are implying somewhat? Thanks for the answer by the
> way, I had not considered just, for lack of a better term, "fooling"
> the listview into using my map elements.

Basically yes, though the propertymodel won't work like that. I'd do
something like this (pseudocode):

Map<Item,Integer> itemMap = ...;

IModel<List<Map.Entry<Item,Integer>>> mapListModel = new
  LoadableDetachableModel() {
    load() {
       return new ArrayList<...>(itemMap.entrySet());
    }
  };

...new ListView<Map.Entry<...>>("id", mapListModel) {
  populateItem(ListItem<Item,Integer li) {
  ...
  }
}

Carl-Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to