Top Fields Constructors Methods
org.apache.pdfbox.debugger.ui

public Class Tree

extends JTree
Class Inheritance
Annotations
@SuppressWarnings:serial, squid:S1948
Imports
org.apache.pdfbox.cos.COSArray, .COSBase, .COSName, .COSStream, org.apache.pdfbox.debugger.treestatus.TreeStatus, org.apache.pdfbox.io.IOUtils, org.apache.pdfbox.pdmodel.common.PDStream, javax.swing.JMenuItem, .JPopupMenu, .JTree, javax.swing.filechooser.FileFilter, .FileNameExtensionFilter, javax.swing.tree.TreePath, java.awt.Desktop, .Point, .Toolkit, java.awt.datatransfer.Clipboard, .StringSelection, java.awt.event.MouseEvent, java.io.File, .FileOutputStream, .IOException, .InputStream, java.util.ArrayList, .List, .StringJoiner, org.apache.pdfbox.debugger.PDFDebugger

Author
Khyrul Bashar A customized tree for PDFDebugger.

Field Summary

Modifier and TypeField and Description
private final Object
private final JPopupMenu
Inherited from javax.swing.JTree:
ANCHOR_SELECTION_PATH_PROPERTYCELL_EDITOR_PROPERTYCELL_RENDERER_PROPERTYcellEditorcellRenderereditableEDITABLE_PROPERTYEXPANDS_SELECTED_PATHS_PROPERTYINVOKES_STOP_CELL_EDITING_PROPERTYinvokesStopCellEditingLARGE_MODEL_PROPERTYlargeModelLEAD_SELECTION_PATH_PROPERTYROOT_VISIBLE_PROPERTYrootVisibleROW_HEIGHT_PROPERTYrowHeightSCROLLS_ON_EXPAND_PROPERTYscrollsOnExpandSELECTION_MODEL_PROPERTYselectionModelselectionRedirectorSHOWS_ROOT_HANDLES_PROPERTYshowsRootHandlesTOGGLE_CLICK_COUNT_PROPERTYtoggleClickCountTREE_MODEL_PROPERTYtreeModeltreeModelListenerVISIBLE_ROW_COUNT_PROPERTYvisibleRowCount

Constructor Summary

AccessConstructor and Description
public
Tree()

Constructor.

Method Summary

Modifier and TypeMethod and Description
private void
addPopupMenuItems(TreePath
is instance of TreePath of the specified Node.
nodePath
)

Produce the popup menu items depending on the node of a certain TreePath.

private String
getFileExtensionForStream(final COSStream cosStream, final TreePath nodePath)

Returns the recommended file extension for the given cos stream.

private JMenuItem
getFileOpenMenu(final COSStream cosStream, final TreePath nodePath)

Produce JMenuItem that opens the stream with the system's default app.

private String
getFilters(COSStream cosStream)

Returns the filters used by the given stream.

private List<JMenuItem>

Returns:

JMenuItems for saving partially decoded streams
getPartiallyDecodedStreamSaveMenu
(final COSStream
stream to save
cosStream
)

produce possible partially decoded stream saving menu items

private JMenuItem
getPartialStreamSavingMenuItem(final int indexOfStopFilter, final PDStream stream)

public Point
getPopupLocation(MouseEvent
the MouseEvent that triggered the popup to be shown, or null if the popup is not being shown as the result of a mouse event
event
)

Overrides javax.swing.JComponent.getPopupLocation.

Returns the preferred location to display the popup menu in this component's coordinate system.

private JMenuItem

Returns:

JMenuItem for saving the raw stream
getRawStreamSaveMenu
(final COSStream
stream to save
cosStream
)

Produce JMenuItem that saves the raw stream

private JMenuItem

Returns:

JMenuItem for saving stream
getStreamSaveMenu
(final COSStream
stream to save
cosStream
,
final TreePath nodePath)

Produce JMenuItem that saves the stream

private JMenuItem

Returns:

Menu Item
getTreePathMenuItem
(final TreePath
the TreePath instance
path
)

Produce the JMenuItem that gives way to copy tree path string to clipboard

private void
saveStream(byte[]
byte array of the stream.
bytes
,
FileFilter
an optional FileFilter
filter
,
String extension)

Save the stream.

Inherited from javax.swing.JTree:
addSelectionIntervaladdSelectionPathaddSelectionPathsaddSelectionRowaddSelectionRowsaddTreeExpansionListeneraddTreeSelectionListeneraddTreeWillExpandListenercancelEditingclearSelectionclearToggledPathscollapsePathcollapseRowconvertValueToTextcreateTreeModelcreateTreeModelListenerexpandPathexpandRowfireTreeCollapsedfireTreeExpandedfireTreeWillCollapsefireTreeWillExpandfireValueChangedgetAccessibleContextgetAnchorSelectionPathgetCellEditorgetCellRenderergetClosestPathForLocationgetClosestRowForLocationgetDefaultTreeModelgetDescendantToggledPathsgetDragEnabledgetDropLocationgetDropModegetEditingPathgetExpandedDescendantsgetExpandsSelectedPathsgetInvokesStopCellEditinggetLastSelectedPathComponentgetLeadSelectionPathgetLeadSelectionRowgetMaxSelectionRowgetMinSelectionRowgetModelgetNextMatchgetPathBetweenRowsgetPathBoundsgetPathForLocationgetPathForRowgetPreferredScrollableViewportSizegetRowBoundsgetRowCountgetRowForLocationgetRowForPathgetRowHeightgetScrollableBlockIncrementgetScrollableTracksViewportHeightgetScrollableTracksViewportWidthgetScrollableUnitIncrementgetScrollsOnExpandgetSelectionCountgetSelectionModelgetSelectionPathgetSelectionPathsgetSelectionRowsgetShowsRootHandlesgetToggleClickCountgetToolTipTextgetTreeExpansionListenersgetTreeSelectionListenersgetTreeWillExpandListenersgetUIgetUIClassIDgetVisibleRowCounthasBeenExpandedisCollapsedisCollapsedisEditableisEditingisExpandedisExpandedisFixedRowHeightisLargeModelisPathEditableisPathSelectedisRootVisibleisRowSelectedisSelectionEmptyisVisiblemakeVisibleparamStringremoveDescendantSelectedPathsremoveDescendantToggledPathsremoveSelectionIntervalremoveSelectionPathremoveSelectionPathsremoveSelectionRowremoveSelectionRowsremoveTreeExpansionListenerremoveTreeSelectionListenerremoveTreeWillExpandListenerscrollPathToVisiblescrollRowToVisiblesetAnchorSelectionPathsetCellEditorsetCellRenderersetDragEnabledsetDropModesetEditablesetExpandedStatesetExpandsSelectedPathssetInvokesStopCellEditingsetLargeModelsetLeadSelectionPathsetModelsetRootVisiblesetRowHeightsetScrollsOnExpandsetSelectionIntervalsetSelectionModelsetSelectionPathsetSelectionPathssetSelectionRowsetSelectionRowssetShowsRootHandlessetToggleClickCountsetUIsetVisibleRowCountstartEditingAtPathstopEditingtreeDidChangeupdateUI

Field Detail

rootNodeback to summary
private final Object rootNode
treePopupMenuback to summary
private final JPopupMenu treePopupMenu

Constructor Detail

Treeback to summary
public Tree()

Constructor.

Method Detail

addPopupMenuItemsback to summary
private void addPopupMenuItems(TreePath nodePath)

Produce the popup menu items depending on the node of a certain TreePath.

Parameters
nodePath:TreePath

is instance of TreePath of the specified Node.

getFileExtensionForStreamback to summary
private String getFileExtensionForStream(final COSStream cosStream, final TreePath nodePath)

Returns the recommended file extension for the given cos stream.

getFileOpenMenuback to summary
private JMenuItem getFileOpenMenu(final COSStream cosStream, final TreePath nodePath)

Produce JMenuItem that opens the stream with the system's default app.

getFiltersback to summary
private String getFilters(COSStream cosStream)

Returns the filters used by the given stream.

getPartiallyDecodedStreamSaveMenuback to summary
private List<JMenuItem> getPartiallyDecodedStreamSaveMenu(final COSStream cosStream)

produce possible partially decoded stream saving menu items

Parameters
cosStream:COSStream

stream to save

Returns:List<JMenuItem>

JMenuItems for saving partially decoded streams

getPartialStreamSavingMenuItemback to summary
private JMenuItem getPartialStreamSavingMenuItem(final int indexOfStopFilter, final PDStream stream)
getPopupLocationback to summary
public Point getPopupLocation(MouseEvent event)

Overrides javax.swing.JComponent.getPopupLocation.

Doc from javax.swing.JComponent.getPopupLocation.

Returns the preferred location to display the popup menu in this component's coordinate system. It is up to the look and feel to honor this property, some may choose to ignore it. If null, the look and feel will choose a suitable location.

Parameters
event:MouseEvent

the MouseEvent that triggered the popup to be shown, or null if the popup is not being shown as the result of a mouse event

Returns:Point

location to display the JPopupMenu, or null

Annotations
@Override
getRawStreamSaveMenuback to summary
private JMenuItem getRawStreamSaveMenu(final COSStream cosStream)

Produce JMenuItem that saves the raw stream

Parameters
cosStream:COSStream

stream to save

Returns:JMenuItem

JMenuItem for saving the raw stream

getStreamSaveMenuback to summary
private JMenuItem getStreamSaveMenu(final COSStream cosStream, final TreePath nodePath)

Produce JMenuItem that saves the stream

Parameters
cosStream:COSStream

stream to save

Returns:JMenuItem

JMenuItem for saving stream

getTreePathMenuItemback to summary
private JMenuItem getTreePathMenuItem(final TreePath path)

Produce the JMenuItem that gives way to copy tree path string to clipboard

Parameters
path:TreePath

the TreePath instance

Returns:JMenuItem

Menu Item

saveStreamback to summary
private void saveStream(byte[] bytes, FileFilter filter, String extension) throws IOException

Save the stream.

Parameters
bytes:byte[]

byte array of the stream.

filter:FileFilter

an optional FileFilter

Exceptions
IOException:
if there is an error in creation of the file.