Search in sources :

Example 1 with ShrinkController

use of org.olat.core.gui.control.generic.spacesaver.ShrinkController in project OpenOLAT by OpenOLAT.

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 2 with ShrinkController

use of org.olat.core.gui.control.generic.spacesaver.ShrinkController 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)

Aggregations

Link (org.olat.core.gui.components.link.Link)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)2 ShrinkController (org.olat.core.gui.control.generic.spacesaver.ShrinkController)2