]> _ Git - cubeextranet.git/blob
148e5a57d7b77910ba587f5aef1e3dc730277f9d
[cubeextranet.git] /
1 /*\r
2  * Licensed to the Apache Software Foundation (ASF) under one or more\r
3  * contributor license agreements.  See the NOTICE file distributed with\r
4  * this work for additional information regarding copyright ownership.\r
5  * The ASF licenses this file to You under the Apache License, Version 2.0\r
6  * (the "License"); you may not use this file except in compliance with\r
7  * the License.  You may obtain a copy of the License at\r
8  *\r
9  *      http://www.apache.org/licenses/LICENSE-2.0\r
10  *\r
11  * Unless required by applicable law or agreed to in writing, software\r
12  * distributed under the License is distributed on an "AS IS" BASIS,\r
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14  * See the License for the specific language governing permissions and\r
15  * limitations under the License.\r
16  */\r
17 package org.apache.pdfbox.pdmodel.interactive.action;\r
18 \r
19 import org.apache.pdfbox.cos.COSBase;\r
20 import org.apache.pdfbox.cos.COSDictionary;\r
21 \r
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;\r
23 import org.apache.pdfbox.pdmodel.interactive.action.type.PDAction;\r
24 \r
25 /**\r
26  * This class represents an annotation's dictionary of actions\r
27  * that occur due to events.\r
28  *\r
29  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>\r
30  * @author Panagiotis Toumasis (ptoumasis@mail.gr)\r
31  * @version $Revision: 1.2 $\r
32  */\r
33 public class PDAnnotationAdditionalActions implements COSObjectable\r
34 {\r
35     private COSDictionary actions;\r
36 \r
37     /**\r
38      * Default constructor.\r
39      */\r
40     public PDAnnotationAdditionalActions()\r
41     {\r
42         actions = new COSDictionary();\r
43     }\r
44 \r
45     /**\r
46      * Constructor.\r
47      *\r
48      * @param a The action dictionary.\r
49      */\r
50     public PDAnnotationAdditionalActions( COSDictionary a )\r
51     {\r
52         actions = a;\r
53     }\r
54 \r
55     /**\r
56      * Convert this standard java object to a COS object.\r
57      *\r
58      * @return The cos object that matches this Java object.\r
59      */\r
60     public COSBase getCOSObject()\r
61     {\r
62         return actions;\r
63     }\r
64 \r
65     /**\r
66      * Convert this standard java object to a COS object.\r
67      *\r
68      * @return The cos object that matches this Java object.\r
69      */\r
70     public COSDictionary getCOSDictionary()\r
71     {\r
72         return actions;\r
73     }\r
74 \r
75     /**\r
76      * This will get an action to be performed when the cursor\r
77      * enters the annotation's active area.\r
78      *\r
79      * @return The E entry of annotation's additional actions dictionary.\r
80      */\r
81     public PDAction getE()\r
82     {\r
83         COSDictionary e = (COSDictionary)actions.getDictionaryObject( "E" );\r
84         PDAction retval = null;\r
85         if( e != null )\r
86         {\r
87             retval = PDActionFactory.createAction( e );\r
88         }\r
89         return retval;\r
90     }\r
91 \r
92     /**\r
93      * This will set an action to be performed when the cursor\r
94      * enters the annotation's active area.\r
95      *\r
96      * @param e The action to be performed.\r
97      */\r
98     public void setE( PDAction e )\r
99     {\r
100         actions.setItem( "E", e );\r
101     }\r
102 \r
103     /**\r
104      * This will get an action to be performed when the cursor\r
105      * exits the annotation's active area.\r
106      *\r
107      * @return The X entry of annotation's additional actions dictionary.\r
108      */\r
109     public PDAction getX()\r
110     {\r
111         COSDictionary x = (COSDictionary)actions.getDictionaryObject( "X" );\r
112         PDAction retval = null;\r
113         if( x != null )\r
114         {\r
115             retval = PDActionFactory.createAction( x );\r
116         }\r
117         return retval;\r
118     }\r
119 \r
120     /**\r
121      * This will set an action to be performed when the cursor\r
122      * exits the annotation's active area.\r
123      *\r
124      * @param x The action to be performed.\r
125      */\r
126     public void setX( PDAction x )\r
127     {\r
128         actions.setItem( "X", x );\r
129     }\r
130 \r
131     /**\r
132      * This will get an action to be performed when the mouse button\r
133      * is pressed inside the annotation's active area.\r
134      * The name D stands for "down".\r
135      *\r
136      * @return The d entry of annotation's additional actions dictionary.\r
137      */\r
138     public PDAction getD()\r
139     {\r
140         COSDictionary d = (COSDictionary)actions.getDictionaryObject( "D" );\r
141         PDAction retval = null;\r
142         if( d != null )\r
143         {\r
144             retval = PDActionFactory.createAction( d );\r
145         }\r
146         return retval;\r
147     }\r
148 \r
149     /**\r
150      * This will set an action to be performed when the mouse button\r
151      * is pressed inside the annotation's active area.\r
152      * The name D stands for "down".\r
153      *\r
154      * @param d The action to be performed.\r
155      */\r
156     public void setD( PDAction d )\r
157     {\r
158         actions.setItem( "D", d );\r
159     }\r
160 \r
161     /**\r
162      * This will get an action to be performed when the mouse button\r
163      * is released inside the annotation's active area.\r
164      * The name U stands for "up".\r
165      *\r
166      * @return The U entry of annotation's additional actions dictionary.\r
167      */\r
168     public PDAction getU()\r
169     {\r
170         COSDictionary u = (COSDictionary)actions.getDictionaryObject( "U" );\r
171         PDAction retval = null;\r
172         if( u != null )\r
173         {\r
174             retval = PDActionFactory.createAction( u );\r
175         }\r
176         return retval;\r
177     }\r
178 \r
179     /**\r
180      * This will set an action to be performed when the mouse button\r
181      * is released inside the annotation's active area.\r
182      * The name U stands for "up".\r
183      *\r
184      * @param u The action to be performed.\r
185      */\r
186     public void setU( PDAction u )\r
187     {\r
188         actions.setItem( "U", u );\r
189     }\r
190 \r
191     /**\r
192      * This will get an action to be performed when the annotation\r
193      * receives the input focus.\r
194      *\r
195      * @return The Fo entry of annotation's additional actions dictionary.\r
196      */\r
197     public PDAction getFo()\r
198     {\r
199         COSDictionary fo = (COSDictionary)actions.getDictionaryObject( "Fo" );\r
200         PDAction retval = null;\r
201         if( fo != null )\r
202         {\r
203             retval = PDActionFactory.createAction( fo );\r
204         }\r
205         return retval;\r
206     }\r
207 \r
208     /**\r
209      * This will set an action to be performed when the annotation\r
210      * receives the input focus.\r
211      *\r
212      * @param fo The action to be performed.\r
213      */\r
214     public void setFo( PDAction fo )\r
215     {\r
216         actions.setItem( "Fo", fo );\r
217     }\r
218 \r
219     /**\r
220      * This will get an action to be performed when the annotation\r
221      * loses the input focus.\r
222      * The name Bl stands for "blurred".\r
223      *\r
224      * @return The Bl entry of annotation's additional actions dictionary.\r
225      */\r
226     public PDAction getBl()\r
227     {\r
228         COSDictionary bl = (COSDictionary)actions.getDictionaryObject( "Bl" );\r
229         PDAction retval = null;\r
230         if( bl != null )\r
231         {\r
232             retval = PDActionFactory.createAction( bl );\r
233         }\r
234         return retval;\r
235     }\r
236 \r
237     /**\r
238      * This will set an action to be performed when the annotation\r
239      * loses the input focus.\r
240      * The name Bl stands for "blurred".\r
241      *\r
242      * @param bl The action to be performed.\r
243      */\r
244     public void setBl( PDAction bl )\r
245     {\r
246         actions.setItem( "Bl", bl );\r
247     }\r
248 \r
249     /**\r
250      * This will get an action to be performed when the page containing\r
251      * the annotation is opened. The action is executed after the O action\r
252      * in the page's additional actions dictionary and the OpenAction entry\r
253      * in the document catalog, if such actions are present.\r
254      *\r
255      * @return The PO entry of annotation's additional actions dictionary.\r
256      */\r
257     public PDAction getPO()\r
258     {\r
259         COSDictionary po = (COSDictionary)actions.getDictionaryObject( "PO" );\r
260         PDAction retval = null;\r
261         if( po != null )\r
262         {\r
263             retval = PDActionFactory.createAction( po );\r
264         }\r
265         return retval;\r
266     }\r
267 \r
268     /**\r
269      * This will set an action to be performed when the page containing\r
270      * the annotation is opened. The action is executed after the O action\r
271      * in the page's additional actions dictionary and the OpenAction entry\r
272      * in the document catalog, if such actions are present.\r
273      *\r
274      * @param po The action to be performed.\r
275      */\r
276     public void setPO( PDAction po )\r
277     {\r
278         actions.setItem( "PO", po );\r
279     }\r
280 \r
281     /**\r
282      * This will get an action to be performed when the page containing\r
283      * the annotation is closed. The action is executed before the C action\r
284      * in the page's additional actions dictionary, if present.\r
285      *\r
286      * @return The PC entry of annotation's additional actions dictionary.\r
287      */\r
288     public PDAction getPC()\r
289     {\r
290         COSDictionary pc = (COSDictionary)actions.getDictionaryObject( "PC" );\r
291         PDAction retval = null;\r
292         if( pc != null )\r
293         {\r
294             retval = PDActionFactory.createAction( pc );\r
295         }\r
296         return retval;\r
297     }\r
298 \r
299     /**\r
300      * This will set an action to be performed when the page containing\r
301      * the annotation is closed. The action is executed before the C action\r
302      * in the page's additional actions dictionary, if present.\r
303      *\r
304      * @param pc The action to be performed.\r
305      */\r
306     public void setPC( PDAction pc )\r
307     {\r
308         actions.setItem( "PC", pc );\r
309     }\r
310 \r
311     /**\r
312      * This will get an action to be performed when the page containing\r
313      * the annotation becomes visible in the viewer application's user interface.\r
314      *\r
315      * @return The PV entry of annotation's additional actions dictionary.\r
316      */\r
317     public PDAction getPV()\r
318     {\r
319         COSDictionary pv = (COSDictionary)actions.getDictionaryObject( "PV" );\r
320         PDAction retval = null;\r
321         if( pv != null )\r
322         {\r
323             retval = PDActionFactory.createAction( pv );\r
324         }\r
325         return retval;\r
326     }\r
327 \r
328     /**\r
329      * This will set an action to be performed when the page containing\r
330      * the annotation becomes visible in the viewer application's user interface.\r
331      *\r
332      * @param pv The action to be performed.\r
333      */\r
334     public void setPV( PDAction pv )\r
335     {\r
336         actions.setItem( "PV", pv );\r
337     }\r
338 \r
339     /**\r
340      * This will get an action to be performed when the page containing the annotation\r
341      * is no longer visible in the viewer application's user interface.\r
342      *\r
343      * @return The PI entry of annotation's additional actions dictionary.\r
344      */\r
345     public PDAction getPI()\r
346     {\r
347         COSDictionary pi = (COSDictionary)actions.getDictionaryObject( "PI" );\r
348         PDAction retval = null;\r
349         if( pi != null )\r
350         {\r
351             retval = PDActionFactory.createAction( pi );\r
352         }\r
353         return retval;\r
354     }\r
355 \r
356     /**\r
357      * This will set an action to be performed when the page containing the annotation\r
358      * is no longer visible in the viewer application's user interface.\r
359      *\r
360      * @param pi The action to be performed.\r
361      */\r
362     public void setPI( PDAction pi )\r
363     {\r
364         actions.setItem( "PI", pi );\r
365     }\r
366 }\r