*
* @param item
* @param parentId
*/
private CPPage addItem(VFSItem item, String parentId, boolean isRoot) {
CPManager cpMgr = CPManager.getInstance();
// Make an item in the menu tree only if the item is a container that
// contains any items to be added or its type is selected in the form.
// Upload any files in case they are referenced to.
// Get the file types that should be added as items in the menu tree
Set<String> menuItemTypes = checkboxes.getSelectedKeys();
if (menuItemTypes.contains("htm")) menuItemTypes.add("html");
// If item is the root node and it doesn't contain any items to be added,
// show info.
if (isRoot && item instanceof VFSContainer && !containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
showInfo("cpfileuploadcontroller.no.files.imported");
}
CPPage newPage = null;
if (isSingleFile || item instanceof VFSLeaf && isToBeAdded((VFSLeaf) item, menuItemTypes) || item instanceof VFSContainer
&& containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
// Create the menu item
String newId = cpMgr.addBlankPage(cp, item.getName(), parentId);
newPage = new CPPage(newId, cp);
if (item instanceof VFSLeaf) {
VFSLeaf leaf = (VFSLeaf) item;
newPage.setFile(leaf);
}
cpMgr.updatePage(cp, newPage);
}
// Add any sub items
if (item instanceof VFSContainer && containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
VFSContainer dir = (VFSContainer) item;