Revision 766
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/gvsig/javadocs/scripting/commonsdialog.java | ||
---|---|---|
1 | 1 |
package scripting; |
2 | 2 |
|
3 |
|
|
4 |
import java.awt.Component; |
|
5 |
import javax.swing.JFileChooser; |
|
6 |
|
|
3 | 7 |
/** |
4 |
* |
|
5 |
*
|
|
8 |
* Module with functions to show simple dialogs.
|
|
9 |
* |
|
6 | 10 |
*/ |
7 | 11 |
public class commonsdialog { |
8 | 12 |
|
13 |
/** |
|
14 |
* msgbox messagetypes |
|
15 |
*/ |
|
9 | 16 |
public static final int FORBIDEN = 0; |
10 | 17 |
public static final int IDEA = 1; |
11 | 18 |
public static final int WARNING = 2; |
12 | 19 |
public static final int QUESTION = 3; |
13 | 20 |
|
21 |
|
|
14 | 22 |
/** |
15 |
* Shows a message dialog with ok button only. |
|
16 |
* |
|
17 |
* @param message |
|
18 |
* @param title |
|
19 |
* @param messageType |
|
20 |
* |
|
23 |
* Confirmdialog optionType Options |
|
24 |
*/ |
|
25 |
public static final int YES_NO = 0; |
|
26 |
public static final int YES_NO_CANCEL = 1; |
|
27 |
public static final int ACCEPT_CANCEL = 2; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* Return values for confirmDialog |
|
32 |
*/ |
|
33 |
public static final int YES = 0; |
|
34 |
public static final int NO = 1; |
|
35 |
public static final int CANCEL = 2; |
|
36 |
|
|
37 |
/** |
|
38 |
* filechooser options |
|
39 |
*/ |
|
40 |
public static final int OPEN_FILE = 0; |
|
41 |
public static final int OPEN_DIRECTORY = 1; |
|
42 |
public static final int SAVE_FILE = 2; |
|
43 |
|
|
44 |
/** |
|
45 |
* filechooser selectionMode |
|
46 |
*/ |
|
47 |
public static final int FILES_ONLY = JFileChooser.FILES_ONLY; |
|
48 |
public static final int DIRECTORIES_ONLY = JFileChooser.DIRECTORIES_ONLY; |
|
49 |
|
|
50 |
/** |
|
51 |
* Shows a message dialog with ok button only. |
|
52 |
* <br> |
|
53 |
* Valid values for messageType are:<br> |
|
54 |
* <ul> |
|
55 |
* <li>FORBIDEN</li> |
|
56 |
* <li>IDEA</li> |
|
57 |
* <li>WARNING</li> |
|
58 |
* <li>QUESTION</li> |
|
59 |
* </ul> |
|
60 |
* |
|
61 |
* @param message |
|
62 |
* @param title, optional, title of the dialog |
|
63 |
* @param messageType, optional, default value is IDEA |
|
64 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
65 |
* |
|
21 | 66 |
*/ |
22 |
public static void msgbox(String message, String title, int messageType) { |
|
23 |
|
|
67 |
public static void msgbox(String message, String title, int messageType, Component root) {
|
|
68 |
|
|
24 | 69 |
} |
25 | 70 |
|
26 | 71 |
/** |
27 |
* Shows a message dialog with ok button only of messageType IDEA. |
|
28 |
* |
|
29 |
* @param message |
|
30 |
* @param title |
|
31 |
* |
|
32 |
*/ |
|
33 |
public static void msgbox(String message, String title) { |
|
34 |
|
|
72 |
* Shows a dialog to request a input to the user. |
|
73 |
* <br> |
|
74 |
* Valid values for messageType are:<br> |
|
75 |
* <ul> |
|
76 |
* <li>FORBIDEN</li> |
|
77 |
* <li>IDEA</li> |
|
78 |
* <li>WARNING</li> |
|
79 |
* <li>QUESTION</li> |
|
80 |
* </ul> |
|
81 |
* |
|
82 |
* @param prompt |
|
83 |
* @param title, optional, title of the dialog |
|
84 |
* @param messageType, optional, default value is IDEA |
|
85 |
* @param initialValue, optional, default value is "" |
|
86 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
87 |
* @return the string value entered by the user or None. |
|
88 |
*/ |
|
89 |
public static String inputbox(String prompt, String title, int messageType, String initialValue, Component root) { |
|
90 |
return null; |
|
35 | 91 |
} |
36 | 92 |
|
93 |
/** |
|
94 |
* Shows a dialog to request to the user an answer of YES, NO or CANCEL. |
|
95 |
* |
|
96 |
* <br> |
|
97 |
* Valid values for optionType are:<br> |
|
98 |
* <ul> |
|
99 |
* <li>YES_NO</li> |
|
100 |
* <li>YES_NO_CANCEL</li> |
|
101 |
* <li>ACCEPT_CANCEL</li> |
|
102 |
* </ul> |
|
103 |
* <br> |
|
104 |
* Valid values for messageType are:<br> |
|
105 |
* <ul> |
|
106 |
* <li>FORBIDEN</li> |
|
107 |
* <li>IDEA</li> |
|
108 |
* <li>WARNING</li> |
|
109 |
* <li>QUESTION</li> |
|
110 |
* </ul> |
|
111 |
* |
|
112 |
* @param prompt |
|
113 |
* @param title, optional, title of the dialog |
|
114 |
* @param optionType, optional, default value is YES_NO |
|
115 |
* @param messageType, optional, default value is IDEA |
|
116 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
117 |
* @return YES, NO, CANCEL. |
|
118 |
*/ |
|
119 |
public static int confirmDialog(String prompt, String title, optionType=YES_NO, messageType=IDEA, root=None) { |
|
120 |
return 0; |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* Show an file or folder selector dialog. |
|
125 |
* |
|
126 |
* If multiselection is False, the default value, return the path-name of the |
|
127 |
* selected file or folder. If is True, return a list of the selecteds path-names. |
|
128 |
* <br> |
|
129 |
* Return None if the user cancel the action. |
|
130 |
* <br> |
|
131 |
* Valid values for mode are:<br> |
|
132 |
* <ul> |
|
133 |
* <li>FILES_ONLY</li> |
|
134 |
* <li>DIRECTORIES_ONLY</li> |
|
135 |
* </ul> |
|
136 |
* |
|
137 |
* @param mode |
|
138 |
* @param title, optional, title of the dialog |
|
139 |
* @param initialPath, optional, default value is None |
|
140 |
* @param multiselection, optional, default value is False |
|
141 |
* @param filter, optional, default value is None |
|
142 |
* @param fileHidingEnabled, optional, default value is True |
|
143 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
144 |
* @return the pathnames selected or None if user cancel. |
|
145 |
*/ |
|
146 |
public static String[] filechooser(int mode, String title, String initialPath, |
|
147 |
boolean multiselection, String filter, boolean fileHidingEnabled, Component root) { |
|
148 |
return null; |
|
149 |
} |
|
150 |
|
|
151 |
|
|
152 |
/** |
|
153 |
* Show a selector dialog for choose a file for reading. |
|
154 |
* <br> |
|
155 |
* This is a utility function that call to filechooser. |
|
156 |
* <br> |
|
157 |
* Return None if the user cancel the action. |
|
158 |
* |
|
159 |
* @param title, optional, title of the dialog |
|
160 |
* @param initialPath, optional, default value is None |
|
161 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
162 |
* @return the pathnames selected or None if user cancel. |
|
163 |
*/ |
|
164 |
public static String[] openFileDialog(String title, String initialPath, Component root) { |
|
165 |
return null; |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* Show a selector dialog for choose a folder. |
|
170 |
* <br> |
|
171 |
* This is a utility function that call to filechooser. |
|
172 |
* <br> |
|
173 |
* Return None if the user cancel the action. |
|
174 |
* |
|
175 |
* @param title, optional, title of the dialog |
|
176 |
* @param initialPath, optional, default value is None |
|
177 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
178 |
* @return the pathnames selected or None if user cancel. |
|
179 |
*/ |
|
180 |
public static String[] openFolderDialog(String title, String initialPath, Component root) { |
|
181 |
return null; |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* Show a selector dialog for choose a file for writing. |
|
186 |
* <br> |
|
187 |
* This is a utility function that call to filechooser. |
|
188 |
* <br> |
|
189 |
* Return None if the user cancel the action. |
|
190 |
* |
|
191 |
* @param title, optional, title of the dialog |
|
192 |
* @param initialPath, optional, default value is None |
|
193 |
* @param root, optional, parent Component for this dialog, default values is gvSIG main window. |
|
194 |
* @return the pathnames selected or None if user cancel. |
|
195 |
*/ |
|
196 |
public static String[] saveFileDialog(String title, String initialPath, Component root) { |
|
197 |
return null; |
|
198 |
} |
|
199 |
|
|
37 | 200 |
} |
Also available in: Unified diff