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 a form field'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 PDFormFieldAdditionalActions implements COSObjectable
\r
35 private COSDictionary actions;
\r
38 * Default constructor.
\r
40 public PDFormFieldAdditionalActions()
\r
42 actions = new COSDictionary();
\r
48 * @param a The action dictionary.
\r
50 public PDFormFieldAdditionalActions( 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 a JavaScript action to be performed when the user
\r
77 * types a keystroke into a text field or combo box or modifies the
\r
78 * selection in a scrollable list box. This allows the keystroke to
\r
79 * be checked for validity and rejected or modified.
\r
81 * @return The K entry of form field's additional actions dictionary.
\r
83 public PDAction getK()
\r
85 COSDictionary k = (COSDictionary)actions.getDictionaryObject( "K" );
\r
86 PDAction retval = null;
\r
89 retval = PDActionFactory.createAction( k );
\r
95 * This will set a JavaScript action to be performed when the user
\r
96 * types a keystroke into a text field or combo box or modifies the
\r
97 * selection in a scrollable list box. This allows the keystroke to
\r
98 * be checked for validity and rejected or modified.
\r
100 * @param k The action to be performed.
\r
102 public void setK( PDAction k )
\r
104 actions.setItem( "K", k );
\r
108 * This will get a JavaScript action to be performed before
\r
109 * the field is formatted to display its current value. This
\r
110 * allows the field's value to be modified before formatting.
\r
112 * @return The F entry of form field's additional actions dictionary.
\r
114 public PDAction getF()
\r
116 COSDictionary f = (COSDictionary)actions.getDictionaryObject( "F" );
\r
117 PDAction retval = null;
\r
120 retval = PDActionFactory.createAction( f );
\r
126 * This will set a JavaScript action to be performed before
\r
127 * the field is formatted to display its current value. This
\r
128 * allows the field's value to be modified before formatting.
\r
130 * @param f The action to be performed.
\r
132 public void setF( PDAction f )
\r
134 actions.setItem( "F", f );
\r
138 * This will get a JavaScript action to be performed
\r
139 * when the field's value is changed. This allows the
\r
140 * new value to be checked for validity.
\r
141 * The name V stands for "validate".
\r
143 * @return The V entry of form field's additional actions dictionary.
\r
145 public PDAction getV()
\r
147 COSDictionary v = (COSDictionary)actions.getDictionaryObject( "V" );
\r
148 PDAction retval = null;
\r
151 retval = PDActionFactory.createAction( v );
\r
157 * This will set a JavaScript action to be performed
\r
158 * when the field's value is changed. This allows the
\r
159 * new value to be checked for validity.
\r
160 * The name V stands for "validate".
\r
162 * @param v The action to be performed.
\r
164 public void setV( PDAction v )
\r
166 actions.setItem( "V", v );
\r
170 * This will get a JavaScript action to be performed in order to recalculate
\r
171 * the value of this field when that of another field changes. The order in which
\r
172 * the document's fields are recalculated is defined by the CO entry in the
\r
173 * interactive form dictionary.
\r
174 * The name C stands for "calculate".
\r
176 * @return The C entry of form field's additional actions dictionary.
\r
178 public PDAction getC()
\r
180 COSDictionary c = (COSDictionary)actions.getDictionaryObject( "C" );
\r
181 PDAction retval = null;
\r
184 retval = PDActionFactory.createAction( c );
\r
190 * This will set a JavaScript action to be performed in order to recalculate
\r
191 * the value of this field when that of another field changes. The order in which
\r
192 * the document's fields are recalculated is defined by the CO entry in the
\r
193 * interactive form dictionary.
\r
194 * The name C stands for "calculate".
\r
196 * @param c The action to be performed.
\r
198 public void setC( PDAction c )
\r
200 actions.setItem( "C", c );
\r