KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > stefanochizzolini > clown > documents > contents > ColorSpaces


1 /*
2   Copyright 2006 Stefano Chizzolini. http://clown.stefanochizzolini.it
3
4   Contributors:
5     * Stefano Chizzolini (original code developer, info@stefanochizzolini.it):
6       contributed code is Copyright 2006 by Stefano Chizzolini.
7
8   This file should be part of the source code distribution of "PDF Clown library"
9   (the Program): see the accompanying README files for more info.
10
11   This Program is free software; you can redistribute it and/or modify it under
12   the terms of the GNU General Public License as published by the Free Software
13   Foundation; either version 2 of the License, or (at your option) any later version.
14
15   This Program is distributed in the hope that it will be useful, but WITHOUT ANY
16   WARRANTY, either expressed or implied; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
18
19   You should have received a copy of the GNU General Public License along with this
20   Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
21
22   Redistribution and use, with or without modification, are permitted provided that such
23   redistributions retain the above copyright notice, license and disclaimer, along with
24   this list of conditions.
25 */

26
27 package it.stefanochizzolini.clown.documents.contents;
28
29 import it.stefanochizzolini.clown.documents.contents.colorSpaces.ColorSpace;
30 import it.stefanochizzolini.clown.documents.Document;
31 import it.stefanochizzolini.clown.objects.PdfObjectWrapper;
32 import it.stefanochizzolini.clown.objects.PdfDictionary;
33 import it.stefanochizzolini.clown.objects.PdfName;
34 import it.stefanochizzolini.clown.objects.PdfDirectObject;
35 import it.stefanochizzolini.clown.objects.PdfIndirectObject;
36 import it.stefanochizzolini.clown.util.NotImplementedException;
37
38 import java.util.ArrayList JavaDoc;
39 import java.util.Collection JavaDoc;
40 import java.util.Map JavaDoc;
41 import java.util.Set JavaDoc;
42
43 /**
44   Color spaces collection [PDF:1.6:3.7.2].
45 */

46 public class ColorSpaces
47   extends PdfObjectWrapper<PdfDictionary>
48   implements Map JavaDoc<PdfName,ColorSpace>
49 {
50   // <class>
51
// <dynamic>
52
// <constructors>
53
public ColorSpaces(
54     Document context
55     )
56   {
57     super(
58       context.getFile(),
59       new PdfDictionary()
60       );
61   }
62
63   ColorSpaces(
64     PdfDirectObject baseObject,
65     PdfIndirectObject container
66     )
67   {
68     super(
69       baseObject,
70       container
71       );
72   }
73   // </constructors>
74

75   // <interface>
76
// <public>
77
public Object JavaDoc clone(
78     Document context
79     )
80   {throw new NotImplementedException();}
81
82   /**
83     Gets the key associated to a given value.
84   */

85   public PdfName getKey(
86     ColorSpace value
87     )
88   {return getBaseDataObject().getKey(value.getBaseObject());}
89
90   // <Map>
91
public void clear(
92     )
93   {getBaseDataObject().clear();}
94
95   public boolean containsKey(
96     Object JavaDoc key
97     )
98   {return getBaseDataObject().containsKey(key);}
99
100   public boolean containsValue(
101     Object JavaDoc value
102     )
103   {return getBaseDataObject().containsValue(((ColorSpace)value).getBaseObject());}
104
105   public Set JavaDoc<Map.Entry JavaDoc<PdfName,ColorSpace>> entrySet(
106     )
107   {throw new NotImplementedException();}
108
109   public boolean equals(
110     PdfDirectObject object
111     )
112   {throw new NotImplementedException();}
113
114   public ColorSpace get(
115     Object JavaDoc key
116     )
117   {
118     return ColorSpace.wrap(
119       getBaseDataObject().get(key),
120       getContainer()
121       );
122   }
123
124   public int hashCode(
125     )
126   {throw new NotImplementedException();}
127
128   public boolean isEmpty(
129     )
130   {return getBaseDataObject().isEmpty();}
131
132   public Set JavaDoc<PdfName> keySet(
133     )
134   {return getBaseDataObject().keySet();}
135
136   public ColorSpace put(
137     PdfName key,
138     ColorSpace value
139     )
140   {
141     return ColorSpace.wrap(
142       getBaseDataObject().put(key,value.getBaseObject()),
143       getContainer()
144       );
145   }
146
147   public void putAll(
148     Map JavaDoc<? extends PdfName,? extends ColorSpace> entries
149     )
150   {throw new NotImplementedException();}
151
152   public ColorSpace remove(
153     Object JavaDoc key
154     )
155   {
156     return ColorSpace.wrap(
157       getBaseDataObject().remove(key),
158       getContainer()
159       );
160   }
161
162   public int size(
163     )
164   {return getBaseDataObject().size();}
165
166   public Collection JavaDoc<ColorSpace> values(
167     )
168   {
169     /*
170       NOTE: We have to encapsulate raw objects into ColorSpace-derived ones.
171     */

172     // Get the raw objects!
173
Collection JavaDoc<PdfDirectObject> objects = getBaseDataObject().values();
174     // Get room for the corresponding Font collection!
175
Collection JavaDoc<ColorSpace> values = new ArrayList JavaDoc<ColorSpace>(objects.size());
176     // Populating the collection...
177
for(PdfDirectObject object : objects)
178     {
179       values.add(
180         ColorSpace.wrap(object,getContainer())
181         );
182     }
183
184     return values;
185   }
186   // </Map>
187
// </public>
188
// </interface>
189
// </dynamic>
190
// </class>
191
}
Popular Tags