Search in sources :

Example 1 with LockRemovedEvent

use of org.olat.core.util.coordinate.LockRemovedEvent in project openolat by klemens.

the class LockController 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)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            LockEntry lockToRelease = locksTableModel.getObject(te.getRowId());
            dialogController = activateYesNoDialog(ureq, null, translate("lock.release.sure"), dialogController);
            dialogController.setUserObject(lockToRelease);
        }
    } else if (source == dialogController) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            LockEntry lockToRelease = (LockEntry) dialogController.getUserObject();
            MultiUserEvent mue = new LockRemovedEvent(lockToRelease);
            OLATResourceable lockEntryOres = OresHelper.createOLATResourceableInstance(LockEntry.class, 0l);
            CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(mue, lockEntryOres);
            CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLockEntry(lockToRelease);
            lockToRelease = null;
            resetTableModel();
        }
    }
}
Also used : LockRemovedEvent(org.olat.core.util.coordinate.LockRemovedEvent) TableEvent(org.olat.core.gui.components.table.TableEvent) LockEntry(org.olat.core.util.coordinate.LockEntry) OLATResourceable(org.olat.core.id.OLATResourceable) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Example 2 with LockRemovedEvent

use of org.olat.core.util.coordinate.LockRemovedEvent in project OpenOLAT by OpenOLAT.

the class LockController 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)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            LockEntry lockToRelease = locksTableModel.getObject(te.getRowId());
            dialogController = activateYesNoDialog(ureq, null, translate("lock.release.sure"), dialogController);
            dialogController.setUserObject(lockToRelease);
        }
    } else if (source == dialogController) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            LockEntry lockToRelease = (LockEntry) dialogController.getUserObject();
            MultiUserEvent mue = new LockRemovedEvent(lockToRelease);
            OLATResourceable lockEntryOres = OresHelper.createOLATResourceableInstance(LockEntry.class, 0l);
            CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(mue, lockEntryOres);
            CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLockEntry(lockToRelease);
            lockToRelease = null;
            resetTableModel();
        }
    }
}
Also used : LockRemovedEvent(org.olat.core.util.coordinate.LockRemovedEvent) TableEvent(org.olat.core.gui.components.table.TableEvent) LockEntry(org.olat.core.util.coordinate.LockEntry) OLATResourceable(org.olat.core.id.OLATResourceable) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Aggregations

TableEvent (org.olat.core.gui.components.table.TableEvent)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 LockEntry (org.olat.core.util.coordinate.LockEntry)2 LockRemovedEvent (org.olat.core.util.coordinate.LockRemovedEvent)2 MultiUserEvent (org.olat.core.util.event.MultiUserEvent)2