Search in sources :

Example 1 with EPArtefactTagCloud

use of org.olat.portfolio.manager.EPArtefactTagCloud in project OpenOLAT by OpenOLAT.

the class EPTagBrowseController method recalculateTagCloud.

private List<AbstractArtefact> recalculateTagCloud() {
    List<String> selectedTags = getSelectedTags();
    if (selectedTags.isEmpty()) {
        for (Link tagLink : tagLinks) {
            TagWrapper tagWrapper = (TagWrapper) tagLink.getUserObject();
            tagLink.setCustomEnabledLinkCSS(inactiveCSS);
            tagLink.setEnabled(true);
            tagWrapper.setState(TagState.possible);
        }
        return allUsersArtefacts;
    }
    EPArtefactTagCloud artefactsAndTags = ePFMgr.getArtefactsAndTagCloud(getIdentity(), selectedTags);
    List<AbstractArtefact> filteredArtefacts = artefactsAndTags.getArtefacts();
    Set<String> newTags = artefactsAndTags.getTags();
    if (newTags != null && !newTags.isEmpty()) {
        for (Link tagLink : tagLinks) {
            TagWrapper tagWrapper = (TagWrapper) tagLink.getUserObject();
            String tag = tagWrapper.getTag();
            switch(tagWrapper.getState()) {
                case selected:
                    tagLink.setCustomEnabledLinkCSS(activeCSS);
                    tagLink.setEnabled(true);
                    break;
                case possible:
                    if (!newTags.contains(tag)) {
                        tagWrapper.setState(TagState.unpossible);
                        tagLink.setEnabled(false);
                    } else {
                        tagLink.setCustomEnabledLinkCSS(inactiveCSS);
                        tagLink.setEnabled(true);
                    }
                    break;
                case unpossible:
                    if (newTags.contains(tag)) {
                        tagWrapper.setState(TagState.possible);
                        tagLink.setCustomEnabledLinkCSS(inactiveCSS);
                        tagLink.setEnabled(true);
                    } else {
                        tagLink.setEnabled(false);
                    }
                    break;
            }
        }
    }
    return filteredArtefacts;
}
Also used : EPArtefactTagCloud(org.olat.portfolio.manager.EPArtefactTagCloud) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) Link(org.olat.core.gui.components.link.Link)

Example 2 with EPArtefactTagCloud

use of org.olat.portfolio.manager.EPArtefactTagCloud in project openolat by klemens.

the class EPTagBrowseController method recalculateTagCloud.

private List<AbstractArtefact> recalculateTagCloud() {
    List<String> selectedTags = getSelectedTags();
    if (selectedTags.isEmpty()) {
        for (Link tagLink : tagLinks) {
            TagWrapper tagWrapper = (TagWrapper) tagLink.getUserObject();
            tagLink.setCustomEnabledLinkCSS(inactiveCSS);
            tagLink.setEnabled(true);
            tagWrapper.setState(TagState.possible);
        }
        return allUsersArtefacts;
    }
    EPArtefactTagCloud artefactsAndTags = ePFMgr.getArtefactsAndTagCloud(getIdentity(), selectedTags);
    List<AbstractArtefact> filteredArtefacts = artefactsAndTags.getArtefacts();
    Set<String> newTags = artefactsAndTags.getTags();
    if (newTags != null && !newTags.isEmpty()) {
        for (Link tagLink : tagLinks) {
            TagWrapper tagWrapper = (TagWrapper) tagLink.getUserObject();
            String tag = tagWrapper.getTag();
            switch(tagWrapper.getState()) {
                case selected:
                    tagLink.setCustomEnabledLinkCSS(activeCSS);
                    tagLink.setEnabled(true);
                    break;
                case possible:
                    if (!newTags.contains(tag)) {
                        tagWrapper.setState(TagState.unpossible);
                        tagLink.setEnabled(false);
                    } else {
                        tagLink.setCustomEnabledLinkCSS(inactiveCSS);
                        tagLink.setEnabled(true);
                    }
                    break;
                case unpossible:
                    if (newTags.contains(tag)) {
                        tagWrapper.setState(TagState.possible);
                        tagLink.setCustomEnabledLinkCSS(inactiveCSS);
                        tagLink.setEnabled(true);
                    } else {
                        tagLink.setEnabled(false);
                    }
                    break;
            }
        }
    }
    return filteredArtefacts;
}
Also used : EPArtefactTagCloud(org.olat.portfolio.manager.EPArtefactTagCloud) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) Link(org.olat.core.gui.components.link.Link)

Aggregations

Link (org.olat.core.gui.components.link.Link)2 EPArtefactTagCloud (org.olat.portfolio.manager.EPArtefactTagCloud)2 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2