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("");
}
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);
}
}
}
}
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);
}
}
Aggregations