KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pdfbox > pdmodel > interactive > annotation > PDAnnotationRubberStamp


1 /**
2  * Copyright (c) 2003, www.pdfbox.org
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * 3. Neither the name of pdfbox; nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * http://www.pdfbox.org
29  *
30  */

31 package org.pdfbox.pdmodel.interactive.annotation;
32
33 import org.pdfbox.cos.COSDictionary;
34 import org.pdfbox.cos.COSName;
35
36 /**
37  * This is the class that represents a rubber stamp annotation.
38  * Introduced in PDF 1.3 specification
39  *
40  * @author Paul King
41  * @version $Revision: 1.2 $
42  */

43 public class PDAnnotationRubberStamp extends PDAnnotationMarkup
44 {
45     
46     /*
47      * The various values of the rubber stamp as defined in
48      * the PDF 1.6 reference Table 8.28
49      */

50     
51     /**
52      * Constant for the name of a rubber stamp.
53      */

54     public static final String JavaDoc NAME_APPROVED = "Approved";
55     /**
56      * Constant for the name of a rubber stamp.
57      */

58     public static final String JavaDoc NAME_EXPERIMENTAL = "Experimental";
59     /**
60      * Constant for the name of a rubber stamp.
61      */

62     public static final String JavaDoc NAME_NOT_APPROVED = "NotApproved";
63     /**
64      * Constant for the name of a rubber stamp.
65      */

66     public static final String JavaDoc NAME_AS_IS = "AsIs";
67     /**
68      * Constant for the name of a rubber stamp.
69      */

70     public static final String JavaDoc NAME_EXPIRED = "Expired";
71     /**
72      * Constant for the name of a rubber stamp.
73      */

74     public static final String JavaDoc NAME_NOT_FOR_PUBLIC_RELEASE = "NotForPublicRelease";
75     /**
76      * Constant for the name of a rubber stamp.
77      */

78     public static final String JavaDoc NAME_FOR_PUBLIC_RELEASE = "ForPublicRelease";
79     /**
80      * Constant for the name of a rubber stamp.
81      */

82     public static final String JavaDoc NAME_DRAFT = "Draft";
83     /**
84      * Constant for the name of a rubber stamp.
85      */

86     public static final String JavaDoc NAME_FOR_COMMENT = "ForComment";
87     /**
88      * Constant for the name of a rubber stamp.
89      */

90     public static final String JavaDoc NAME_TOP_SECRET = "TopSecret";
91     /**
92      * Constant for the name of a rubber stamp.
93      */

94     public static final String JavaDoc NAME_DEPARTMENTAL = "Departmental";
95     /**
96      * Constant for the name of a rubber stamp.
97      */

98     public static final String JavaDoc NAME_CONFIDENTIAL = "Confidential";
99     /**
100      * Constant for the name of a rubber stamp.
101      */

102     public static final String JavaDoc NAME_FINAL = "Final";
103     /**
104      * Constant for the name of a rubber stamp.
105      */

106     public static final String JavaDoc NAME_SOLD = "Sold";
107     
108     /**
109      * The type of annotation.
110      */

111     public static final String JavaDoc SUB_TYPE = "Stamp";
112     
113     /**
114      * Constructor.
115      */

116     public PDAnnotationRubberStamp()
117     {
118         super();
119         getDictionary().setItem( COSName.SUBTYPE, COSName.getPDFName( SUB_TYPE ) );
120     }
121
122     /**
123      * Creates a Rubber Stamp annotation from a COSDictionary, expected to be
124      * a correct object definition.
125      *
126      * @param field the PDF objet to represent as a field.
127      */

128     public PDAnnotationRubberStamp(COSDictionary field)
129     {
130         super( field );
131     }
132
133     /**
134      * This will set the name (and hence appearance, AP taking precedence)
135      * For this annotation. See the NAME_XXX constants for valid values.
136      *
137      * @param name The name of the rubber stamp.
138      */

139     public void setName( String JavaDoc name )
140     {
141         getDictionary().setName(COSName.NAME, name);
142     }
143
144     /**
145      * This will retrieve the name (and hence appearance, AP taking precedence)
146      * For this annotation. The default is DRAFT.
147      *
148      * @return The name of this rubber stamp, see the NAME_XXX constants.
149      */

150     public String JavaDoc getName()
151     {
152         return getDictionary().getNameAsString(COSName.NAME, NAME_DRAFT);
153     }
154 }
Popular Tags