Search in sources :

Example 21 with TableMultiSelectEvent

use of org.olat.core.gui.components.table.TableMultiSelectEvent in project openolat by klemens.

the class GroupChoiceForm method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == manageChecklistTable) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent tableEvent = (TableEvent) event;
            Long identityKey = manageTableData.getParticipantKeyAt(tableEvent.getRowId());
            selectedIdentity = securityManager.loadIdentityByKey(identityKey, false);
            if (tableEvent.getActionId().equals(EDIT_ACTION)) {
                initEditTable(ureq, selectedIdentity);
                VelocityContainer vcManageUser = createVelocityContainer("manageUser");
                vcManageUser.put("table", editChecklistTable.getInitialComponent());
                String name = selectedIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()) + " " + selectedIdentity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
                visitingCardButton = LinkFactory.createLink("cl.manage.user.visitingcard", vcManageUser, this);
                visitingCardButton.setCustomDisplayText(name);
                removeAsListenerAndDispose(cmc);
                cmc = new CloseableModalController(getWindowControl(), translate("cl.close"), vcManageUser, true, translate("cl.edit.title"));
                listenTo(cmc);
                cmc.activate();
            } else if (tableEvent.getActionId().equals(DETAILS_ACTION)) {
                openVisitingCard(ureq);
            }
        }
    } else if (source == editChecklistTable) {
        if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals("save")) {
                BitSet selection = tmse.getSelection();
                updateCheckpointsFor(selectedIdentity, selection);
                initManageTable(ureq);
            }
            cmc.deactivate();
        }
    } else if (source == groupForm) {
        if (event == Event.CHANGED_EVENT) {
            initManageTable(ureq);
        } else if (event.getCommand().equals(GroupChoiceForm.EXPORT_TABLE)) {
            downloadResults(ureq);
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) BitSet(java.util.BitSet) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 22 with TableMultiSelectEvent

use of org.olat.core.gui.components.table.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest urequest, Controller source, Event event) {
    if (source == tableCtr) {
        // process table actions
        if (event instanceof TableEvent) {
            TableEvent te = (TableEvent) event;
            int rowId = te.getRowId();
            if (te.getActionId().equals(RepositoryTableModel.TABLE_ACTION_INFOS)) {
                RepositoryEntry entry = (RepositoryEntry) tableCtr.getTableDataModel().getObject(rowId);
                int row = tableCtr.getIndexOfSortedObject(entry);
                doOpenInfos(urequest, entry, row);
            } else if (te.getActionId().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
                selectedEntry = (RepositoryEntry) tableCtr.getTableDataModel().getObject(rowId);
                fireEvent(urequest, new Event(RepositoryTableModel.TABLE_ACTION_SELECT_LINK));
                selectedEntries = null;
            }
        } else if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent mse = (TableMultiSelectEvent) event;
            if (!mse.getSelection().isEmpty()) {
                selectedEntry = null;
                BitSet objectMarkers = mse.getSelection();
                selectedEntries = new ArrayList<>(objectMarkers.size());
                for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
                    RepositoryEntry entry = (RepositoryEntry) tableCtr.getTableDataModel().getObject(i);
                    selectedEntries.add(entry);
                }
                fireEvent(urequest, new Event(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRIES));
            }
        } else if (TableController.EVENT_FILTER_SELECTED.equals(event)) {
            TypeFilter typeFilter = (TypeFilter) tableCtr.getActiveFilter();
            if (searchType == SearchType.byOwner) {
                doSearchByOwnerLimitTypeInternal(typeFilter.getOwner(), new String[] { typeFilter.getType() }, false);
            } else if (searchType == SearchType.myAsStudent) {
                doSearchMyCoursesStudent(urequest, typeFilter.getType(), false);
            } else if (searchType == SearchType.myAsTeacher) {
                doSearchMyCoursesTeacher(urequest, typeFilter.getType(), false);
            } else if (searchType == SearchType.searchForm) {
                if (enableSearchforAllInSearchForm != null) {
                    doSearchAllReferencables(urequest, typeFilter.getType(), false);
                } else {
                    doSearch(urequest, typeFilter.getType(), false);
                }
            }
        } else if (TableController.EVENT_NOFILTER_SELECTED.equals(event)) {
            if (searchType == SearchType.byOwner) {
                doSearchByOwnerLimitTypeInternal(getIdentity(), new String[] {}, false);
            } else if (searchType == SearchType.myAsStudent) {
                doSearchMyCoursesStudent(urequest);
            } else if (searchType == SearchType.myAsTeacher) {
                doSearchMyCoursesTeacher(urequest);
            } else if (searchType == SearchType.searchForm) {
                if (enableSearchforAllInSearchForm != null) {
                    doSearchAllReferencables(urequest, null, false);
                } else {
                    doSearch(urequest, null, false);
                }
            }
        }
    } else if (event instanceof EntryChangedEvent) {
        // remove deleted entry
        EntryChangedEvent ecv = (EntryChangedEvent) event;
        if (ecv.getChange() == Change.deleted) {
            List<RepositoryEntry> newEntries = new ArrayList<RepositoryEntry>();
            for (int i = 0; i < repoTableModel.getRowCount(); i++) {
                RepositoryEntry foo = repoTableModel.getObject(i);
                if (!foo.getKey().equals(ecv.getRepositoryEntryKey())) {
                    newEntries.add(foo);
                }
            }
            repoTableModel.setObjects(newEntries);
            tableCtr.modelChanged();
        } else if (ecv.getChange() == Change.added) {
            doSearchByOwner(urequest.getIdentity());
        }
    } else if (source == searchForm) {
        // process search form events
        if (event == Event.DONE_EVENT) {
            if (searchForm.hasId()) {
                doSearchById(searchForm.getId(), searchForm.getRestrictedTypes());
            } else if (enableSearchforAllInSearchForm != null) {
                doSearchAllReferencables(urequest, null, true);
            } else {
                doSearch(urequest, null, true);
            }
        } else if (event == Event.CANCELLED_EVENT) {
            fireEvent(urequest, Event.CANCELLED_EVENT);
        }
    } else if (calloutCtrl == source) {
        removeAsListenerAndDispose(calloutCtrl);
        removeAsListenerAndDispose(infosCtrl);
        calloutCtrl = null;
        infosCtrl = null;
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) BitSet(java.util.BitSet) ArrayList(java.util.ArrayList) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) Event(org.olat.core.gui.control.Event) TableEvent(org.olat.core.gui.components.table.TableEvent) ArrayList(java.util.ArrayList) List(java.util.List) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 23 with TableMultiSelectEvent

use of org.olat.core.gui.components.table.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.

the class ViteroAdminBookingMembersController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event instanceof TableEvent) {
            TableEvent e = (TableEvent) event;
            int row = e.getRowId();
            ViteroUser identity = (ViteroUser) tableCtr.getTableDataModel().getObject(row);
            if ("signout".equals(e.getActionId())) {
                signOut(Collections.singletonList(identity));
            }
        } else if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent e = (TableMultiSelectEvent) event;
            List<ViteroUser> identities = new ArrayList<ViteroUser>();
            for (int i = e.getSelection().nextSetBit(0); i >= 0; i = e.getSelection().nextSetBit(i + 1)) {
                ViteroUser identity = (ViteroUser) tableCtr.getTableDataModel().getObject(i);
                identities.add(identity);
            }
            if ("signout".equals(e.getAction())) {
                signOut(identities);
            }
        }
    }
    super.event(ureq, source, event);
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) ViteroUser(org.olat.modules.vitero.model.ViteroUser) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) ArrayList(java.util.ArrayList) List(java.util.List)

Example 24 with TableMultiSelectEvent

use of org.olat.core.gui.components.table.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.

the class EPMultipleArtefactsAsTableController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == artefactListTblCtrl) {
        if (event instanceof TableEvent) {
            TableEvent te = (TableEvent) event;
            AbstractArtefact artefact = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(te.getRowId());
            String action = te.getActionId();
            if (CMD_TITLE.equals(action)) {
                popupArtefact(artefact, ureq);
            } else if (CMD_REFLEXION.equals(action)) {
                EPReflexionWrapperController reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
                listenTo(reflexionCtrl);
            } else if (CMD_CHOOSE.equals(action)) {
                fireEvent(ureq, new EPArtefactChoosenEvent(artefact));
            } else if (CMD_UNLINK.equals(action)) {
                struct = ePFMgr.reloadPortfolioStructure(struct);
                ePFMgr.removeArtefactFromStructure(artefact, struct);
                artefactListTblCtrl.modelChanged();
                fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, struct));
            } else if (CMD_MOVE.equals(action)) {
                showMoveTree(ureq, artefact);
            } else if (CMD_DELETEARTEFACT.equals(action)) {
                String text = translate("delete.artefact.text", StringHelper.escapeHtml(artefact.getTitle()));
                deleteDialogController = activateYesNoDialog(ureq, translate("delete.artefact"), text, deleteDialogController);
                deleteDialogController.setUserObject(artefact);
            }
        } else if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            BitSet objectMarkers = tmse.getSelection();
            List<AbstractArtefact> selectedArtefacts = new ArrayList<>(objectMarkers.size());
            for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
                AbstractArtefact entry = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(i);
                selectedArtefacts.add(entry);
            }
            fireEvent(ureq, new EPArtefactListChoosenEvent(selectedArtefacts));
        }
    } else if (source == moveTreeCtrl && event.getCommand().equals(EPStructureChangeEvent.CHANGED)) {
        EPStructureChangeEvent epsEv = (EPStructureChangeEvent) event;
        PortfolioStructure newStruct = epsEv.getPortfolioStructure();
        showInfo("artefact.moved", newStruct.getTitle());
        fireEvent(ureq, event);
        moveTreeBox.deactivate();
    } else if (source == deleteDialogController) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            AbstractArtefact artefact2delete = (AbstractArtefact) deleteDialogController.getUserObject();
            ePFMgr.deleteArtefact(artefact2delete);
            ArtefactTableDataModel model = (ArtefactTableDataModel) artefactListTblCtrl.getTableDataModel();
            model.getObjects().remove(artefact2delete);
            artefactListTblCtrl.modelChanged();
            fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.REMOVED, struct));
        }
        removeAsListenerAndDispose(deleteDialogController);
        deleteDialogController = null;
    }
    super.event(ureq, source, event);
}
Also used : TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) BitSet(java.util.BitSet) EPReflexionWrapperController(org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController) TableEvent(org.olat.core.gui.components.table.TableEvent) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) ArrayList(java.util.ArrayList) List(java.util.List) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Example 25 with TableMultiSelectEvent

use of org.olat.core.gui.components.table.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.

the class BGUserManagementController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == cmc) {
        cleanupPopup();
    } else if (source == addCtrl) {
        List<Identity> identitiesToAdd = extractIdentities(event);
        BGMembership type = (BGMembership) addCtrl.getUserObject();
        switch(type) {
            case owner:
                userTableModel.addOwners(identitiesToAdd);
                break;
            case participant:
                userTableModel.addParticipants(identitiesToAdd);
                break;
            case waiting:
                userTableModel.addToWaitingList(identitiesToAdd);
                break;
        }
        usersCtrl.modelChanged();
        cmc.deactivate();
        cleanupPopup();
    } else if (source == usersCtrl) {
        if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals(COMMAND_REMOVEUSER)) {
                List<Identity> toRemove = userTableModel.getObjects(tmse.getSelection());
                removeIdentities(toRemove);
            }
        }
    }
    super.event(ureq, source, event);
}
Also used : BGMembership(org.olat.group.model.BGMembership) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) List(java.util.List) Identity(org.olat.core.id.Identity)

Aggregations

TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)48 TableEvent (org.olat.core.gui.components.table.TableEvent)40 ArrayList (java.util.ArrayList)34 List (java.util.List)34 Identity (org.olat.core.id.Identity)18 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)16 BitSet (java.util.BitSet)12 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)10 MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)8 UserRequest (org.olat.core.gui.UserRequest)6 WindowControl (org.olat.core.gui.control.WindowControl)6 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)6 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)6 MailNotificationEditController (org.olat.core.util.mail.MailNotificationEditController)6 MailTemplate (org.olat.core.util.mail.MailTemplate)6 UserInfoMainController (org.olat.user.UserInfoMainController)6 MediaResource (org.olat.core.gui.media.MediaResource)4 AssertException (org.olat.core.logging.AssertException)4 MailerResult (org.olat.core.util.mail.MailerResult)4 VFSRevisionMediaResource (org.olat.core.util.vfs.VFSRevisionMediaResource)4