KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pdfbox > pdmodel > interactive > action > type > PDWindowsLaunchParams


1 /**
2  * Copyright (c) 2004, www.pdfbox.org
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * 3. Neither the name of pdfbox; nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * http://www.pdfbox.org
29  *
30  */

31 package org.pdfbox.pdmodel.interactive.action.type;
32
33 import org.pdfbox.cos.COSBase;
34 import org.pdfbox.cos.COSDictionary;
35
36 import org.pdfbox.pdmodel.common.COSObjectable;
37
38 /**
39  * Launch paramaters for the windows OS.
40  *
41  * @author <a HREF="mailto:ben@benlitchfield.com">Ben Litchfield</a>
42  * @version $Revision: 1.2 $
43  */

44 public class PDWindowsLaunchParams implements COSObjectable
45 {
46     /**
47      * The open operation for the launch.
48      */

49     public static final String JavaDoc OPERATION_OPEN = "open";
50     /**
51      * The print operation for the lanuch.
52      */

53     public static final String JavaDoc OPERATION_PRINT = "print";
54     
55     /**
56      * The params dictionary.
57      */

58     protected COSDictionary params;
59
60     /**
61      * Default constructor.
62      */

63     public PDWindowsLaunchParams()
64     {
65         params = new COSDictionary();
66     }
67
68     /**
69      * Constructor.
70      *
71      * @param p The params dictionary.
72      */

73     public PDWindowsLaunchParams( COSDictionary p )
74     {
75         params = p;
76     }
77
78     /**
79      * Convert this standard java object to a COS object.
80      *
81      * @return The cos object that matches this Java object.
82      */

83     public COSBase getCOSObject()
84     {
85         return params;
86     }
87
88     /**
89      * Convert this standard java object to a COS object.
90      *
91      * @return The cos object that matches this Java object.
92      */

93     public COSDictionary getCOSDictionary()
94     {
95         return params;
96     }
97     
98     /**
99      * The file to launch.
100      *
101      * @return The executable/document to launch.
102      */

103     public String JavaDoc getFilename()
104     {
105         return params.getString( "F" );
106     }
107     
108     /**
109      * Set the file to launch.
110      *
111      * @param file The executable/document to launch.
112      */

113     public void setFilename( String JavaDoc file )
114     {
115         params.setString( "F", file );
116     }
117     
118     /**
119      * The dir to launch from.
120      *
121      * @return The dir of the executable/document to launch.
122      */

123     public String JavaDoc getDirectory()
124     {
125         return params.getString( "D" );
126     }
127     
128     /**
129      * Set the dir to launch from.
130      *
131      * @param dir The dir of the executable/document to launch.
132      */

133     public void setDirectory( String JavaDoc dir )
134     {
135         params.setString( "D", dir );
136     }
137     
138     /**
139      * Get the operation to perform on the file. This method will not return null,
140      * OPERATION_OPEN is the default.
141      *
142      * @return The operation to perform for the file.
143      * @see PDWindowsLaunchParams#OPERATION_OPEN
144      * @see PDWindowsLaunchParams#OPERATION_PRINT
145      */

146     public String JavaDoc getOperation()
147     {
148         return params.getString( "O", OPERATION_OPEN );
149     }
150     
151     /**
152      * Set the operation to perform..
153      *
154      * @param op The operation to perform on the file.
155      */

156     public void setOperation( String JavaDoc op )
157     {
158         params.setString( "D", op );
159     }
160     
161     /**
162      * A parameter to pass the executable.
163      *
164      * @return The parameter to pass the executable.
165      */

166     public String JavaDoc getExecuteParam()
167     {
168         return params.getString( "P" );
169     }
170     
171     /**
172      * Set the parameter to pass the executable.
173      *
174      * @param param The parameter for the executable.
175      */

176     public void setExecuteParam( String JavaDoc param )
177     {
178         params.setString( "P", param );
179     }
180 }
Popular Tags