From 73a9af683f7c986421d12e07e680111d94a609c4 Mon Sep 17 00:00:00 2001 From: Rainer Klute Date: Fri, 3 Mar 2006 16:57:55 +0000 Subject: * Writing support added to the SummaryInformation and DocumentSummaryInformation classes. These classes now have methods for setting and removing properties. Coherent extensions are: ** Documentation section about writing standard properties added to the HPSF HOW-TO. ** Example application added showing how to modify the document summary information. ** Testcases added for testing modifying summary information and document summary information. ** PropertySetFactory extended to create SummaryInformation and DocumentSummaryInformation instances. * Added MutablePropertySet.write(DirectoryEntry, String) to ease writing a property set to a POI filesystem document. * Improved codepage handling. * Bug fixed: Integral values were read and written as unsigned instead of signed. * Reworked the mapping between variant types and Java types: Variant.VT_I4 is mapped to Integer now and Variant.VT_I8 to Long. This might cause incompatibilities if you are doing low-level HPSF programming. * Changed SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID from a byte[] to a byte[][] in order to contain the format ID of the first and the second section. This is an incompatible change! * Added PropertySet.getFirstSection(). This method is similar to getSingleSection() won't choke if the property set has more than one section. * Support for low-level reading and writing of Variant.VT_I8 type properties added. * Unnecessary casts removed. * Poibrowser's display format changed slightly. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@382887 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/contrib/poibrowser/POIBrowser.java | 2 +- .../poi/contrib/poibrowser/PropertySetDescriptor.java | 3 +-- .../poibrowser/PropertySetDescriptorRenderer.java | 19 ++++++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src/contrib') 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 0c998c3235..ffd45af237 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java @@ -128,7 +128,7 @@ public class POIBrowser extends JFrame new PropertySetDescriptorRenderer()); treeUI.setCellRenderer(etcr); setSize(600, 450); - setTitle("POI Browser 0.08"); + setTitle("POI Browser 0.09"); setVisible(true); } diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptor.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptor.java index 9e6500c1b7..bd7f584363 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptor.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptor.java @@ -25,7 +25,6 @@ import org.apache.poi.hpsf.MarkUnsupportedException; import org.apache.poi.hpsf.NoPropertySetStreamException; import org.apache.poi.hpsf.PropertySet; import org.apache.poi.hpsf.PropertySetFactory; -import org.apache.poi.hpsf.UnexpectedPropertySetTypeException; import org.apache.poi.poifs.filesystem.DocumentInputStream; import org.apache.poi.poifs.filesystem.POIFSDocumentPath; @@ -70,7 +69,7 @@ public class PropertySetDescriptor extends DocumentDescriptor final POIFSDocumentPath path, final DocumentInputStream stream, final int nrOfBytesToDump) - throws UnexpectedPropertySetTypeException, NoPropertySetStreamException, + throws NoPropertySetStreamException, MarkUnsupportedException, UnsupportedEncodingException, IOException { diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java index 3b17803b0d..8aac2a1519 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java @@ -127,6 +127,9 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer /** *

Returns a string representation of a {@link Section}.

+ * @param s the section + * @param name the section's name + * @return a string representation of the {@link Section} */ protected String toString(final Section s, final String name) { @@ -141,12 +144,18 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer for (int i = 0; i < properties.length; i++) { final Property p = properties[i]; + final long id = p.getID(); + final long type = p.getType(); final Object value = p.getValue(); - b.append("\n" + name + " "); - b.append("PID_"); - b.append(p.getID()); - b.append(' '); - b.append(s.getPIDString(p.getID()) + ": "); + b.append('\n'); + b.append(name); + b.append(", Name: "); + b.append(id); + b.append(" ("); + b.append(s.getPIDString(id)); + b.append("), Type: "); + b.append(type); + b.append(", Value: "); if (value instanceof byte[]) { byte[] b2 = (byte[]) value; -- cgit v1.2.3