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