@Inject public MainTabBasicListPresenterWidget( EventBus eventBus, ViewDef view, Provider<MainTabBasicListItemPresenterWidget> basicVmPresenterWidgetProvider, UserPortalBasicListProvider modelProvider) { super(eventBus, view); this.basicVmPresenterWidgetProvider = basicVmPresenterWidgetProvider; this.modelProvider = modelProvider; modelProvider.setDataChangeListener(this); }
@Override public void onDataChange(List<UserPortalItemModel> items) { // TODO optimize int vmIndex = 0; getView().clear(); for (UserPortalItemModel item : items) { MainTabBasicListItemPresenterWidget basicVmPresenterWidget = basicVmPresenterWidgetProvider.get(); basicVmPresenterWidget .getView() .setElementId( ElementIdUtils.createElementId( getView().getElementId(), "vm" + vmIndex++)); // $NON-NLS-1$ basicVmPresenterWidget.setModel(item); addToSlot(TYPE_VmListContent, basicVmPresenterWidget); } selectDefault(modelProvider.getModel(), items); }