KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > etymon > pj > object > PjResources


1 package com.etymon.pj.object;
2
3 import java.io.*;
4 import java.util.*;
5 import com.etymon.pj.*;
6 import com.etymon.pj.exception.*;
7
8 /**
9    A representation of a PDF resources dictionary.
10    @author Nassib Nassar
11 */

12 public class PjResources
13     extends PjDictionary {
14
15     /**
16        Creates a new resources dictionary.
17     */

18     public PjResources() {
19         super();
20     }
21
22     /**
23        Creates a resources dictionary as a wrapper around a Hashtable.
24        @param h the Hashtable to use for this dictionary.
25     */

26     public PjResources(Hashtable h) {
27         super(h);
28     }
29
30     public void setProcSet(PjProcSet procSet) {
31         _h.put(PjName.PROCSET, procSet);
32     }
33
34     public void setProcSet(PjReference procSet) {
35         _h.put(PjName.PROCSET, procSet);
36     }
37
38     public PjObject getProcSet() throws InvalidPdfObjectException {
39         return hget(PjName.PROCSET);
40     }
41
42     public void setFont(PjDictionary font) {
43         _h.put(PjName.FONT, font);
44     }
45
46     public void setFont(PjReference font) {
47         _h.put(PjName.FONT, font);
48     }
49
50     public PjObject getFont() throws InvalidPdfObjectException {
51         return hget(PjName.FONT);
52     }
53
54     public void setColorSpace(PjName colorSpace) {
55         _h.put(PjName.COLORSPACE, colorSpace);
56     }
57
58     public void setColorSpace(PjArray colorSpace) {
59         _h.put(PjName.COLORSPACE, colorSpace);
60     }
61
62     public void setColorSpace(PjReference colorSpace) {
63         _h.put(PjName.COLORSPACE, colorSpace);
64     }
65
66     public PjObject getColorSpace() throws InvalidPdfObjectException {
67         return hget(PjName.COLORSPACE);
68     }
69
70     public void setXObject(PjDictionary xObject) {
71         _h.put(PjName.XOBJECT, xObject);
72     }
73
74     public void setXObject(PjReference xObject) {
75         _h.put(PjName.XOBJECT, xObject);
76     }
77
78     public PjObject getXObject() throws InvalidPdfObjectException {
79         return hget(PjName.XOBJECT);
80     }
81
82     public void setExtGState(PjDictionary extGState) {
83         _h.put(PjName.EXTGSTATE, extGState);
84     }
85
86     public void setExtGState(PjReference extGState) {
87         _h.put(PjName.EXTGSTATE, extGState);
88     }
89
90     public PjObject getExtGState() throws InvalidPdfObjectException {
91         return hget(PjName.EXTGSTATE);
92     }
93
94     public void setPattern(PjStream pattern) {
95         _h.put(PjName.PATTERN, pattern);
96     }
97
98     public void setPattern(PjReference pattern) {
99         _h.put(PjName.PATTERN, pattern);
100     }
101
102     public PjObject getPattern() throws InvalidPdfObjectException {
103         return hget(PjName.PATTERN);
104     }
105
106     public void setProperties(PjDictionary properties) {
107         _h.put(PjName.PROPERTIES, properties);
108     }
109
110     public void setProperties(PjReference properties) {
111         _h.put(PjName.PROPERTIES, properties);
112     }
113
114     public PjObject getProperties() throws InvalidPdfObjectException {
115         return hget(PjName.PROPERTIES);
116     }
117
118     /**
119        Examines a dictionary to see if it is a PDF resources
120        dictionary.
121        @param dictionary the dictionary to examine.
122        @return true if the dictionary could be interpreted as a
123        valid PjResources object.
124     */

125     public static boolean isLike(PjDictionary dictionary) {
126         return (dictionary.getHashtable().get(PjName.PROCSET) != null);
127     }
128     
129     /**
130        Returns a deep copy of this object.
131        @return a deep copy of this object.
132        @exception CloneNotSupportedException if the instance can not be cloned.
133     */

134     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
135         return new PjResources(cloneHt());
136     }
137     
138 }
139
Popular Tags