Search in sources :

Example 66 with TableEvent

use of org.olat.core.gui.components.table.TableEvent 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 67 with TableEvent

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

the class ViteroBookingsController 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 ("start".equals(e.getActionId())) {
                openVitero(ureq, booking);
            } else if ("signin".equals(e.getActionId())) {
                signInVitero(ureq, booking);
            } else if ("signout".equals(e.getActionId())) {
                signOutVitero(ureq, booking);
            } else if ("opengroup".equals(e.getActionId())) {
                openGroup(ureq, booking);
            }
        }
    } else if (source == cmc) {
        removeAsListenerAndDispose(cmc);
        viteroGroupVC = null;
        cmc = null;
    }
    super.event(ureq, source, event);
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) TableEvent(org.olat.core.gui.components.table.TableEvent)

Example 68 with TableEvent

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

the class NoteListController 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 ureq, Controller source, Event event) {
    // if row has been clicked
    if (source == tableC) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            String actionid = te.getActionId();
            int rowid = te.getRowId();
            this.chosenN = nLModel.getObject(rowid);
            if (actionid.equals("choose")) {
                removeAsListenerAndDispose(nc);
                nc = new NoteController(ureq, getWindowControl(), chosenN);
                listenTo(nc);
                removeAsListenerAndDispose(cmc);
                cmc = new CloseableModalController(getWindowControl(), translate("close"), nc.getInitialComponent());
                listenTo(cmc);
                cmc.activate();
            } else if (actionid.equals("delete")) {
                deleteDialogCtr = activateYesNoDialog(ureq, null, translate("note.delete.confirmation"), deleteDialogCtr);
            }
        }
    } else if (source == deleteDialogCtr) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            // delete is ok
            nm.deleteNote(chosenN);
            // fire local event (for the same user)
            // TODO:fj:a make Note (and all persistables) olatresourceables: problem: type is then NoteImpl instead of Note
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(Note.class, chosenN.getKey());
            ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(new OLATResourceableJustBeforeDeletedEvent(ores), ores);
            showInfo("note.delete.successfull");
            populateNLTable();
            chosenN = null;
        } else {
            // answer was "no"
            chosenN = null;
        }
    } else if (source == nc) {
        if (event == Event.BACK_EVENT) {
            cmc.deactivate();
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) OLATResourceable(org.olat.core.id.OLATResourceable) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) OLATResourceableJustBeforeDeletedEvent(org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent)

Example 69 with TableEvent

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

the class EventsModel 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 ureq, Controller source, Event event) {
    if (source == tableController) {
        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();
                KalendarEvent kalendarEvent = ((EventsModel) tableController.getTableDataModel()).getObject(rowid);
                String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][calendar:0]" + BusinessControlFactory.getInstance().getContextEntryStringForDate(kalendarEvent.getBegin());
                BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
                WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
                NewControllerFactory.getInstance().launch(ureq, bwControl);
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) BusinessControl(org.olat.core.id.context.BusinessControl) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) WindowControl(org.olat.core.gui.control.WindowControl)

Example 70 with TableEvent

use of org.olat.core.gui.components.table.TableEvent 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)

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