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
9 * http://www.apache.org/licenses/LICENSE-2.0
\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
17 package org.apache.pdfbox.pdmodel.interactive.action;
\r
19 import org.apache.pdfbox.cos.COSBase;
\r
20 import org.apache.pdfbox.cos.COSDictionary;
\r
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;
\r
23 import org.apache.pdfbox.pdmodel.interactive.action.type.PDAction;
\r
26 * This class represents an annotation's dictionary of actions
\r
27 * that occur due to events.
\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
33 public class PDAnnotationAdditionalActions implements COSObjectable
\r
35 private COSDictionary actions;
\r
38 * Default constructor.
\r
40 public PDAnnotationAdditionalActions()
\r
42 actions = new COSDictionary();
\r
48 * @param a The action dictionary.
\r
50 public PDAnnotationAdditionalActions( COSDictionary a )
\r
56 * Convert this standard java object to a COS object.
\r
58 * @return The cos object that matches this Java object.
\r
60 public COSBase getCOSObject()
\r
66 * Convert this standard java object to a COS object.
\r
68 * @return The cos object that matches this Java object.
\r
70 public COSDictionary getCOSDictionary()
\r
76 * This will get an action to be performed when the cursor
\r
77 * enters the annotation's active area.
\r
79 * @return The E entry of annotation's additional actions dictionary.
\r
81 public PDAction getE()
\r
83 COSDictionary e = (COSDictionary)actions.getDictionaryObject( "E" );
\r
84 PDAction retval = null;
\r
87 retval = PDActionFactory.createAction( e );
\r
93 * This will set an action to be performed when the cursor
\r
94 * enters the annotation's active area.
\r
96 * @param e The action to be performed.
\r
98 public void setE( PDAction e )
\r
100 actions.setItem( "E", e );
\r
104 * This will get an action to be performed when the cursor
\r
105 * exits the annotation's active area.
\r
107 * @return The X entry of annotation's additional actions dictionary.
\r
109 public PDAction getX()
\r
111 COSDictionary x = (COSDictionary)actions.getDictionaryObject( "X" );
\r
112 PDAction retval = null;
\r
115 retval = PDActionFactory.createAction( x );
\r
121 * This will set an action to be performed when the cursor
\r
122 * exits the annotation's active area.
\r
124 * @param x The action to be performed.
\r
126 public void setX( PDAction x )
\r
128 actions.setItem( "X", x );
\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
136 * @return The d entry of annotation's additional actions dictionary.
\r
138 public PDAction getD()
\r
140 COSDictionary d = (COSDictionary)actions.getDictionaryObject( "D" );
\r
141 PDAction retval = null;
\r
144 retval = PDActionFactory.createAction( d );
\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
154 * @param d The action to be performed.
\r
156 public void setD( PDAction d )
\r
158 actions.setItem( "D", d );
\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
166 * @return The U entry of annotation's additional actions dictionary.
\r
168 public PDAction getU()
\r
170 COSDictionary u = (COSDictionary)actions.getDictionaryObject( "U" );
\r
171 PDAction retval = null;
\r
174 retval = PDActionFactory.createAction( u );
\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
184 * @param u The action to be performed.
\r
186 public void setU( PDAction u )
\r
188 actions.setItem( "U", u );
\r
192 * This will get an action to be performed when the annotation
\r
193 * receives the input focus.
\r
195 * @return The Fo entry of annotation's additional actions dictionary.
\r
197 public PDAction getFo()
\r
199 COSDictionary fo = (COSDictionary)actions.getDictionaryObject( "Fo" );
\r
200 PDAction retval = null;
\r
203 retval = PDActionFactory.createAction( fo );
\r
209 * This will set an action to be performed when the annotation
\r
210 * receives the input focus.
\r
212 * @param fo The action to be performed.
\r
214 public void setFo( PDAction fo )
\r
216 actions.setItem( "Fo", fo );
\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
224 * @return The Bl entry of annotation's additional actions dictionary.
\r
226 public PDAction getBl()
\r
228 COSDictionary bl = (COSDictionary)actions.getDictionaryObject( "Bl" );
\r
229 PDAction retval = null;
\r
232 retval = PDActionFactory.createAction( bl );
\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
242 * @param bl The action to be performed.
\r
244 public void setBl( PDAction bl )
\r
246 actions.setItem( "Bl", bl );
\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
255 * @return The PO entry of annotation's additional actions dictionary.
\r
257 public PDAction getPO()
\r
259 COSDictionary po = (COSDictionary)actions.getDictionaryObject( "PO" );
\r
260 PDAction retval = null;
\r
263 retval = PDActionFactory.createAction( po );
\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
274 * @param po The action to be performed.
\r
276 public void setPO( PDAction po )
\r
278 actions.setItem( "PO", po );
\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
286 * @return The PC entry of annotation's additional actions dictionary.
\r
288 public PDAction getPC()
\r
290 COSDictionary pc = (COSDictionary)actions.getDictionaryObject( "PC" );
\r
291 PDAction retval = null;
\r
294 retval = PDActionFactory.createAction( pc );
\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
304 * @param pc The action to be performed.
\r
306 public void setPC( PDAction pc )
\r
308 actions.setItem( "PC", pc );
\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
315 * @return The PV entry of annotation's additional actions dictionary.
\r
317 public PDAction getPV()
\r
319 COSDictionary pv = (COSDictionary)actions.getDictionaryObject( "PV" );
\r
320 PDAction retval = null;
\r
323 retval = PDActionFactory.createAction( pv );
\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
332 * @param pv The action to be performed.
\r
334 public void setPV( PDAction pv )
\r
336 actions.setItem( "PV", pv );
\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
343 * @return The PI entry of annotation's additional actions dictionary.
\r
345 public PDAction getPI()
\r
347 COSDictionary pi = (COSDictionary)actions.getDictionaryObject( "PI" );
\r
348 PDAction retval = null;
\r
351 retval = PDActionFactory.createAction( pi );
\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
360 * @param pi The action to be performed.
\r
362 public void setPI( PDAction pi )
\r
364 actions.setItem( "PI", pi );
\r