Example usage for org.apache.poi.hpsf PropertySet getFormat

List of usage examples for org.apache.poi.hpsf PropertySet getFormat

Introduction

In this page you can find the example usage for org.apache.poi.hpsf PropertySet getFormat.

Prototype

public int getFormat() 

Source Link

Usage

From source file:poi.poifs.poibrowser.PropertySetDescriptorRenderer.java

License:Apache License

public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean selected,
        final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
    final PropertySetDescriptor d = (PropertySetDescriptor) ((DefaultMutableTreeNode) value).getUserObject();
    final PropertySet ps = d.getPropertySet();
    final JPanel p = new JPanel();
    final JTextArea text = new JTextArea();
    text.setBackground(new Color(200, 255, 200));
    text.setFont(new Font("Monospaced", Font.PLAIN, 10));
    text.append(renderAsString(d));/*from   w  w  w . ja v  a 2 s . c  o  m*/
    text.append("\nByte order: " + Codec.hexEncode((short) ps.getByteOrder()));
    text.append("\nFormat: " + Codec.hexEncode((short) ps.getFormat()));
    text.append("\nOS version: " + Codec.hexEncode(ps.getOSVersion()));
    text.append("\nClass ID: " + Codec.hexEncode(ps.getClassID()));
    text.append("\nSection count: " + ps.getSectionCount());
    text.append(sectionsToString(ps.getSections()));
    p.add(text);

    if (ps instanceof SummaryInformation) {
        /* Use the convenience methods. */
        final SummaryInformation si = (SummaryInformation) ps;
        text.append("\n");
        text.append("\nTitle:               " + si.getTitle());
        text.append("\nSubject:             " + si.getSubject());
        text.append("\nAuthor:              " + si.getAuthor());
        text.append("\nKeywords:            " + si.getKeywords());
        text.append("\nComments:            " + si.getComments());
        text.append("\nTemplate:            " + si.getTemplate());
        text.append("\nLast Author:         " + si.getLastAuthor());
        text.append("\nRev. Number:         " + si.getRevNumber());
        text.append("\nEdit Time:           " + si.getEditTime());
        text.append("\nLast Printed:        " + si.getLastPrinted());
        text.append("\nCreate Date/Time:    " + si.getCreateDateTime());
        text.append("\nLast Save Date/Time: " + si.getLastSaveDateTime());
        text.append("\nPage Count:          " + si.getPageCount());
        text.append("\nWord Count:          " + si.getWordCount());
        text.append("\nChar Count:          " + si.getCharCount());
        // text.append("\nThumbnail:           " + si.getThumbnail());
        text.append("\nApplication Name:    " + si.getApplicationName());
        text.append("\nSecurity:            " + si.getSecurity());
    }

    if (selected)
        Util.invert(text);
    return p;
}