]> _ Git - cubeextranet.git/blob
486e6ebf5ff7930abb7a3a68dc62cf44d685fa75
[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.type;\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 \r
24 /**\r
25  * Launch paramaters for the windows OS.\r
26  *\r
27  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>\r
28  * @version $Revision: 1.2 $\r
29  */\r
30 public class PDWindowsLaunchParams implements COSObjectable\r
31 {\r
32     /**\r
33      * The open operation for the launch.\r
34      */\r
35     public static final String OPERATION_OPEN = "open";\r
36     /**\r
37      * The print operation for the lanuch.\r
38      */\r
39     public static final String OPERATION_PRINT = "print";\r
40 \r
41     /**\r
42      * The params dictionary.\r
43      */\r
44     protected COSDictionary params;\r
45 \r
46     /**\r
47      * Default constructor.\r
48      */\r
49     public PDWindowsLaunchParams()\r
50     {\r
51         params = new COSDictionary();\r
52     }\r
53 \r
54     /**\r
55      * Constructor.\r
56      *\r
57      * @param p The params dictionary.\r
58      */\r
59     public PDWindowsLaunchParams( COSDictionary p )\r
60     {\r
61         params = p;\r
62     }\r
63 \r
64     /**\r
65      * Convert this standard java object to a COS object.\r
66      *\r
67      * @return The cos object that matches this Java object.\r
68      */\r
69     public COSBase getCOSObject()\r
70     {\r
71         return params;\r
72     }\r
73 \r
74     /**\r
75      * Convert this standard java object to a COS object.\r
76      *\r
77      * @return The cos object that matches this Java object.\r
78      */\r
79     public COSDictionary getCOSDictionary()\r
80     {\r
81         return params;\r
82     }\r
83 \r
84     /**\r
85      * The file to launch.\r
86      *\r
87      * @return The executable/document to launch.\r
88      */\r
89     public String getFilename()\r
90     {\r
91         return params.getString( "F" );\r
92     }\r
93 \r
94     /**\r
95      * Set the file to launch.\r
96      *\r
97      * @param file The executable/document to launch.\r
98      */\r
99     public void setFilename( String file )\r
100     {\r
101         params.setString( "F", file );\r
102     }\r
103 \r
104     /**\r
105      * The dir to launch from.\r
106      *\r
107      * @return The dir of the executable/document to launch.\r
108      */\r
109     public String getDirectory()\r
110     {\r
111         return params.getString( "D" );\r
112     }\r
113 \r
114     /**\r
115      * Set the dir to launch from.\r
116      *\r
117      * @param dir The dir of the executable/document to launch.\r
118      */\r
119     public void setDirectory( String dir )\r
120     {\r
121         params.setString( "D", dir );\r
122     }\r
123 \r
124     /**\r
125      * Get the operation to perform on the file.  This method will not return null,\r
126      * OPERATION_OPEN is the default.\r
127      *\r
128      * @return The operation to perform for the file.\r
129      * @see PDWindowsLaunchParams#OPERATION_OPEN\r
130      * @see PDWindowsLaunchParams#OPERATION_PRINT\r
131      */\r
132     public String getOperation()\r
133     {\r
134         return params.getString( "O", OPERATION_OPEN );\r
135     }\r
136 \r
137     /**\r
138      * Set the operation to perform..\r
139      *\r
140      * @param op The operation to perform on the file.\r
141      */\r
142     public void setOperation( String op )\r
143     {\r
144         params.setString( "D", op );\r
145     }\r
146 \r
147     /**\r
148      * A parameter to pass the executable.\r
149      *\r
150      * @return The parameter to pass the executable.\r
151      */\r
152     public String getExecuteParam()\r
153     {\r
154         return params.getString( "P" );\r
155     }\r
156 \r
157     /**\r
158      * Set the parameter to pass the executable.\r
159      *\r
160      * @param param The parameter for the executable.\r
161      */\r
162     public void setExecuteParam( String param )\r
163     {\r
164         params.setString( "P", param );\r
165     }\r
166 }\r