Search in sources :

Example 6 with Component

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

the class LecturesToolController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (event instanceof SegmentViewEvent) {
        SegmentViewEvent sve = (SegmentViewEvent) event;
        String segmentCName = sve.getComponentName();
        Component clickedLink = mainVC.getComponent(segmentCName);
        if (clickedLink == teacherLink) {
            doOpenTeacherView(ureq);
        } else if (clickedLink == participantLink) {
            doOpenParticipantView(ureq);
        }
    } else if (stackPanel == source) {
        if (event instanceof PopEvent) {
            PopEvent popEvent = (PopEvent) event;
            if (popEvent.getController() instanceof TeacherRollCallController) {
                addToHistory(ureq, teacherOverviewCtrl);
            } else if (popEvent.getController() instanceof ParticipantLectureBlocksController) {
                addToHistory(ureq, participantOverviewCtrl);
            }
        }
    }
}
Also used : SegmentViewEvent(org.olat.core.gui.components.segmentedview.SegmentViewEvent) PopEvent(org.olat.core.gui.components.stack.PopEvent) Component(org.olat.core.gui.components.Component) SegmentViewComponent(org.olat.core.gui.components.segmentedview.SegmentViewComponent)

Example 7 with Component

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

the class WikiMainController method event.

@Override
public void event(UserRequest ureq, Component source, Event event) {
    String command = event.getCommand();
    setTabsEnabled(true);
    // to make shure we use the lateste page, reload from cache
    Wiki wiki = getWiki();
    if (wiki == null) {
        mainPanel.setContent(createVelocityContainer("deleted"));
        return;
    }
    WikiPage page = null;
    // FIXME:gs images and media should also be wiki pages -> see jamwiki
    if (!(event instanceof RequestNewPageEvent) && !(event instanceof RequestMediaEvent) && !(event instanceof RequestImageEvent)) {
        page = wiki.getPage(pageId, true);
        // set recent page id to the page currently used
        if (page != null) {
            pageId = page.getPageId();
        }
    }
    if (source == content) {
    // noting yet
    } else if (source == tabs) {
        /**
         ***********************************************************************
         * tabbed pane events
         ***********************************************************************
         */
        TabbedPaneChangedEvent tabEvent = (TabbedPaneChangedEvent) event;
        Component comp = tabEvent.getNewComponent();
        String compName = comp.getComponentName();
        selectTab(ureq, command, compName, page, wiki);
    } else if (source == wikiArticleComp) {
        /**
         ***********************************************************************
         * wiki component events
         ***********************************************************************
         */
        if (event instanceof RequestPageEvent) {
            RequestPageEvent pageEvent = (RequestPageEvent) event;
            page = openPage(ureq, pageEvent.getCommand(), wiki);
        } else if (event instanceof RequestNewPageEvent) {
            page = handleRequestNewPageEvent(ureq, (RequestNewPageEvent) event, wiki);
        } else if (event instanceof ErrorEvent) {
            showWarning(event.getCommand());
        } else if (event instanceof RequestMediaEvent) {
            deliverMediaFile(ureq, event.getCommand());
        } else if (event instanceof RequestImageEvent) {
            // instead of linking to the image-view-page itself
            if (isImageDetailView) {
                page = wiki.getPage(pageId, true);
                updatePageContext(ureq, page);
                isImageDetailView = false;
            } else {
                final WikiPage imagePage = new WikiPage(event.getCommand());
                imagePage.setContent("[[Image:" + event.getCommand() + "]]");
                articleContent.contextPut("page", imagePage);
                wikiArticleComp.setWikiContent(imagePage.getContent());
                setTabsEnabled(false);
                isImageDetailView = true;
            }
        }
    } else if (source == navigationContent) {
        /**
         ***********************************************************************
         * article container events
         ***********************************************************************
         */
        if (command.equals(ACTION_EDIT_MENU)) {
            page = wiki.getPage(WikiPage.WIKI_MENU_PAGE);
            updateFileAndLinkList(wiki);
            tryToSetEditLock(page, ureq, ores);
            updatePageContext(ureq, page);
            tabs.setSelectedPane(ureq, 2);
        }
    } else if (source == toMainPageLink) {
        // home link
        page = openIndexPage(ureq, wiki);
    } else if (source == a2zLink) {
        openAtoZPage(ureq, wiki);
    } else if (source == changesLink) {
        openLastChangesPage(ureq, wiki);
    } else if (source == editMenuButton) {
        page = wiki.getPage(WikiPage.WIKI_MENU_PAGE);
        updateFileAndLinkList(wiki);
        tryToSetEditLock(page, ureq, ores);
        updatePageContext(ureq, page);
        // wikiEditForm.setPage(page);
        tabs.setSelectedPane(ureq, 2);
    } else if (source == archiveLink) {
        // archive a snapshot of the wiki in the users personal folder
        archiveWikiDialogCtr = activateOkCancelDialog(ureq, null, translate("archive.question"), archiveWikiDialogCtr);
        return;
    } else if (source == createLink) {
        removeAsListenerAndDispose(calloutCtrl);
        removeAsListenerAndDispose(createArticleForm);
        createArticleForm = new WikiArticleSearchForm(ureq, getWindowControl());
        listenTo(createArticleForm);
        calloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(), createArticleForm.getInitialComponent(), createLink, "", true, null);
        listenTo(calloutCtrl);
        calloutCtrl.activate();
    } else if (source == versioningContent) {
    // nothing to do
    } else if (source == editContent) {
    // nothing to do
    } else if (source == closePreviewButton) {
        editContent.remove(wikiVersionDisplayComp);
    } else if (source == revertVersionButton) {
        wikiEditForm.setPage(selectedPage);
        tabs.setSelectedPane(ureq, 2);
        tryToSetEditLock(page, ureq, ores);
    } else if (source instanceof Link && "select-page".equals(command)) {
        String name = source.getComponentName();
        page = openPage(ureq, name, wiki);
    }
    // set recent page id to the page currently used
    if (page != null) {
        this.pageId = page.getPageId();
    }
}
Also used : RequestPageEvent(org.olat.modules.wiki.gui.components.wikiToHtml.RequestPageEvent) TabbedPaneChangedEvent(org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) RequestNewPageEvent(org.olat.modules.wiki.gui.components.wikiToHtml.RequestNewPageEvent) RequestMediaEvent(org.olat.modules.wiki.gui.components.wikiToHtml.RequestMediaEvent) ErrorEvent(org.olat.modules.wiki.gui.components.wikiToHtml.ErrorEvent) Component(org.olat.core.gui.components.Component) WikiMarkupComponent(org.olat.modules.wiki.gui.components.wikiToHtml.WikiMarkupComponent) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) MediaCollectorComponent(org.olat.modules.portfolio.ui.component.MediaCollectorComponent) Link(org.olat.core.gui.components.link.Link) RequestImageEvent(org.olat.modules.wiki.gui.components.wikiToHtml.RequestImageEvent)

Example 8 with Component

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

the class PFRunController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == segmentView) {
        if (event instanceof SegmentViewEvent) {
            SegmentViewEvent sve = (SegmentViewEvent) event;
            String segmentCName = sve.getComponentName();
            Component clickedLink = mainVC.getComponent(segmentCName);
            if (clickedLink == coachLink) {
                doOpenCoachView(ureq);
            } else if (clickedLink == participantLink) {
                doOpenParticipantsView(ureq);
            }
        }
    }
}
Also used : SegmentViewEvent(org.olat.core.gui.components.segmentedview.SegmentViewEvent) Component(org.olat.core.gui.components.Component) SegmentViewComponent(org.olat.core.gui.components.segmentedview.SegmentViewComponent)

Example 9 with Component

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

the class CheckListAssessmentController method doOpenBoxAssessment.

private void doOpenBoxAssessment(UserRequest ureq) {
    if (boxAssessmentCtrl != null)
        return;
    List<CheckListAssessmentRow> rows = model.getObjects();
    boxAssessmentCtrl = new CheckboxAssessmentController(ureq, getWindowControl(), checkboxList, rows, courseOres, courseNode);
    listenTo(boxAssessmentCtrl);
    String title = translate("box.assessment");
    Component content = boxAssessmentCtrl.getInitialComponent();
    cmc = new CloseableModalController(getWindowControl(), translate("close"), content, true, title);
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) Component(org.olat.core.gui.components.Component)

Example 10 with Component

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

the class CheckListBoxListEditController method doOpenEdit.

private void doOpenEdit(UserRequest ureq, Checkbox checkbox, boolean newCheckbox, String title) {
    if (editCtrl != null)
        return;
    Boolean hasScore = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
    boolean withScore = (hasScore == null || hasScore.booleanValue());
    editCtrl = new CheckboxEditController(ureq, getWindowControl(), courseOres, courseNode, checkbox, newCheckbox, withScore);
    listenTo(editCtrl);
    Component content = editCtrl.getInitialComponent();
    cmc = new CloseableModalController(getWindowControl(), translate("close"), content, true, title);
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) Component(org.olat.core.gui.components.Component)

Aggregations

Component (org.olat.core.gui.components.Component)300 SegmentViewComponent (org.olat.core.gui.components.segmentedview.SegmentViewComponent)90 SegmentViewEvent (org.olat.core.gui.components.segmentedview.SegmentViewEvent)90 ArrayList (java.util.ArrayList)36 Controller (org.olat.core.gui.control.Controller)28 Link (org.olat.core.gui.components.link.Link)22 BasicController (org.olat.core.gui.control.controller.BasicController)22 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)22 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)18 Panel (org.olat.core.gui.components.panel.Panel)12 HighScoreRunController (org.olat.course.highscore.ui.HighScoreRunController)12 Date (java.util.Date)10 UserRequest (org.olat.core.gui.UserRequest)10 ComponentRenderer (org.olat.core.gui.components.ComponentRenderer)10 TreeNode (org.olat.core.gui.components.tree.TreeNode)10 RenderResult (org.olat.core.gui.render.RenderResult)10 StringOutput (org.olat.core.gui.render.StringOutput)10 Translator (org.olat.core.gui.translator.Translator)10 AbstractComponent (org.olat.core.gui.components.AbstractComponent)8 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)8