Search in sources :

Example 51 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class AuthorListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (addOwnersButton == source) {
        List<AuthoringEntryRow> rows = getMultiSelectedRows();
        if (!rows.isEmpty()) {
            doAddOwners(ureq, rows);
        } else {
            showWarning("bulk.update.nothing.selected");
        }
    } else if (sendMailButton == source) {
        List<AuthoringEntryRow> rows = getMultiSelectedRows();
        if (!rows.isEmpty()) {
            doSendMail(ureq, rows);
        } else {
            showWarning("bulk.update.nothing.selected");
        }
    } else if (copyButton == source) {
        List<AuthoringEntryRow> rows = getMultiSelectedRows();
        if (!rows.isEmpty()) {
            doConfirmCopy(ureq, rows);
        } else {
            showWarning("bulk.update.nothing.selected");
        }
    } else if (deleteButton == source) {
        List<AuthoringEntryRow> rows = getMultiSelectedRows();
        if (!rows.isEmpty()) {
            doDelete(ureq, rows);
        } else {
            showWarning("bulk.update.nothing.selected");
        }
    } else if (closedEl == source) {
        doSetClosedFilter();
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("mark".equals(cmd)) {
            AuthoringEntryRow row = (AuthoringEntryRow) link.getUserObject();
            boolean marked = doMark(ureq, row);
            link.setIconLeftCSS(marked ? "o_icon o_icon_bookmark o_icon-lg" : "o_icon o_icon_bookmark_add o_icon-lg");
            link.setTitle(translate(marked ? "details.bookmark.remove" : "details.bookmark"));
            link.getComponent().setDirty(true);
            row.setMarked(marked);
        } else if ("tools".equals(cmd)) {
            AuthoringEntryRow row = (AuthoringEntryRow) link.getUserObject();
            doOpenTools(ureq, row, link);
        } else if ("references".equals(cmd)) {
            AuthoringEntryRow row = (AuthoringEntryRow) link.getUserObject();
            doOpenReferences(ureq, row, link);
        }
    } else if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            AuthoringEntryRow row = model.getObject(se.getIndex());
            if ("details".equals(cmd)) {
                launchDetails(ureq, row);
            } else if ("edit".equals(cmd)) {
                launchEditor(ureq, row);
            } else if ("select".equals(cmd)) {
                launch(ureq, row);
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            AuthorListState stateEntry = new AuthorListState();
            stateEntry.setTableState(tableEl.getStateEntry());
            addToHistory(ureq, stateEntry);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) List(java.util.List) ArrayList(java.util.ArrayList) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 52 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class AuthorListController method forgeLinks.

@Override
public void forgeLinks(AuthoringEntryRow row) {
    // mark
    FormLink markLink = uifactory.addFormLink("mark_" + counter.incrementAndGet(), "mark", "", null, null, Link.NONTRANSLATED);
    markLink.setIconLeftCSS(row.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
    markLink.setTitle(translate(row.isMarked() ? "details.bookmark.remove" : "details.bookmark"));
    markLink.setUserObject(row);
    row.setMarkLink(markLink);
    // tools
    FormLink toolsLink = uifactory.addFormLink("tools_" + counter.incrementAndGet(), "tools", "", null, null, Link.NONTRANSLATED);
    toolsLink.setIconLeftCSS("o_icon o_icon_actions o_icon-lg");
    toolsLink.setUserObject(row);
    row.setToolsLink(toolsLink);
    // references
    if (row.getNumOfReferences() > 0) {
        String numOfReferences = Integer.toString(row.getNumOfReferences());
        FormLink referencesLink = uifactory.addFormLink("tools_" + counter.incrementAndGet(), "references", numOfReferences, null, null, Link.NONTRANSLATED);
        referencesLink.setUserObject(row);
        row.setReferencesLink(referencesLink);
    }
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 53 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class RepositoryEntryListController method forgeMarkLink.

@Override
public void forgeMarkLink(RepositoryEntryRow row) {
    if (!guestOnly) {
        FormLink markLink = uifactory.addFormLink("mark_" + row.getKey(), "mark", "", null, null, Link.NONTRANSLATED);
        markLink.setIconLeftCSS(row.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        markLink.setTitle(translate(row.isMarked() ? "details.bookmark.remove" : "details.bookmark"));
        markLink.setUserObject(row);
        row.setMarkLink(markLink);
    }
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 54 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class RepositoryEntryListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof RatingWithAverageFormItem && event instanceof RatingFormEvent) {
        RatingFormEvent ratingEvent = (RatingFormEvent) event;
        RatingWithAverageFormItem ratingItem = (RatingWithAverageFormItem) source;
        RepositoryEntryRow row = (RepositoryEntryRow) ratingItem.getUserObject();
        doRating(row, ratingEvent.getRating());
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("mark".equals(cmd)) {
            RepositoryEntryRow row = (RepositoryEntryRow) link.getUserObject();
            boolean marked = doMark(ureq, row);
            link.setIconLeftCSS(marked ? "o_icon o_icon_bookmark o_icon-lg" : "o_icon o_icon_bookmark_add o_icon-lg");
            link.setTitle(translate(marked ? "details.bookmark.remove" : "details.bookmark"));
            link.getComponent().setDirty(true);
            row.setMarked(marked);
        } else if ("start".equals(cmd)) {
            RepositoryEntryRow row = (RepositoryEntryRow) link.getUserObject();
            doOpen(ureq, row, null);
        } else if ("details".equals(cmd)) {
            RepositoryEntryRow row = (RepositoryEntryRow) link.getUserObject();
            doOpenDetails(ureq, row);
        } else if ("select".equals(cmd)) {
            RepositoryEntryRow row = (RepositoryEntryRow) link.getUserObject();
            if (row.isMember()) {
                doOpen(ureq, row, null);
            } else {
                doOpenDetails(ureq, row);
            }
        } else if ("comments".equals(cmd)) {
            RepositoryEntryRow row = (RepositoryEntryRow) link.getUserObject();
            doOpenComments(ureq, row);
        }
    } else if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            RepositoryEntryRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                if (row.isMember()) {
                    doOpen(ureq, row, null);
                } else {
                    doOpenDetails(ureq, row);
                }
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            RepositoryEntryListState state = new RepositoryEntryListState();
            state.setTableState(tableEl.getStateEntry());
            addToHistory(ureq, state);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : RatingWithAverageFormItem(org.olat.core.gui.components.rating.RatingWithAverageFormItem) RatingFormEvent(org.olat.core.gui.components.rating.RatingFormEvent) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 55 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class RepositoryEntryListController method forgeComments.

@Override
public void forgeComments(RepositoryEntryRow row) {
    if (repositoryModule.isCommentEnabled()) {
        long numOfComments = row.getNumOfComments();
        String title = "(" + numOfComments + ")";
        FormLink commentsLink = uifactory.addFormLink("comments_" + row.getKey(), "comments", title, null, null, Link.NONTRANSLATED);
        commentsLink.setUserObject(row);
        String css = numOfComments > 0 ? "o_icon o_icon_comments o_icon-lg" : "o_icon o_icon_comments_none o_icon-lg";
        commentsLink.setCustomEnabledLinkCSS("o_comments");
        commentsLink.setIconLeftCSS(css);
        row.setCommentsLink(commentsLink);
    }
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Aggregations

FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)376 ArrayList (java.util.ArrayList)108 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)64 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)40 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)36 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)34 List (java.util.List)30 FormItem (org.olat.core.gui.components.form.flexible.FormItem)28 HashMap (java.util.HashMap)26 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)24 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)22 Date (java.util.Date)18 Map (java.util.Map)18 Link (org.olat.core.gui.components.link.Link)18 Identity (org.olat.core.id.Identity)18 Component (org.olat.core.gui.components.Component)16 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)16 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)16 Controller (org.olat.core.gui.control.Controller)16 Event (org.olat.core.gui.control.Event)16