2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.apache.pdfbox.pdmodel.interactive.action;
19 import org.apache.pdfbox.cos.COSBase;
20 import org.apache.pdfbox.cos.COSDictionary;
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;
23 import org.apache.pdfbox.pdmodel.interactive.action.type.PDAction;
26 * This class represents an annotation's dictionary of actions
27 * that occur due to events.
29 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
30 * @author Panagiotis Toumasis (ptoumasis@mail.gr)
31 * @version $Revision: 1.2 $
33 public class PDAnnotationAdditionalActions implements COSObjectable
35 private COSDictionary actions;
38 * Default constructor.
40 public PDAnnotationAdditionalActions()
42 actions = new COSDictionary();
48 * @param a The action dictionary.
50 public PDAnnotationAdditionalActions( COSDictionary a )
56 * Convert this standard java object to a COS object.
58 * @return The cos object that matches this Java object.
60 public COSBase getCOSObject()
66 * Convert this standard java object to a COS object.
68 * @return The cos object that matches this Java object.
70 public COSDictionary getCOSDictionary()
76 * This will get an action to be performed when the cursor
77 * enters the annotation's active area.
79 * @return The E entry of annotation's additional actions dictionary.
81 public PDAction getE()
83 COSDictionary e = (COSDictionary)actions.getDictionaryObject( "E" );
84 PDAction retval = null;
87 retval = PDActionFactory.createAction( e );
93 * This will set an action to be performed when the cursor
94 * enters the annotation's active area.
96 * @param e The action to be performed.
98 public void setE( PDAction e )
100 actions.setItem( "E", e );
104 * This will get an action to be performed when the cursor
105 * exits the annotation's active area.
107 * @return The X entry of annotation's additional actions dictionary.
109 public PDAction getX()
111 COSDictionary x = (COSDictionary)actions.getDictionaryObject( "X" );
112 PDAction retval = null;
115 retval = PDActionFactory.createAction( x );
121 * This will set an action to be performed when the cursor
122 * exits the annotation's active area.
124 * @param x The action to be performed.
126 public void setX( PDAction x )
128 actions.setItem( "X", x );
132 * This will get an action to be performed when the mouse button
133 * is pressed inside the annotation's active area.
134 * The name D stands for "down".
136 * @return The d entry of annotation's additional actions dictionary.
138 public PDAction getD()
140 COSDictionary d = (COSDictionary)actions.getDictionaryObject( "D" );
141 PDAction retval = null;
144 retval = PDActionFactory.createAction( d );
150 * This will set an action to be performed when the mouse button
151 * is pressed inside the annotation's active area.
152 * The name D stands for "down".
154 * @param d The action to be performed.
156 public void setD( PDAction d )
158 actions.setItem( "D", d );
162 * This will get an action to be performed when the mouse button
163 * is released inside the annotation's active area.
164 * The name U stands for "up".
166 * @return The U entry of annotation's additional actions dictionary.
168 public PDAction getU()
170 COSDictionary u = (COSDictionary)actions.getDictionaryObject( "U" );
171 PDAction retval = null;
174 retval = PDActionFactory.createAction( u );
180 * This will set an action to be performed when the mouse button
181 * is released inside the annotation's active area.
182 * The name U stands for "up".
184 * @param u The action to be performed.
186 public void setU( PDAction u )
188 actions.setItem( "U", u );
192 * This will get an action to be performed when the annotation
193 * receives the input focus.
195 * @return The Fo entry of annotation's additional actions dictionary.
197 public PDAction getFo()
199 COSDictionary fo = (COSDictionary)actions.getDictionaryObject( "Fo" );
200 PDAction retval = null;
203 retval = PDActionFactory.createAction( fo );
209 * This will set an action to be performed when the annotation
210 * receives the input focus.
212 * @param fo The action to be performed.
214 public void setFo( PDAction fo )
216 actions.setItem( "Fo", fo );
220 * This will get an action to be performed when the annotation
221 * loses the input focus.
222 * The name Bl stands for "blurred".
224 * @return The Bl entry of annotation's additional actions dictionary.
226 public PDAction getBl()
228 COSDictionary bl = (COSDictionary)actions.getDictionaryObject( "Bl" );
229 PDAction retval = null;
232 retval = PDActionFactory.createAction( bl );
238 * This will set an action to be performed when the annotation
239 * loses the input focus.
240 * The name Bl stands for "blurred".
242 * @param bl The action to be performed.
244 public void setBl( PDAction bl )
246 actions.setItem( "Bl", bl );
250 * This will get an action to be performed when the page containing
251 * the annotation is opened. The action is executed after the O action
252 * in the page's additional actions dictionary and the OpenAction entry
253 * in the document catalog, if such actions are present.
255 * @return The PO entry of annotation's additional actions dictionary.
257 public PDAction getPO()
259 COSDictionary po = (COSDictionary)actions.getDictionaryObject( "PO" );
260 PDAction retval = null;
263 retval = PDActionFactory.createAction( po );
269 * This will set an action to be performed when the page containing
270 * the annotation is opened. The action is executed after the O action
271 * in the page's additional actions dictionary and the OpenAction entry
272 * in the document catalog, if such actions are present.
274 * @param po The action to be performed.
276 public void setPO( PDAction po )
278 actions.setItem( "PO", po );
282 * This will get an action to be performed when the page containing
283 * the annotation is closed. The action is executed before the C action
284 * in the page's additional actions dictionary, if present.
286 * @return The PC entry of annotation's additional actions dictionary.
288 public PDAction getPC()
290 COSDictionary pc = (COSDictionary)actions.getDictionaryObject( "PC" );
291 PDAction retval = null;
294 retval = PDActionFactory.createAction( pc );
300 * This will set an action to be performed when the page containing
301 * the annotation is closed. The action is executed before the C action
302 * in the page's additional actions dictionary, if present.
304 * @param pc The action to be performed.
306 public void setPC( PDAction pc )
308 actions.setItem( "PC", pc );
312 * This will get an action to be performed when the page containing
313 * the annotation becomes visible in the viewer application's user interface.
315 * @return The PV entry of annotation's additional actions dictionary.
317 public PDAction getPV()
319 COSDictionary pv = (COSDictionary)actions.getDictionaryObject( "PV" );
320 PDAction retval = null;
323 retval = PDActionFactory.createAction( pv );
329 * This will set an action to be performed when the page containing
330 * the annotation becomes visible in the viewer application's user interface.
332 * @param pv The action to be performed.
334 public void setPV( PDAction pv )
336 actions.setItem( "PV", pv );
340 * This will get an action to be performed when the page containing the annotation
341 * is no longer visible in the viewer application's user interface.
343 * @return The PI entry of annotation's additional actions dictionary.
345 public PDAction getPI()
347 COSDictionary pi = (COSDictionary)actions.getDictionaryObject( "PI" );
348 PDAction retval = null;
351 retval = PDActionFactory.createAction( pi );
357 * This will set an action to be performed when the page containing the annotation
358 * is no longer visible in the viewer application's user interface.
360 * @param pi The action to be performed.
362 public void setPI( PDAction pi )
364 actions.setItem( "PI", pi );