use of org.apache.pdfbox.debugger.treestatus.TreeStatus in project pdfbox by apache.
the class Tree method getTreePathMenuItem.
/**
* Produce the JMenuItem that gives way to copy tree path string to clipboard
* @param path the TreePath instance
* @return Menu Item
*/
private JMenuItem getTreePathMenuItem(final TreePath path) {
JMenuItem copyPathMenuItem = new JMenuItem("Copy Tree Path");
copyPathMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(new TreeStatus(rootNode).getStringForPath(path)), null);
}
});
return copyPathMenuItem;
}
use of org.apache.pdfbox.debugger.treestatus.TreeStatus in project pdfbox by apache.
the class PDFDebugger method initTree.
public void initTree() {
TreeStatus treeStatus = new TreeStatus(document.getDocument().getTrailer());
statusPane.updateTreeStatus(treeStatus);
if (isPageMode) {
File file = new File(currentFilePath);
DocumentEntry documentEntry = new DocumentEntry(document, file.getName());
ZoomMenu.getInstance().resetZoom();
RotationMenu.getInstance().setRotationSelection(RotationMenu.ROTATE_0_DEGREES);
tree.setModel(new PDFTreeModel(documentEntry));
// Root/Pages/Kids/[0] is not always the first page, so use the first row instead:
tree.setSelectionPath(tree.getPathForRow(1));
} else {
tree.setModel(new PDFTreeModel(document));
tree.setSelectionPath(treeStatus.getPathForString("Root"));
}
}
Aggregations