use of org.kie.workbench.common.screens.explorer.model.FolderItem in project kie-wb-common by kiegroup.
the class BaseViewPresenter method copyItem.
public void copyItem(final FolderItem folderItem) {
final Path path = getFolderItemPath(folderItem);
validationService.call(messages -> {
if (((List<ValidationMessage>) messages).isEmpty()) {
showCopyPopup(folderItem, path);
} else {
validationPopup.showCopyValidationMessages(() -> showCopyPopup(folderItem, path), () -> {
}, (List<ValidationMessage>) messages);
}
}).validateForCopy(path);
}
use of org.kie.workbench.common.screens.explorer.model.FolderItem in project kie-wb-common by kiegroup.
the class BaseViewPresenter method deleteItem.
public void deleteItem(final FolderItem folderItem) {
final Path path = getFolderItemPath(folderItem);
validationService.call(messages -> {
if (((List<ValidationMessage>) messages).isEmpty()) {
showDeletePopup(folderItem);
} else {
validationPopup.showDeleteValidationMessages(() -> showDeletePopup(folderItem), () -> {
}, (List<ValidationMessage>) messages);
}
}).validateForDelete(path);
}
use of org.kie.workbench.common.screens.explorer.model.FolderItem in project kie-wb-common by kiegroup.
the class BaseViewPresenter method filterByTag.
protected void filterByTag(String tag) {
currentTag = tag;
List<FolderItem> filteredItems = new ArrayList<FolderItem>();
for (FolderItem item : activeContextItems.getActiveContent().getContent()) {
if (tag == null || item.getTags().contains(tag) || item.getType().equals(FolderItemType.FOLDER)) {
filteredItems.add(item);
}
}
FolderListing filteredContent = new FolderListing(activeContextItems.getActiveContent().getItem(), filteredItems, activeContextItems.getActiveContent().getSegments());
baseView.renderItems(filteredContent);
}
use of org.kie.workbench.common.screens.explorer.model.FolderItem in project kie-wb-common by kiegroup.
the class BreadcrumbNavigator method setupContent.
// Package protected for unit-testing
void setupContent(final FolderListing content) {
final int folderCount = getFolderCount(content.getContent());
if (activeOptions.isTechnicalViewActive() || folderCount > 0) {
showNavigatorPanel();
} else {
hideNavigatorPanel();
}
int base = navigator.getRowCount();
for (int i = 0; i < content.getContent().size(); i++) {
final FolderItem folderItem = content.getContent().get(i);
if (folderItem.getType().equals(FolderItemType.FOLDER) && options.showDirectories()) {
createDirectory(base + i, folderItem);
} else if (folderItem.getType().equals(FolderItemType.FILE) && options.showFiles()) {
if (!options.showHiddenFiles() && !hiddenTypeDef.accept((Path) folderItem.getItem())) {
createFile(base + i, folderItem);
} else if (options.showHiddenFiles()) {
createFile(base + i, folderItem);
}
}
}
}
use of org.kie.workbench.common.screens.explorer.model.FolderItem in project kie-wb-common by kiegroup.
the class TreeNavigator method loadContent.
@Override
public void loadContent(final FolderListing content, final Map<FolderItem, List<FolderItem>> siblings) {
if (content == null || content.getItem() == null) {
clear();
return;
}
if (content.equals(activeContent)) {
if (tree.getSelectedItem() != null) {
tree.getSelectedItem().setState(TreeItem.State.OPEN, true, false);
}
return;
}
this.activeContent = content;
FSTreeItem item = null;
if (!tree.isEmpty()) {
item = findItemInTree(content.getItem());
}
if (item == null) {
if (content.getSegments().isEmpty()) {
final FolderItem rootItem = content.getItem();
item = new FSTreeItem(FSTreeItem.FSType.FOLDER, rootItem.getFileName().replaceAll(" ", "\u00a0"));
tree.addItem(item);
item.setUserObject(rootItem);
} else {
final FSTreeItem parent = loadRoots(content.getSegments(), siblings);
if (parent != null) {
item = loadSiblings(content.getItem(), new TreeNavigatorItemImpl(parent), siblings);
if (item != null) {
item.setUserObject(content.getItem());
}
}
}
}
if (item != null) {
item.setState(TreeItem.State.OPEN, true, false);
tree.setSelectedItem(item);
item.removeItems();
loadContent(new TreeNavigatorItemImpl(item), content);
}
}
Aggregations