/** * Performs the node-move-actions (invokes methods of the manager...) * * @param event * @return returns true, if move was successfull */ private boolean movePage(final MoveTreeNodeEvent event) { final CPManager cpMgm = CPManager.getInstance(); final String movedNodeId = event.getNodeId(); cpMgm.moveElement(cp, movedNodeId, event.getNewParentNodeId(), event.getPosition()); cpMgm.writeToFile(cp); selectTreeNodeById(movedNodeId); return true; }
/** * copies the page with given nodeID * * @param nodeID */ private String copyPage(final CPPage page) { String newIdentifier = null; if (page != null) { final CPManager cpMgm = CPManager.getInstance(); newIdentifier = cpMgm.copyElement(cp, page.getIdentifier()); cpMgm.writeToFile(cp); } return newIdentifier; }
/** * deletes a page from the manifest * * @param nodeID */ private void deletePage(final String identifier, final boolean deleteResource) { if (identifier.equals("")) { // no page selected } else { final CPManager cpMgm = CPManager.getInstance(); final String path = treeModel.getPath(identifier); treeCtr.removePath(path); cpMgm.removeElement(cp, identifier, deleteResource); cpMgm.writeToFile(cp); } }
/** * Adds a page to the CP * * @return */ protected String addPage(final CPPage page) { final CPManager cpMgm = CPManager.getInstance(); String newNodeID = ""; if (currentPage.getIdentifier().equals("")) { newNodeID = cpMgm.addBlankPage(cp, page.getTitle()); } else { // adds new page as child of currentPage newNodeID = cpMgm.addBlankPage(cp, page.getTitle(), currentPage.getIdentifier()); } setCurrentPage(new CPPage(newNodeID, cp)); cpMgm.writeToFile(cp); // treeCtr.getInitialComponent().setDirty(true); return newNodeID; }
/** @param page */ protected void updatePage(final CPPage page) { setCurrentPage(page); final CPManager cpMgm = CPManager.getInstance(); cpMgm.updatePage(cp, page); cpMgm.writeToFile(cp); if (page.isOrgaPage()) { // TODO:GW Shall the repo entry title be updated when the organization // title changes? // // If the organization title changed, also update the repo entry // // title. // RepositoryManager resMgr = RepositoryManager.getInstance(); // RepositoryEntry cpEntry = // resMgr.lookupRepositoryEntry(cp.getResourcable(), false); // cpEntry.setDisplayname(page.getTitle()); treeCtr.setRootNodeTitle(page.getTitle()); } selectTreeNodeByCPPage(page); }