diff options
author | Andrew C. Oliver <acoliver@apache.org> | 2002-02-22 04:28:55 +0000 |
---|---|---|
committer | Andrew C. Oliver <acoliver@apache.org> | 2002-02-22 04:28:55 +0000 |
commit | acb0f2bc5f35e6337e630a5ea71e4271c7effa8b (patch) | |
tree | 83c36de5cd54ee94e078c0d106de2e9826ce9f75 /src/contrib | |
parent | dd50b4d49b9f439f00a90b7f48998d5409e71767 (diff) | |
download | poi-acb0f2bc5f35e6337e630a5ea71e4271c7effa8b.tar.gz poi-acb0f2bc5f35e6337e630a5ea71e4271c7effa8b.zip |
PR:
Obtained from:
Submitted by:
Reviewed by:
added stuff from the klute-meister
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352112 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/contrib')
-rw-r--r-- | src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java | 14 | ||||
-rw-r--r-- | src/contrib/src/org/apache/poi/contrib/poibrowser/TreeReaderListener.java | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java index 1eb18783cc..90ccf3c694 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java @@ -110,7 +110,7 @@ public class POIBrowser extends JFrame /* Create the tree model with a root node. The latter is * invisible but it must be present because a tree model * always needs a root. */ - rootNode = new DefaultMutableTreeNode("POIFS"); + rootNode = new DefaultMutableTreeNode("POI Filesystems"); DefaultTreeModel treeModel = new DefaultTreeModel(rootNode); /* Create the tree UI element. */ @@ -118,6 +118,7 @@ public class POIBrowser extends JFrame getContentPane().add(new JScrollPane(treeUI)); /* Add the POI filesystems to the tree. */ + int displayedFiles = 0; for (int i = 0; i < args.length; i++) { final String filename = args[i]; @@ -126,6 +127,7 @@ public class POIBrowser extends JFrame POIFSReader r = new POIFSReader(); r.registerListener(new TreeReaderListener(filename, rootNode)); r.read(new FileInputStream(filename)); + displayedFiles++; } catch (IOException ex) { @@ -139,6 +141,14 @@ public class POIBrowser extends JFrame } } + /* Exit if there is no file to display (none specified or only + * files with problems). */ + if (displayedFiles == 0) + { + System.out.println("No POI filesystem(s) to display."); + System.exit(0); + } + /* Make the tree UI element visible. */ treeUI.setRootVisible(true); treeUI.setShowsRootHandles(true); @@ -149,7 +159,7 @@ public class POIBrowser extends JFrame new PropertySetDescriptorRenderer()); treeUI.setCellRenderer(etcr); setSize(600, 450); - setTitle("POI Browser 0.10"); + setTitle("POI Browser 0.06"); setVisible(true); } diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/TreeReaderListener.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/TreeReaderListener.java index 124c595b60..bcb237ea9b 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/TreeReaderListener.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/TreeReaderListener.java @@ -134,7 +134,7 @@ public class TreeReaderListener implements POIFSReaderListener { this.filename = filename; this.rootNode = rootNode; - pathToNode = new HashMap(15); + pathToNode = new HashMap(15); // Should be a reasonable guess. } |