Search in sources :

Example 91 with TableEvent

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

the class ScormResultDetailsController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == summaryTableCtr) {
        TableEvent tEvent = (TableEvent) event;
        if (tEvent.getActionId().equals("sel")) {
            TableGuiConfiguration tableConfig = new TableGuiConfiguration();
            tableConfig.setPreferencesOffered(true, "scormAssessmentDetails");
            removeAsListenerAndDispose(cmiTableCtr);
            cmiTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
            listenTo(cmiTableCtr);
            cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.itemId", 0, null, ureq.getLocale()));
            cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.translatedKey", 1, null, ureq.getLocale()));
            cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.key", 2, null, ureq.getLocale()));
            cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.value", 3, null, ureq.getLocale()));
            // <BPS-252> BPS-252_3
            int rowId = tEvent.getRowId();
            List<CmiData> data = ((SummaryTableDataModelMultiResults) summaryTableCtr.getTableDataModel()).getObject(rowId);
            cmiTableCtr.setTableDataModel(new CmiTableDataModel(getTranslator(), data));
            // </BPS-252> BPS-252_3
            removeAsListenerAndDispose(cmc);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), cmiTableCtr.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        }
    } else if (source == resetConfirmationBox) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            // delete scorm
            String username = assessedUserCourseEnv.getIdentityEnvironment().getIdentity().getName();
            CourseEnvironment courseEnv = assessedUserCourseEnv.getCourseEnvironment();
            ScormAssessmentManager.getInstance().deleteResults(username, courseEnv, node);
            fireEvent(ureq, Event.DONE_EVENT);
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 92 with TableEvent

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

the class NotesPortletRunController method event.

/**
 * @see org.olat.core.gui.control.ControllerEventListener#dispatchEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    super.event(ureq, source, event);
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            String actionid = te.getActionId();
            if (actionid.equals(CMD_LAUNCH)) {
                int rowid = te.getRowId();
                final NotePortletEntry pe = (NotePortletEntry) notesListModel.getObject(rowid);
                final Note note = pe.getValue();
                // will not be disposed on course run dispose, popus up as new browserwindow
                ControllerCreator ctrlCreator = new ControllerCreator() {

                    public Controller createController(UserRequest lureq, WindowControl lwControl) {
                        Controller nc = new NoteController(lureq, lwControl, note);
                        // use on column layout
                        LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, nc);
                        // dispose content on layout dispose
                        layoutCtr.addDisposableChildController(nc);
                        return layoutCtr;
                    }
                };
                // wrap the content controller into a full header layout
                ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
                // open in new browser window
                PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
                pbw.open(ureq);
            // 
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) WindowControl(org.olat.core.gui.control.WindowControl) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) AbstractPortletRunController(org.olat.core.gui.control.generic.portal.AbstractPortletRunController) Controller(org.olat.core.gui.control.Controller) TableController(org.olat.core.gui.components.table.TableController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 93 with TableEvent

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

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 94 with TableEvent

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

the class ViteroBookingsAdminController 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();
            ViteroBooking booking = (ViteroBooking) tableCtr.getTableDataModel().getObject(row);
            if ("delete".equals(e.getActionId())) {
                confirmDeleteVitero(ureq, booking);
            } else if ("infos".equals(e.getActionId())) {
                openInfoBox(ureq, booking);
            } else if ("resource".equals(e.getActionId())) {
                openResource(ureq, booking);
            }
        }
    } else if (source == dialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
            deleteBooking(booking);
        }
    } else if (source == cmc) {
        removeAsListenerAndDispose(infoController);
        removeAsListenerAndDispose(cmc);
    } else if (source == infoController) {
        cmc.deactivate();
        removeAsListenerAndDispose(infoController);
        removeAsListenerAndDispose(cmc);
        reloadModel();
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) TableEvent(org.olat.core.gui.components.table.TableEvent)

Example 95 with TableEvent

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

the class ViteroUserToGroupController 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();
            Identity identity = (Identity) tableCtr.getTableDataModel().getObject(row);
            if ("signin".equals(e.getActionId())) {
                signIn(Collections.singletonList(identity));
            } else if ("signout".equals(e.getActionId())) {
                signOut(Collections.singletonList(identity));
            }
        } else if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent e = (TableMultiSelectEvent) event;
            List<Identity> identities = new ArrayList<Identity>();
            for (int i = e.getSelection().nextSetBit(0); i >= 0; i = e.getSelection().nextSetBit(i + 1)) {
                Identity identity = (Identity) tableCtr.getTableDataModel().getObject(i);
                identities.add(identity);
            }
            if ("signin".equals(e.getAction())) {
                signIn(identities);
            } else if ("signout".equals(e.getAction())) {
                signOut(identities);
            } else if ("reload".equals(e.getAction())) {
                loadModel();
            }
        }
    }
    super.event(ureq, source, event);
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity)

Aggregations

TableEvent (org.olat.core.gui.components.table.TableEvent)114 ArrayList (java.util.ArrayList)42 List (java.util.List)40 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)40 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)16 Identity (org.olat.core.id.Identity)16 BitSet (java.util.BitSet)12 WindowControl (org.olat.core.gui.control.WindowControl)12 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)10 UserRequest (org.olat.core.gui.UserRequest)10 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)10 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)10 MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)8 BusinessGroup (org.olat.group.BusinessGroup)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 AssertException (org.olat.core.logging.AssertException)6 UserInfoMainController (org.olat.user.UserInfoMainController)6 KalendarEvent (org.olat.commons.calendar.model.KalendarEvent)4 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)4 Subscriber (org.olat.core.commons.services.notifications.Subscriber)4