Revision 43377 trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/mdiFrame/ThreadSafeDialogs.java
ThreadSafeDialogs.java | ||
---|---|---|
24 | 24 |
package org.gvsig.andami.ui.mdiFrame; |
25 | 25 |
|
26 | 26 |
import java.awt.Component; |
27 |
import java.io.File; |
|
28 |
import javax.swing.filechooser.FileFilter; |
|
27 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
29 | 28 |
|
30 |
public interface ThreadSafeDialogs { |
|
31 |
|
|
32 |
/** |
|
33 |
* Create a message dialog with an ok button. |
|
34 |
* |
|
35 |
* If message or title start whit a "_" then try to translate. |
|
36 |
* |
|
37 |
* This method is thread safe to use. |
|
38 |
* |
|
39 |
* @param message to present in the dialog |
|
40 |
* @param title title of the dialog |
|
41 |
* @param messageType type of icon to use. |
|
42 |
* |
|
43 |
* @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int) |
|
44 |
*/ |
|
45 |
public void messageDialog(String message, String title, int messageType); |
|
46 |
|
|
47 |
/** |
|
48 |
* Create a message dialog with ok button. |
|
49 |
* |
|
50 |
* If message or title start whit a "_" then try to translate. |
|
51 |
* if messageArgs not is null the message can be formated whit MessageFormat. |
|
52 |
* |
|
53 |
* This method is thread safe to use. |
|
54 |
* |
|
55 |
* @param message to present in the dialog |
|
56 |
* @param messageArgs string array of arguments used to format the message |
|
57 |
* @param title title of the dialog |
|
58 |
* @param messageType type of icon to use. |
|
59 |
* |
|
60 |
* @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int) |
|
61 |
*/ |
|
62 |
public void messageDialog(String message, String messageArgs[], String title, int messageType); |
|
63 |
|
|
29 |
public interface ThreadSafeDialogs extends ThreadSafeDialogsManager { |
|
30 |
|
|
64 | 31 |
public void messageDialog(String message, String messageArgs[], String title, int messageType, String msgid); |
65 | 32 |
|
66 |
/** |
|
67 |
* Show a JOptionPane confirm dialog. |
|
68 |
* |
|
69 |
* if this method is invoked out of the event dispatch thread of swing, |
|
70 |
* the dialog is presented in the thread of swing and the calling thread |
|
71 |
* wait to close to continue. |
|
72 |
* |
|
73 |
* @param message |
|
74 |
* @param title |
|
75 |
* @param optionType |
|
76 |
* @param messageType |
|
77 |
* @return |
|
78 |
* |
|
79 |
* @see javax.swing.JOptionPane#showConfirmDialog(Component, Object, String, int, int) |
|
80 |
* |
|
81 |
*/ |
|
82 |
public int confirmDialog(String message, String title, int optionType, int messageType) ; |
|
33 |
public int confirmDialog(String message, String title, int optionType, int messageType, String msgid) ; |
|
83 | 34 |
|
84 |
public int confirmDialog(String message, String title, int optionType, int messageType, String msgid) ; |
|
85 |
|
|
86 | 35 |
/** |
87 |
* Show a JOptionPane input dialog. |
|
88 |
* |
|
89 |
* if this method is invoked out of the event dispatch thread of swing, |
|
90 |
* the dialog is presented in the thread of swing and the calling thread |
|
91 |
* wait to close to continue. |
|
92 |
* |
|
93 |
* @param message |
|
94 |
* @param title |
|
95 |
* @param messageType |
|
96 |
* an integer designating the kind of message this is; |
|
97 |
* primarily used to determine the icon from the pluggable |
|
98 |
* Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, |
|
99 |
* WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE |
|
100 |
* @return |
|
101 |
* |
|
102 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int) |
|
103 |
* |
|
104 |
*/ |
|
105 |
public String inputDialog(String message, String title, int messageType, String initialValue) ; |
|
106 |
|
|
107 |
/** |
|
108 |
* Show a JOptionPane input dialog. |
|
109 |
* |
|
110 |
* if this method is invoked out of the event dispatch thread of swing, |
|
111 |
* the dialog is presented in the thread of swing and the calling thread |
|
112 |
* wait to close to continue. |
|
113 |
* |
|
114 |
* @param message |
|
115 |
* @param title |
|
116 |
* @param optionType |
|
117 |
* @param messageType |
|
118 |
* @return |
|
119 |
* |
|
120 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int) |
|
121 |
* |
|
122 |
*/ |
|
123 |
public String inputDialog(String message, String title); |
|
124 |
|
|
125 |
/** |
|
126 | 36 |
* Create a window with the contents and title specified as parameters |
127 | 37 |
* and show as a dialog windows of gvSIG. |
128 | 38 |
* |
... | ... | |
134 | 44 |
* @param contents |
135 | 45 |
* @param title |
136 | 46 |
*/ |
137 |
public void showDialog(final Component contents, final String title); |
|
138 |
|
|
139 |
/** |
|
140 |
* Creates an return a new instance of the component specified |
|
141 |
* |
|
142 |
* This method ensure that the component is created in the event dispatch thread of swing. |
|
143 |
* |
|
144 |
* @param theClass of component to be created |
|
145 |
* @param parameters passed to the constructor of the component |
|
146 |
* |
|
147 |
* @return the instance of the component created |
|
148 |
*/ |
|
149 |
public Component createComponent(final Class<? extends Component> theClass, final Object ... parameters); |
|
150 |
|
|
151 |
/** |
|
152 |
* Creates an return a new instance of the component specified |
|
153 |
* |
|
154 |
* This method ensure that the component is created in the event dispatch thread of swing. |
|
155 |
* |
|
156 |
* @param theClass of component to be created |
|
157 |
* @param parameters passed to the constructor of the component |
|
158 |
* |
|
159 |
* @return the instance of the component created |
|
160 |
*/ |
|
161 |
public Component createComponentWithParams(final Class<? extends Component> theClass, final Object[] parameters); |
|
162 |
|
|
163 |
/** |
|
164 |
* Creates and show a JFileChooser dialog. |
|
165 |
* |
|
166 |
* This method return an array whit the selected files. If multiselection is |
|
167 |
* not allowed, an array with one element is returned. |
|
168 |
* |
|
169 |
* If the user select the cancel button, null is returned. |
|
170 |
* |
|
171 |
* if this method is invoked out of the event dispatch thread of swing, |
|
172 |
* the dialog is presented in the thread of swing and the calling thread |
|
173 |
* wait to close to continue. |
|
174 |
* |
|
175 |
* @param title, title of dialog |
|
176 |
* @param type of the dialog, JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOG |
|
177 |
* @param selectionMode of the dialog, values are: JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES |
|
178 |
* @param multiselection, true if multiselection is allowed |
|
179 |
* @param initialPath, to show in the dialog |
|
180 |
* @param filter used to filter the files show in the dialog. |
|
181 |
* @param fileHidingEnabled, if true hidden files are show |
|
182 |
* @return an array whit the files selecteds or null. |
|
183 |
*/ |
|
184 |
public File[] showChooserDialog( |
|
185 |
final String title, |
|
186 |
final int type, |
|
187 |
final int selectionMode, |
|
188 |
final boolean multiselection, |
|
189 |
final File initialPath, |
|
190 |
final FileFilter filter, |
|
191 |
final boolean fileHidingEnabled |
|
192 |
) ; |
|
193 |
|
|
194 |
/** |
|
195 |
* Creates and show a JFileChooser dialog for folder selection. |
|
196 |
* |
|
197 |
* This is an utility method that wrap a showChooserDialog call. |
|
198 |
* |
|
199 |
* @param title, title of dialog |
|
200 |
* @param initialPath, to show in the dialog |
|
201 |
* @return an array whit the files selecteds or null. |
|
202 |
* |
|
203 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean) |
|
204 |
*/ |
|
205 |
public File[] showOpenDirectoryDialog(String title, File initialPath) ; |
|
206 |
|
|
207 |
/** |
|
208 |
* Creates and show a JFileChooser dialog for selection a file for open. |
|
209 |
* |
|
210 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call. |
|
211 |
* |
|
212 |
* @param title, title of dialog |
|
213 |
* @param initialPath, to show in the dialog |
|
214 |
* @return an array whit the files selecteds or null. |
|
215 |
* |
|
216 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean) |
|
217 |
*/ |
|
218 |
public File[] showOpenFileDialog(String title, File initialPath) ; |
|
219 |
|
|
220 |
/** |
|
221 |
* Creates and show a JFileChooser dialog for selection a file for save. |
|
222 |
* |
|
223 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call. |
|
224 |
* |
|
225 |
* @param title, title of dialog |
|
226 |
* @param initialPath, to show in the dialog |
|
227 |
* @return an array whit the files selecteds or null. |
|
228 |
* |
|
229 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean) |
|
230 |
*/ |
|
231 |
public File[] showSaveFileDialog(String title, File initialPath) ; |
|
232 |
|
|
47 |
public void showDialog(final Component contents, final String title); |
|
233 | 48 |
} |
Also available in: Unified diff