Search in sources :

Example 6 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class BasicController method doPreDispose.

@Override
protected void doPreDispose() {
    // deregister all mappers if needed
    if (mapperKeys != null) {
        CoreSpringFactory.getImpl(MapperService.class).cleanUp(mapperKeys);
        mapperKeys.clear();
        mapperKeys = null;
    }
    // dispose child controller if needed
    if (childControllers != null) {
        for (Controller c : childControllers) {
            c.dispose();
        }
    }
}
Also used : DialogBoxController(org.olat.core.gui.control.generic.modal.DialogBoxController) Controller(org.olat.core.gui.control.Controller) DefaultController(org.olat.core.gui.control.DefaultController) MapperService(org.olat.core.dispatcher.mapper.MapperService)

Example 7 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class FactoryControllerCreator method createController.

/**
 * @see org.olat.core.gui.control.creator.ControllerCreator#createController(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl)
 */
public Controller createController(UserRequest lureq, WindowControl lwControl) {
    Exception re = null;
    try {
        Object o = null;
        Class<?> cclazz = Thread.currentThread().getContextClassLoader().loadClass(factoryName);
        try {
            Constructor<?> con = cclazz.getConstructor(ARGCLASSES);
            o = con.newInstance(new Object[] { lureq, lwControl });
        } catch (NoSuchMethodException e) {
        // constructor does not exist with arguments ARGCLASSES => try invoking
        // method without instantiated class (o = null).
        }
        Method method = cclazz.getMethod(factoryMethod, ARGCLASSES);
        Object result = method.invoke(o, new Object[] { lureq, lwControl });
        Controller c = (Controller) result;
        return c;
    } catch (ClassNotFoundException e) {
        re = e;
    } catch (SecurityException e) {
        re = e;
    } catch (NoSuchMethodException e) {
        re = e;
    } catch (IllegalArgumentException e) {
        re = e;
    } catch (IllegalAccessException e) {
        re = e;
    } catch (InvocationTargetException e) {
        re = e;
    } catch (InstantiationException e) {
        re = e;
    } finally {
        if (re != null) {
            throw new AssertException("could not create controller via reflection. factoryName: " + factoryName + " method: " + factoryMethod, re);
        }
    }
    return null;
}
Also used : AssertException(org.olat.core.logging.AssertException) Method(java.lang.reflect.Method) Controller(org.olat.core.gui.control.Controller) AssertException(org.olat.core.logging.AssertException) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 8 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class GenericMainController method getContentCtr.

private Controller getContentCtr(Object uobject, UserRequest ureq) {
    Controller contentCtr1Tmp = null;
    if (uobject instanceof ActionExtension) {
        ActionExtension ae = (ActionExtension) uobject;
        contentCtr1Tmp = createController(ae, ureq);
    } else {
        contentCtr1Tmp = handleOwnMenuTreeEvent(uobject, ureq);
    }
    if (contentCtr1Tmp == null) {
        throw new AssertException("Node must either be an ActionExtension or implementation must handle this MenuTreeEvent: " + (uobject == null ? "NULL" : uobject.toString()));
    }
    return contentCtr1Tmp;
}
Also used : AssertException(org.olat.core.logging.AssertException) ActionExtension(org.olat.core.extensions.action.ActionExtension) GenericActionExtension(org.olat.core.extensions.action.GenericActionExtension) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Controller(org.olat.core.gui.control.Controller) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController)

Example 9 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class TitledWrapperController method cloneController.

@Override
public Controller cloneController(UserRequest ureq, WindowControl wControl) {
    if (contentController == null || contentController instanceof CloneableController) {
        Controller wrappedAndCloned = ((CloneableController) contentController).cloneController(ureq, wControl);
        TitledWrapperController clone = new TitledWrapperController(ureq, wControl, wrappedAndCloned, wrapperCss, titleInfo);
        clone.setTitle((String) theVelocityContainer.getContext().get(TITLE_VAR));
        clone.setSubTitle((String) theVelocityContainer.getContext().get(SUBTITLE_VAR));
        clone.setContextTitle((String) theVelocityContainer.getContext().get(CONTEXT_TITLE_VAR));
        clone.setIconCssClass((String) theVelocityContainer.getContext().get(ICON_CSS));
        clone.setSeparatorEnabled((Boolean) theVelocityContainer.getContext().get(USE_SEPARATOR));
        clone.setTitleSize((Integer) theVelocityContainer.getContext().get(TITLE_SIZE));
        return clone;
    }
    return null;
}
Also used : CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) ToggleBoxController(org.olat.core.gui.control.generic.spacesaver.ToggleBoxController) TooledController(org.olat.core.gui.components.stack.TooledController)

Example 10 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class DevelopmentController method dumpTree.

private void dumpTree(StringOutput sb, Component current, int indent, Map<Controller, List<Component>> controllerInfos) {
    // add infos,
    Controller lController = org.olat.core.gui.dev.Util.getListeningControllerFor(current);
    if (lController != null) {
        List<Component> lcomps = controllerInfos.get(lController);
        if (lcomps == null) {
            // first entry
            lcomps = new ArrayList<Component>();
            controllerInfos.put(lController, lcomps);
        }
        lcomps.add(current);
    }
    int pxInd = indent * 25;
    String pcid = Renderer.getComponentPrefix(current);
    sb.append("<div id='dmt_").append(pcid).append("' ");
    if (current.isVisible() && current.isDomReplaceable()) {
        sb.append(" onMouseOver=\"jQuery(this).css('background-color','#f3feff');o_dbg_mark('").append(pcid).append("')\" onMouseOut=\"jQuery(this).css('background-color','');o_dbg_unmark('").append(pcid).append("')\"");
    }
    sb.append(" style=\"color:blue; padding-bottom:2px; font-size:10px\"><div style=\"margin-left:" + pxInd + "px\">");
    String cname = current.getClass().getName();
    cname = cname.substring(cname.lastIndexOf('.') + 1);
    sb.append("<b>" + cname + "</b> (" + current.getComponentName() + " id " + current.getDispatchID() + ") ");
    if (current == mainComp) {
        // suppress detail and subtree for our controller here
        sb.append(" --suppressing output, since developmentcontroller --</div></div>");
    } else {
        sb.append((current.isVisible() ? "" : "INVISIBLE ") + (current.isEnabled() ? "" : " NOT ENABLED ") + current.getExtendedDebugInfo() + ", " + current.getListenerInfo() + "<br />");
        sb.append("</div></div>");
        if (current instanceof Container) {
            Container co = (Container) current;
            for (Component child : co.getComponents()) {
                dumpTree(sb, child, indent + 1, controllerInfos);
            }
        }
    }
}
Also used : VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) Container(org.olat.core.gui.components.Container) FloatingResizableDialogController(org.olat.core.gui.control.floatingresizabledialog.FloatingResizableDialogController) ExpColController(org.olat.core.gui.control.generic.spacesaver.ExpColController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) DefaultController(org.olat.core.gui.control.DefaultController) Component(org.olat.core.gui.components.Component)

Aggregations

Controller (org.olat.core.gui.control.Controller)372 BasicController (org.olat.core.gui.control.controller.BasicController)114 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)82 NodeEditController (org.olat.course.editor.NodeEditController)82 WindowControl (org.olat.core.gui.control.WindowControl)78 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)74 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)62 RepositoryEntry (org.olat.repository.RepositoryEntry)60 Translator (org.olat.core.gui.translator.Translator)54 UserRequest (org.olat.core.gui.UserRequest)52 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)50 OLATResourceable (org.olat.core.id.OLATResourceable)46 ArrayList (java.util.ArrayList)40 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)40 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)36 Component (org.olat.core.gui.components.Component)34 Roles (org.olat.core.id.Roles)34 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)32 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)30 ContextEntry (org.olat.core.id.context.ContextEntry)30