KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > pdf > collection > PdfCollection


1 package com.lowagie.text.pdf.collection;
2
3 import com.lowagie.text.pdf.PdfDictionary;
4 import com.lowagie.text.pdf.PdfName;
5 import com.lowagie.text.pdf.PdfString;
6
7 public class PdfCollection extends PdfDictionary {
8
9     /** A type of PDF Collection */
10     public static final int DETAILS = 0;
11     /** A type of PDF Collection */
12     public static final int TILE = 1;
13     /** A type of PDF Collection */
14     public static final int HIDDEN = 2;
15     
16     /**
17      * Constructs a PDF Collection.
18      * @param type the type of PDF collection.
19      */

20     public PdfCollection(int type) {
21         super(PdfName.COLLECTION);
22         switch(type) {
23         case TILE:
24             put(PdfName.VIEW, PdfName.T);
25             break;
26         case HIDDEN:
27             put(PdfName.VIEW, PdfName.H);
28             break;
29         default:
30             put(PdfName.VIEW, PdfName.D);
31         }
32     }
33     
34     /**
35      * Identifies the document that will be initially presented
36      * in the user interface.
37      * @param description the description that was used when attaching the file to the document
38      */

39     public void setInitialDocument(String JavaDoc description) {
40         put(PdfName.D, new PdfString(description, null));
41     }
42     
43     /**
44      * Sets the Collection schema dictionary.
45      * @param schema an overview of the collection fields
46      */

47     public void setSchema(PdfCollectionSchema schema) {
48         put(PdfName.SCHEMA, schema);
49     }
50     
51     /**
52      * Gets the Collection schema dictionary.
53      * @return schema an overview of the collection fields
54      */

55     public PdfCollectionSchema getSchema() {
56         return (PdfCollectionSchema)get(PdfName.SCHEMA);
57     }
58     
59     /**
60      * Sets the Collection sort dictionary.
61      * @param sort a collection sort dictionary
62      */

63     public void setSort(PdfCollectionSort sort) {
64         put(PdfName.SORT, sort);
65     }
66 }
Popular Tags