Search in sources :

Example 1 with MenuTree

use of org.olat.core.gui.components.tree.MenuTree in project OpenOLAT by OpenOLAT.

the class CmdMoveCopy method execute.

@Override
public Controller execute(FolderComponent fc, UserRequest ureq, WindowControl windowControl, Translator trans) {
    this.folderComponent = fc;
    this.translator = trans;
    this.fileSelection = new FileSelection(ureq, fc.getCurrentContainerPath());
    VelocityContainer main = new VelocityContainer("mc", VELOCITY_ROOT + "/movecopy.html", translator, this);
    main.contextPut("fileselection", fileSelection);
    // check if command is executed on a file list containing invalid filenames or paths
    if (fileSelection.getInvalidFileNames().size() > 0) {
        main.contextPut("invalidFileNames", fileSelection.getInvalidFileNames());
    }
    selTree = new MenuTree(null, "seltree", this);
    FolderTreeModel ftm = new FolderTreeModel(ureq.getLocale(), fc.getRootContainer(), true, false, true, fc.getRootContainer().canWrite() == VFSConstants.YES, new EditableFilter());
    selTree.setTreeModel(ftm);
    selectButton = LinkFactory.createButton(move ? "move" : "copy", main, this);
    cancelButton = LinkFactory.createButton("cancel", main, this);
    main.put("seltree", selTree);
    if (move) {
        main.contextPut("move", Boolean.TRUE);
    }
    setInitialComponent(main);
    return this;
}
Also used : FileSelection(org.olat.core.commons.modules.bc.FileSelection) MenuTree(org.olat.core.gui.components.tree.MenuTree) FolderTreeModel(org.olat.core.gui.control.generic.folder.FolderTreeModel) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 2 with MenuTree

use of org.olat.core.gui.components.tree.MenuTree in project OpenOLAT by OpenOLAT.

the class QTIEditorMainController method init.

private void init(UserRequest ureq) {
    main = createVelocityContainer("index");
    JSAndCSSComponent jsAndCss;
    // Add html header js
    jsAndCss = new JSAndCSSComponent("qitjsandcss", new String[] { "js/openolat/qti.js" }, null);
    main.put("qitjsandcss", jsAndCss);
    mainPanel = new Panel("p_qti_editor");
    mainPanel.setContent(main);
    if (notEditable) {
        // test not editable
        VelocityContainer notEditableVc = createVelocityContainer("notEditable");
        notEditableButton = LinkFactory.createButton("ok", notEditableVc, this);
        Panel panel = new Panel("notEditable");
        panel.setContent(notEditableVc);
        columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, panel, null);
        putInitialPanel(columnLayoutCtr.getInitialComponent());
        return;
    }
    stackedPanel = new TooledStackedPanel("qtiEditorStackedPanel", getTranslator(), this);
    stackedPanel.setCssClass("o_edit_mode");
    // initialize the history
    if (qtiPackage.isResumed() && qtiPackage.hasSerializedChangelog()) {
        // there were already changes made -> reload!
        history = qtiPackage.loadChangelog();
    } else {
        // start with a fresh history. Editor is resumed but no changes were made
        // so far.
        history = new HashMap<String, Memento>();
    }
    // The menu tree model represents the structure of the qti document.
    // All insert/move operations on the model are propagated to the structure
    // by the node
    menuTreeModel = new QTIEditorTreeModel(qtiPackage);
    menuTree = new MenuTree("QTIDocumentTree");
    menuTree.setTreeModel(menuTreeModel);
    menuTree.setSelectedNodeId(menuTree.getTreeModel().getRootNode().getIdent());
    // listen to the tree
    menuTree.addListener(this);
    // remember the qtidoc title when we started this editor, to correctly name
    // the history report
    startedWithTitle = menuTree.getSelectedNode().getAltText();
    // 
    main.put("tabbedPane", menuTreeModel.getQtiRootNode().createEditTabbedPane(ureq, getWindowControl(), getTranslator(), this));
    main.contextPut("qtititle", menuTreeModel.getQtiRootNode().getAltText());
    main.contextPut("isRestrictedEdit", restrictedEdit ? Boolean.TRUE : Boolean.FALSE);
    // 
    columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), menuTree, mainPanel, "qtieditor" + qtiPackage.getRepresentingResourceable());
    listenTo(columnLayoutCtr);
    stackedPanel.pushController("Editor", columnLayoutCtr);
    // qtiPackage must be loaded previousely
    populateToolC();
    // Add css background
    if (restrictedEdit) {
        addSectionLink.setEnabled(false);
        addSCLink.setEnabled(false);
        addMCLink.setEnabled(false);
        addPoolLink.setEnabled(false);
        addFIBLink.setEnabled(false);
        if (!qtiPackage.getQTIDocument().isSurvey()) {
            addKPrimLink.setEnabled(false);
        }
        addEssayLink.setEnabled(false);
        columnLayoutCtr.addCssClassToMain("o_editor_qti_correct");
    } else {
        columnLayoutCtr.addCssClassToMain("o_editor_qti");
    }
    deleteLink.setEnabled(false);
    moveLink.setEnabled(false);
    copyLink.setEnabled(false);
    putInitialPanel(stackedPanel);
    if (restrictedEdit) {
        // we would like to us a modal dialog here, but this does not work! we
        // can't push to stack because the outher workflows pushes us after the
        // controller to the stack. Thus, if we used a modal dialog here the
        // dialog would never show up.
        columnLayoutCtr.setCol3(new Panel("empty"));
        columnLayoutCtr.hideCol1(true);
        columnLayoutCtr.hideCol2(true);
        String text = translate("qti.restricted.edit.warning") + "<br/><br/>" + createReferenceesMsg(ureq);
        proceedRestricedEditDialog = DialogBoxUIFactory.createYesNoDialog(ureq, getWindowControl(), null, text);
        listenTo(proceedRestricedEditDialog);
        proceedRestricedEditDialog.activate();
    }
}
Also used : QTIEditorTreeModel(org.olat.ims.qti.editor.tree.QTIEditorTreeModel) MenuTree(org.olat.core.gui.components.tree.MenuTree) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Memento(org.olat.core.util.memento.Memento) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 3 with MenuTree

use of org.olat.core.gui.components.tree.MenuTree in project openolat by klemens.

the class CmdMoveCopy method execute.

@Override
public Controller execute(FolderComponent fc, UserRequest ureq, WindowControl windowControl, Translator trans) {
    this.folderComponent = fc;
    this.translator = trans;
    this.fileSelection = new FileSelection(ureq, fc.getCurrentContainerPath());
    VelocityContainer main = new VelocityContainer("mc", VELOCITY_ROOT + "/movecopy.html", translator, this);
    main.contextPut("fileselection", fileSelection);
    // check if command is executed on a file list containing invalid filenames or paths
    if (fileSelection.getInvalidFileNames().size() > 0) {
        main.contextPut("invalidFileNames", fileSelection.getInvalidFileNames());
    }
    selTree = new MenuTree(null, "seltree", this);
    FolderTreeModel ftm = new FolderTreeModel(ureq.getLocale(), fc.getRootContainer(), true, false, true, fc.getRootContainer().canWrite() == VFSConstants.YES, new EditableFilter());
    selTree.setTreeModel(ftm);
    selectButton = LinkFactory.createButton(move ? "move" : "copy", main, this);
    cancelButton = LinkFactory.createButton("cancel", main, this);
    main.put("seltree", selTree);
    if (move) {
        main.contextPut("move", Boolean.TRUE);
    }
    setInitialComponent(main);
    return this;
}
Also used : FileSelection(org.olat.core.commons.modules.bc.FileSelection) MenuTree(org.olat.core.gui.components.tree.MenuTree) FolderTreeModel(org.olat.core.gui.control.generic.folder.FolderTreeModel) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 4 with MenuTree

use of org.olat.core.gui.components.tree.MenuTree in project openolat by klemens.

the class GenericMainController method init.

/**
 * use after optional addChildNodeToAppend() or addChildNodeToPrepend() calls
 * to initialize MainController and set Panel
 *
 * @param ureq
 */
public void init(UserRequest ureq) {
    olatMenuTree = new MenuTree("olatMenuTree");
    TreeModel tm = buildTreeModel(ureq);
    olatMenuTree.setTreeModel(tm);
    content = new Panel("content");
    TreeNode firstNode = tm.getRootNode();
    TreeNode nodeToSelect = getLastDelegate(firstNode);
    olatMenuTree.setSelectedNodeId(nodeToSelect.getIdent());
    olatMenuTree.addListener(this);
    // default is to not display the root element and to let user open/close sub elements
    olatMenuTree.setRootVisible(false);
    olatMenuTree.setExpandSelectedNode(false);
    Object uobject = nodeToSelect.getUserObject();
    contentCtr = getContentCtr(uobject, ureq);
    // auto dispose later
    listenTo(contentCtr);
    Component resComp = contentCtr.getInitialComponent();
    content.setContent(resComp);
    columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), olatMenuTree, content, className);
    // auto dispose later
    listenTo(columnLayoutCtr);
    // create the stack
    stackVC = new BreadcrumbedStackedPanel("genericStack", getTranslator(), this);
    stackVC.pushController("content", columnLayoutCtr);
    putInitialPanel(stackVC);
}
Also used : MenuTree(org.olat.core.gui.components.tree.MenuTree) TreeModel(org.olat.core.gui.components.tree.TreeModel) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) BreadcrumbPanel(org.olat.core.gui.components.stack.BreadcrumbPanel) Panel(org.olat.core.gui.components.panel.Panel) BreadcrumbedStackedPanel(org.olat.core.gui.components.stack.BreadcrumbedStackedPanel) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Component(org.olat.core.gui.components.Component) BreadcrumbedStackedPanel(org.olat.core.gui.components.stack.BreadcrumbedStackedPanel)

Example 5 with MenuTree

use of org.olat.core.gui.components.tree.MenuTree in project OpenOLAT by OpenOLAT.

the class EPCollectStepForm04 method initForm.

/**
 * @see org.olat.core.gui.control.generic.wizard.StepFormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    List<PortfolioStructure> structs = ePFMgr.getStructureElementsForUser(getIdentity());
    if (structs != null && structs.size() != 0) {
        TreeModel treeModel = new MapsTreeModel(getIdentity(), getTranslator());
        mapsTreeController = new MenuTree("my.maps");
        mapsTreeController.setTreeModel(treeModel);
        mapsTreeController.setSelectedNode(treeModel.getRootNode());
        mapsTreeController.setDragEnabled(false);
        mapsTreeController.setDropEnabled(false);
        mapsTreeController.setDropSiblingEnabled(false);
        mapsTreeController.addListener(this);
        mapsTreeController.setRootVisible(true);
        if (preSelectedStructure != null) {
            TreeNode node = TreeHelper.findNodeByUserObject(preSelectedStructure, treeModel.getRootNode());
            if (node != null) {
                mapsTreeController.setSelectedNode(node);
            }
        }
        flc.put("treeCtr", mapsTreeController);
    }
    if (!isUsedInStepWizzard()) {
        // add form buttons
        uifactory.addFormSubmitButton("stepform.submit", formLayout);
    }
}
Also used : MenuTree(org.olat.core.gui.components.tree.MenuTree) TreeModel(org.olat.core.gui.components.tree.TreeModel) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure)

Aggregations

MenuTree (org.olat.core.gui.components.tree.MenuTree)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)4 Panel (org.olat.core.gui.components.panel.Panel)4 TreeModel (org.olat.core.gui.components.tree.TreeModel)4 TreeNode (org.olat.core.gui.components.tree.TreeNode)4 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)4 FileSelection (org.olat.core.commons.modules.bc.FileSelection)2 Component (org.olat.core.gui.components.Component)2 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)2 BreadcrumbPanel (org.olat.core.gui.components.stack.BreadcrumbPanel)2 BreadcrumbedStackedPanel (org.olat.core.gui.components.stack.BreadcrumbedStackedPanel)2 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)2 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 FolderTreeModel (org.olat.core.gui.control.generic.folder.FolderTreeModel)2 Memento (org.olat.core.util.memento.Memento)2 QTIEditorTreeModel (org.olat.ims.qti.editor.tree.QTIEditorTreeModel)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2