Search in sources :

Example 11 with AppFolder

use of com.haulmont.cuba.core.entity.AppFolder in project cuba by cuba-platform.

the class CubaFoldersPane method reloadSingleParentFolder.

protected void reloadSingleParentFolder(AppFolder parentFolder, @Nullable List<AppFolder> reloadedFolders) {
    Collection<AppFolder> childFolders = getChildFolders(parentFolder);
    int sumOfChildQuantity = 0;
    Set<String> childFoldersStyleSet = new HashSet<>();
    for (AppFolder childFolder : childFolders) {
        if (reloadedFolders != null) {
            childFolder = reloadedFolders.get(reloadedFolders.indexOf(childFolder));
        }
        sumOfChildQuantity += !StringUtils.isBlank(childFolder.getQuantityScript()) && childFolder.getQuantity() != null ? childFolder.getQuantity() : 0;
        if (childFolder.getItemStyle() != null)
            childFoldersStyleSet.add(childFolder.getItemStyle());
    }
    parentFolder.setQuantity(sumOfChildQuantity);
    if (!childFoldersStyleSet.isEmpty()) {
        parentFolder.setItemStyle(StringUtils.join(childFoldersStyleSet, " "));
    } else
        parentFolder.setItemStyle("");
}
Also used : AppFolder(com.haulmont.cuba.core.entity.AppFolder)

Example 12 with AppFolder

use of com.haulmont.cuba.core.entity.AppFolder in project cuba by cuba-platform.

the class CubaFoldersPane method reloadParentFolders.

protected void reloadParentFolders(List<AppFolder> reloadedFolders) {
    for (AppFolder folder : reloadedFolders) {
        if (StringUtils.isBlank(folder.getQuantityScript())) {
            if (appFoldersTree.isExpanded(folder)) {
                folder.setQuantity(null);
                folder.setItemStyle("");
            } else {
                reloadSingleParentFolder(folder, reloadedFolders);
            }
        }
    }
}
Also used : AppFolder(com.haulmont.cuba.core.entity.AppFolder)

Example 13 with AppFolder

use of com.haulmont.cuba.core.entity.AppFolder in project cuba by cuba-platform.

the class CubaFoldersPane method updateFolders.

protected void updateFolders(List<AppFolder> reloadedFolders) {
    @SuppressWarnings("unchecked") List<AppFolder> folders = new ArrayList(appFoldersTree.getItemIds());
    for (AppFolder folder : reloadedFolders) {
        int index = reloadedFolders.indexOf(folder);
        AppFolder f = folders.get(index);
        if (f != null) {
            f.setItemStyle(folder.getItemStyle());
            f.setQuantity(folder.getQuantity());
        }
        setFolderTreeItemCaption(appFoldersTree, folder);
    }
}
Also used : AppFolder(com.haulmont.cuba.core.entity.AppFolder)

Aggregations

AppFolder (com.haulmont.cuba.core.entity.AppFolder)13 Folder (com.haulmont.cuba.core.entity.Folder)4 Transaction (com.haulmont.cuba.core.Transaction)3 SearchFolder (com.haulmont.cuba.security.entity.SearchFolder)3 FoldersService (com.haulmont.cuba.core.app.FoldersService)2 AbstractSearchFolder (com.haulmont.cuba.core.entity.AbstractSearchFolder)2 Binding (groovy.lang.Binding)2 StopWatch (org.perf4j.StopWatch)2 Slf4JStopWatch (org.perf4j.slf4j.Slf4JStopWatch)2 EntityManager (com.haulmont.cuba.core.EntityManager)1 Query (com.haulmont.cuba.core.Query)1 TypedQuery (com.haulmont.cuba.core.TypedQuery)1 User (com.haulmont.cuba.security.entity.User)1 UserSession (com.haulmont.cuba.security.global.UserSession)1 CubaTree (com.haulmont.cuba.web.toolkit.ui.CubaTree)1 ShortcutListener (com.vaadin.event.ShortcutListener)1 IOException (java.io.IOException)1