Search in sources :

Example 1 with TabbedPaneChangedEvent

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

the class NotificationSubscriptionAndNewsController 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
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == tabbedPane) {
        if (event instanceof TabbedPaneChangedEvent) {
            TabbedPaneChangedEvent tabbedEvent = (TabbedPaneChangedEvent) event;
            // user clicks the tab the first time
            if (tabbedEvent.getNewComponent() == subscriptionPanel && subscriptionCtr == null) {
                subscriptionCtr = new NotificationSubscriptionController(ureq, getWindowControl(), subscriberIdentity, false);
                listenTo(subscriptionCtr);
                subscriptionPanel.setContent(subscriptionCtr.getInitialComponent());
            } else // user clicks the tab the first time
            if (tabbedEvent.getNewComponent() == rssPanel && rssPanel.getContent() == null) {
                VelocityContainer notificationsRssVC = createVelocityContainer("notificationsRSS");
                String rssLink = PersonalRSSUtil.getPersonalRssLink(ureq);
                notificationsRssVC.contextPut("rssLink", rssLink);
                User user = subscriberIdentity.getUser();
                String fullName = user.getProperty(UserConstants.FIRSTNAME, getLocale()) + " " + user.getProperty(UserConstants.LASTNAME, getLocale());
                notificationsRssVC.contextPut("fullName", fullName);
                rssPanel.setContent(notificationsRssVC);
            }
            // fxdiff BAKS-7 Resume function
            tabbedPane.addToHistory(ureq, getWindowControl());
        }
    }
}
Also used : User(org.olat.core.id.User) TabbedPaneChangedEvent(org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 2 with TabbedPaneChangedEvent

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

the class CalendarEntryDetailsController method event.

@Override
public void event(UserRequest ureq, Component source, Event event) {
    if (source == pane) {
        if (event instanceof TabbedPaneChangedEvent) {
            // prepare links tab
            TabbedPaneChangedEvent tpce = (TabbedPaneChangedEvent) event;
            if (tpce.getNewComponent().equals(linkVC)) {
                // display link provider if any
                String calendarID = eventForm.getChoosenKalendarID();
                KalendarRenderWrapper calendarWrapper = null;
                for (Iterator<KalendarRenderWrapper> iter = availableCalendars.iterator(); iter.hasNext(); ) {
                    calendarWrapper = iter.next();
                    if (calendarWrapper.getKalendar().getCalendarID().equals(calendarID)) {
                        break;
                    }
                }
                if (activeLinkProvider == null) {
                    activeLinkProvider = calendarWrapper.getLinkProvider();
                    if (activeLinkProvider != null) {
                        activeLinkProvider.addControllerListener(this);
                        activeLinkProvider.setKalendarEvent(kalendarEvent);
                        activeLinkProvider.setDisplayOnly(isReadOnly);
                        linkVC.put("linkprovider", activeLinkProvider.getControler().getInitialComponent());
                        linkVC.contextPut("hasLinkProvider", Boolean.TRUE);
                    } else {
                        linkVC.contextPut("hasLinkProvider", Boolean.FALSE);
                    }
                }
            }
        }
    }
}
Also used : TabbedPaneChangedEvent(org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 3 with TabbedPaneChangedEvent

use of org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent 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 4 with TabbedPaneChangedEvent

use of org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent in project openolat by klemens.

the class NotificationSubscriptionAndNewsController 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
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == tabbedPane) {
        if (event instanceof TabbedPaneChangedEvent) {
            TabbedPaneChangedEvent tabbedEvent = (TabbedPaneChangedEvent) event;
            // user clicks the tab the first time
            if (tabbedEvent.getNewComponent() == subscriptionPanel && subscriptionCtr == null) {
                subscriptionCtr = new NotificationSubscriptionController(ureq, getWindowControl(), subscriberIdentity, false);
                listenTo(subscriptionCtr);
                subscriptionPanel.setContent(subscriptionCtr.getInitialComponent());
            } else // user clicks the tab the first time
            if (tabbedEvent.getNewComponent() == rssPanel && rssPanel.getContent() == null) {
                VelocityContainer notificationsRssVC = createVelocityContainer("notificationsRSS");
                String rssLink = PersonalRSSUtil.getPersonalRssLink(ureq);
                notificationsRssVC.contextPut("rssLink", rssLink);
                User user = subscriberIdentity.getUser();
                String fullName = user.getProperty(UserConstants.FIRSTNAME, getLocale()) + " " + user.getProperty(UserConstants.LASTNAME, getLocale());
                notificationsRssVC.contextPut("fullName", fullName);
                rssPanel.setContent(notificationsRssVC);
            }
            // fxdiff BAKS-7 Resume function
            tabbedPane.addToHistory(ureq, getWindowControl());
        }
    }
}
Also used : User(org.olat.core.id.User) TabbedPaneChangedEvent(org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 5 with TabbedPaneChangedEvent

use of org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent in project openolat by klemens.

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)

Aggregations

TabbedPaneChangedEvent (org.olat.core.gui.components.tabbedpane.TabbedPaneChangedEvent)8 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)2 Component (org.olat.core.gui.components.Component)2 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)2 Link (org.olat.core.gui.components.link.Link)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)2 User (org.olat.core.id.User)2 MediaCollectorComponent (org.olat.modules.portfolio.ui.component.MediaCollectorComponent)2 ErrorEvent (org.olat.modules.wiki.gui.components.wikiToHtml.ErrorEvent)2 RequestImageEvent (org.olat.modules.wiki.gui.components.wikiToHtml.RequestImageEvent)2 RequestMediaEvent (org.olat.modules.wiki.gui.components.wikiToHtml.RequestMediaEvent)2 RequestNewPageEvent (org.olat.modules.wiki.gui.components.wikiToHtml.RequestNewPageEvent)2 RequestPageEvent (org.olat.modules.wiki.gui.components.wikiToHtml.RequestPageEvent)2 WikiMarkupComponent (org.olat.modules.wiki.gui.components.wikiToHtml.WikiMarkupComponent)2