Search in sources :

Example 36 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class ImpressumUserTool method dispatchEvent.

@Override
public void dispatchEvent(UserRequest ureq, Component source, Event event) {
    ControllerCreator impressumControllerCreator = new ControllerCreator() {

        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            return new ImpressumMainController(lureq, lwControl);
        }
    };
    Windows.getWindows(ureq).getWindowManager().createNewPopupBrowserWindowFor(ureq, impressumControllerCreator).open(ureq);
}
Also used : WindowControl(org.olat.core.gui.control.WindowControl) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 37 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class RichTextElementComponent method createFileSelectorPopupWindow.

private void createFileSelectorPopupWindow(final UserRequest ureq, final String type, final String fileName) {
    // Get allowed suffixes from configuration and requested media browser type from event
    final RichTextConfiguration config = element.getEditorConfiguration();
    final boolean allowCustomMediaFactory = config.isAllowCustomMediaFactory();
    final boolean uriValidation = config.isFilenameUriValidation();
    final String[] suffixes;
    if (type.equals(CMD_FILEBROWSER)) {
        suffixes = null;
    } else if (type.equals(CMD_IMAGEBROWSER)) {
        suffixes = config.getLinkBrowserImageSuffixes();
    } else if (type.equals(CMD_FLASHPLAYERBROWSER)) {
        suffixes = config.getLinkBrowserFlashPlayerSuffixes();
    } else {
        suffixes = config.getLinkBrowserMediaSuffixes();
    }
    // Show popup window with file browser to select file
    // Only one popup file chooser allowed at any time. ccc contains icc,
    // icc gets disposed by ccc
    // helper code which is used to create link chooser controller
    ControllerCreator linkChooserControllerCreator = new ControllerCreator() {

        @Override
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            LinkChooserController myLinkChooserController;
            VFSContainer baseContainer = config.getLinkBrowserBaseContainer();
            String uploadRelPath = config.getLinkBrowserUploadRelPath();
            String absolutePath = config.getLinkBrowserAbsolutFilePath();
            CustomLinkTreeModel linkBrowserCustomTreeModel = config.getLinkBrowserCustomLinkTreeModel();
            if (type.equals(CMD_FILEBROWSER)) {
                // when in file mode we include the internal links to the selection
                myLinkChooserController = new LinkChooserController(lureq, lwControl, baseContainer, uploadRelPath, absolutePath, suffixes, uriValidation, fileName, linkBrowserCustomTreeModel, allowCustomMediaFactory);
            } else {
                // in media or image mode, internal links make no sense here
                myLinkChooserController = new LinkChooserController(lureq, lwControl, baseContainer, uploadRelPath, absolutePath, suffixes, uriValidation, fileName, null, allowCustomMediaFactory);
            }
            return new LayoutMain3ColsController(lureq, lwControl, myLinkChooserController);
        }
    };
    PopupBrowserWindow pbw = Windows.getWindows(ureq).getWindowManager().createNewPopupBrowserWindowFor(ureq, linkChooserControllerCreator);
    pbw.open(ureq);
}
Also used : CustomLinkTreeModel(org.olat.core.commons.controllers.linkchooser.CustomLinkTreeModel) LinkChooserController(org.olat.core.commons.controllers.linkchooser.LinkChooserController) PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) VFSContainer(org.olat.core.util.vfs.VFSContainer) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) WindowControl(org.olat.core.gui.control.WindowControl) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 38 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class GuiDemoFlexiFormMainController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Component source, Event event) {
    // there are only events of type link from the demos navigation
    if (source instanceof Link) {
        Link sl = (Link) source;
        // userobject tells which demo to activate
        String uob = (String) sl.getUserObject();
        if (uob != null) {
            ControllerCreator cc = demos.get(uob);
            // update source
            VelocityContainer sourceVC = createVelocityContainer(uob);
            ShrinkController sc = new ShrinkController(false, sourceVC, "toggle source");
            sourceP.setContent(sc.getInitialComponent());
            // cleanup former democontroller
            if (demoController != null)
                demoController.dispose();
            contentP.popContent();
            // create new demo controller
            demoController = cc.createController(ureq, getWindowControl());
            contentP.pushContent(demoController.getInitialComponent());
        }
    }
}
Also used : Link(org.olat.core.gui.components.link.Link) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) ShrinkController(org.olat.core.gui.control.generic.spacesaver.ShrinkController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 39 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class GuestBFWCParts method createFooterController.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#createFooterController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public LockableController createFooterController(UserRequest ureq, WindowControl wControl) {
    Controller footerCtr = null;
    // ----------- footer, optional (e.g. for copyright, powered by) ------------------
    if (CoreSpringFactory.containsBean("fullWebApp.GuestFooterControllerCreator")) {
        ControllerCreator footerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.GuestFooterControllerCreator");
        footerCtr = footerCreator.createController(ureq, wControl);
    } else {
        footerCtr = new OlatFooterController(ureq, wControl);
    }
    return (LockableController) footerCtr;
}
Also used : LockableController(org.olat.core.commons.fullWebApp.LockableController) OlatFooterController(org.olat.gui.control.OlatFooterController) Controller(org.olat.core.gui.control.Controller) OlatFooterController(org.olat.gui.control.OlatFooterController) LockableController(org.olat.core.commons.fullWebApp.LockableController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 40 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class GuestBFWCParts method createTopNavController.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#createTopNavController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public LockableController createTopNavController(UserRequest ureq, WindowControl wControl) {
    if (showTopNav) {
        LockableController topNavCtr = null;
        if (CoreSpringFactory.containsBean("fullWebApp.GuestTopNavControllerCreator")) {
            ControllerCreator headerControllerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.GuestTopNavControllerCreator");
            topNavCtr = (LockableController) headerControllerCreator.createController(ureq, wControl);
        }
        return topNavCtr;
    } else {
        return null;
    }
}
Also used : LockableController(org.olat.core.commons.fullWebApp.LockableController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Aggregations

ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)92 UserRequest (org.olat.core.gui.UserRequest)72 WindowControl (org.olat.core.gui.control.WindowControl)72 Controller (org.olat.core.gui.control.Controller)42 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)28 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)28 LockableController (org.olat.core.commons.fullWebApp.LockableController)20 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)12 Identity (org.olat.core.id.Identity)12 ArrayList (java.util.ArrayList)10 List (java.util.List)10 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)10 TableEvent (org.olat.core.gui.components.table.TableEvent)10 AssertException (org.olat.core.logging.AssertException)10 UserInfoMainController (org.olat.user.UserInfoMainController)10 OlatFooterController (org.olat.gui.control.OlatFooterController)8 HashMap (java.util.HashMap)6 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)6 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)6 Event (org.olat.core.gui.control.Event)6