| 1 | |
package org.paneris.jammyjoes.mvp; |
| 2 | |
|
| 3 | |
import java.util.HashMap; |
| 4 | |
import java.util.List; |
| 5 | |
import java.util.Map; |
| 6 | |
|
| 7 | |
import org.melati.poem.Selectable; |
| 8 | |
import org.paneris.jammyjoes.controller.MonthlyTimesliceFactory; |
| 9 | |
|
| 10 | |
public class OrdersByMonthPresenter extends AbstractPresenter implements Presenter { |
| 11 | |
|
| 12 | |
private Selectable _ordersTable; |
| 13 | |
private Map _monthMap; |
| 14 | |
private TimesliceValue _max; |
| 15 | |
private List _status; |
| 16 | |
|
| 17 | 0 | public OrdersByMonthPresenter(Selectable ordersTable, Context context, List status) { |
| 18 | 0 | _ordersTable = ordersTable; |
| 19 | 0 | _monthMap = new HashMap(); |
| 20 | 0 | _status = status; |
| 21 | 0 | _max = new TimesliceValue(null, 0); |
| 22 | 0 | context.put("months", _monthMap); |
| 23 | 0 | context.put("max", _max); |
| 24 | 0 | context.put("sorter", new CollectionSorter()); |
| 25 | 0 | context.put("reversesorter", new ReverseCollectionSorter()); |
| 26 | 0 | } |
| 27 | |
|
| 28 | |
public Selection createSelection() { |
| 29 | 0 | return new OrderSelection(_ordersTable, _status, null, null, null); |
| 30 | |
} |
| 31 | |
|
| 32 | |
public Command createCommand() { |
| 33 | 0 | return new CollectingCommand(_monthMap, _max , new MonthlyTimesliceFactory(null), new AffiliateTotals()); |
| 34 | |
} |
| 35 | |
|
| 36 | |
} |