Search in sources :

Example 1 with RatingFormEvent

use of org.olat.core.gui.components.rating.RatingFormEvent 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 2 with RatingFormEvent

use of org.olat.core.gui.components.rating.RatingFormEvent in project openolat by klemens.

the class RepositoryEntryDetailsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("category".equals(cmd)) {
            Long categoryKey = (Long) link.getUserObject();
            doOpenCategory(ureq, categoryKey);
        } else if ("mark".equals(cmd)) {
            boolean marked = doMark();
            markLink.setI18nKey(marked ? "details.bookmark.remove" : "details.bookmark");
            markLink.setIconLeftCSS(marked ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        } else if ("comments".equals(cmd)) {
            doOpenComments(ureq);
        } else if ("start".equals(cmd)) {
            doStart(ureq);
        } else if ("group".equals(cmd)) {
            Long groupKey = (Long) link.getUserObject();
            doOpenGroup(ureq, groupKey);
        } else if ("owner".equals(cmd)) {
            Long ownerKey = (Long) link.getUserObject();
            doOpenVisitCard(ureq, ownerKey);
        } else if ("leave".equals(cmd)) {
            doConfirmLeave(ureq);
        } else if ("ref".equals(cmd)) {
            doOpenReference(ureq, (Long) link.getUserObject());
        }
    } else if (ratingEl == source && event instanceof RatingFormEvent) {
        RatingFormEvent ratingEvent = (RatingFormEvent) event;
        doRating(ratingEvent.getRating());
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : RatingFormEvent(org.olat.core.gui.components.rating.RatingFormEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 3 with RatingFormEvent

use of org.olat.core.gui.components.rating.RatingFormEvent in project openolat by klemens.

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 4 with RatingFormEvent

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

the class RepositoryEntryDetailsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("category".equals(cmd)) {
            Long categoryKey = (Long) link.getUserObject();
            doOpenCategory(ureq, categoryKey);
        } else if ("mark".equals(cmd)) {
            boolean marked = doMark();
            markLink.setI18nKey(marked ? "details.bookmark.remove" : "details.bookmark");
            markLink.setIconLeftCSS(marked ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        } else if ("comments".equals(cmd)) {
            doOpenComments(ureq);
        } else if ("start".equals(cmd)) {
            doStart(ureq);
        } else if ("group".equals(cmd)) {
            Long groupKey = (Long) link.getUserObject();
            doOpenGroup(ureq, groupKey);
        } else if ("owner".equals(cmd)) {
            Long ownerKey = (Long) link.getUserObject();
            doOpenVisitCard(ureq, ownerKey);
        } else if ("leave".equals(cmd)) {
            doConfirmLeave(ureq);
        } else if ("ref".equals(cmd)) {
            doOpenReference(ureq, (Long) link.getUserObject());
        }
    } else if (ratingEl == source && event instanceof RatingFormEvent) {
        RatingFormEvent ratingEvent = (RatingFormEvent) event;
        doRating(ratingEvent.getRating());
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : RatingFormEvent(org.olat.core.gui.components.rating.RatingFormEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Aggregations

FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 RatingFormEvent (org.olat.core.gui.components.rating.RatingFormEvent)4 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 RatingWithAverageFormItem (org.olat.core.gui.components.rating.RatingWithAverageFormItem)2