svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / ui / mdiFrame / ThreadSafeDialogs.java @ 41940
History | View | Annotate | Download (8.16 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.andami.ui.mdiFrame; |
25 |
|
26 |
import java.awt.Component; |
27 |
import java.io.File; |
28 |
import javax.swing.filechooser.FileFilter; |
29 |
|
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 |
|
64 |
/**
|
65 |
* Show a JOptionPane confirm dialog.
|
66 |
*
|
67 |
* if this method is invoked out of the event dispatch thread of swing,
|
68 |
* the dialog is presented in the thread of swing and the calling thread
|
69 |
* wait to close to continue.
|
70 |
*
|
71 |
* @param message
|
72 |
* @param title
|
73 |
* @param optionType
|
74 |
* @param messageType
|
75 |
* @return
|
76 |
*
|
77 |
* @see javax.swing.JOptionPane#showConfirmDialog(Component, Object, String, int, int)
|
78 |
*
|
79 |
*/
|
80 |
public int confirmDialog(String message, String title, int optionType, int messageType) ; |
81 |
|
82 |
/**
|
83 |
* Show a JOptionPane input dialog.
|
84 |
*
|
85 |
* if this method is invoked out of the event dispatch thread of swing,
|
86 |
* the dialog is presented in the thread of swing and the calling thread
|
87 |
* wait to close to continue.
|
88 |
*
|
89 |
* @param message
|
90 |
* @param title
|
91 |
* @param optionType
|
92 |
* an integer designating the options available on the dialog:
|
93 |
* YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION
|
94 |
* @param messageType
|
95 |
* an integer designating the kind of message this is;
|
96 |
* primarily used to determine the icon from the pluggable
|
97 |
* Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE,
|
98 |
* WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
|
99 |
* @return
|
100 |
*
|
101 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int)
|
102 |
*
|
103 |
*/
|
104 |
public String inputDialog(String message, String title, int messageType, String initialValue) ; |
105 |
|
106 |
/**
|
107 |
* Show a JOptionPane input dialog.
|
108 |
*
|
109 |
* if this method is invoked out of the event dispatch thread of swing,
|
110 |
* the dialog is presented in the thread of swing and the calling thread
|
111 |
* wait to close to continue.
|
112 |
*
|
113 |
* @param message
|
114 |
* @param title
|
115 |
* @param optionType
|
116 |
* @param messageType
|
117 |
* @return
|
118 |
*
|
119 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int)
|
120 |
*
|
121 |
*/
|
122 |
public String inputDialog(String message, String title); |
123 |
|
124 |
/**
|
125 |
* Create a window with the contents and title specified as parameters
|
126 |
* and show as a dialog windows of gvSIG.
|
127 |
*
|
128 |
* if this method is invoked out of the event dispatch thread of swing,
|
129 |
* the dialog is presented in the thread of swing and the calling thread
|
130 |
* wait to close to continue. in this case the dialog is not presented as modal to
|
131 |
* other components of the gui.
|
132 |
*
|
133 |
* @param contents
|
134 |
* @param title
|
135 |
*/
|
136 |
public void showDialog(final Component contents, final String title); |
137 |
|
138 |
/**
|
139 |
* Creates an return a new instance of the component specified
|
140 |
*
|
141 |
* This method ensure that the component is created in the event dispatch thread of swing.
|
142 |
*
|
143 |
* @param theClass of component to be created
|
144 |
* @param parameters passed to the constructor of the component
|
145 |
*
|
146 |
* @return the instance of the component created
|
147 |
*/
|
148 |
public Component createComponent(final Class<? extends Component> theClass, final Object ... parameters); |
149 |
|
150 |
/**
|
151 |
* Creates an return a new instance of the component specified
|
152 |
*
|
153 |
* This method ensure that the component is created in the event dispatch thread of swing.
|
154 |
*
|
155 |
* @param theClass of component to be created
|
156 |
* @param parameters passed to the constructor of the component
|
157 |
*
|
158 |
* @return the instance of the component created
|
159 |
*/
|
160 |
public Component createComponentWithParams(final Class<? extends Component> theClass, final Object[] parameters); |
161 |
|
162 |
/**
|
163 |
* Creates and show a JFileChooser dialog.
|
164 |
*
|
165 |
* This method return an array whit the selected files. If multiselection is
|
166 |
* not allowed, an array with one element is returned.
|
167 |
*
|
168 |
* If the user select the cancel button, null is returned.
|
169 |
*
|
170 |
* if this method is invoked out of the event dispatch thread of swing,
|
171 |
* the dialog is presented in the thread of swing and the calling thread
|
172 |
* wait to close to continue.
|
173 |
*
|
174 |
* @param title, title of dialog
|
175 |
* @param type of the dialog, JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOG
|
176 |
* @param selectionMode of the dialog, values are: JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES
|
177 |
* @param multiselection, true if multiselection is allowed
|
178 |
* @param initialPath, to show in the dialog
|
179 |
* @param filter used to filter the files show in the dialog.
|
180 |
* @param fileHidingEnabled, if true hidden files are show
|
181 |
* @return an array whit the files selecteds or null.
|
182 |
*/
|
183 |
public File[] showChooserDialog( |
184 |
final String title, |
185 |
final int type, |
186 |
final int selectionMode, |
187 |
final boolean multiselection, |
188 |
final File initialPath, |
189 |
final FileFilter filter, |
190 |
final boolean fileHidingEnabled |
191 |
) ; |
192 |
|
193 |
/**
|
194 |
* Creates and show a JFileChooser dialog for folder selection.
|
195 |
*
|
196 |
* This is an utility method that wrap a showChooserDialog call.
|
197 |
*
|
198 |
* @param title, title of dialog
|
199 |
* @param initialPath, to show in the dialog
|
200 |
* @return an array whit the files selecteds or null.
|
201 |
*
|
202 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
|
203 |
*/
|
204 |
public File[] showOpenDirectoryDialog(String title, File initialPath) ; |
205 |
|
206 |
/**
|
207 |
* Creates and show a JFileChooser dialog for selection a file for open.
|
208 |
*
|
209 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call.
|
210 |
*
|
211 |
* @param title, title of dialog
|
212 |
* @param initialPath, to show in the dialog
|
213 |
* @return an array whit the files selecteds or null.
|
214 |
*
|
215 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
|
216 |
*/
|
217 |
public File[] showOpenFileDialog(String title, File initialPath) ; |
218 |
|
219 |
/**
|
220 |
* Creates and show a JFileChooser dialog for selection a file for save.
|
221 |
*
|
222 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call.
|
223 |
*
|
224 |
* @param title, title of dialog
|
225 |
* @param initialPath, to show in the dialog
|
226 |
* @return an array whit the files selecteds or null.
|
227 |
*
|
228 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
|
229 |
*/
|
230 |
public File[] showSaveFileDialog(String title, File initialPath) ; |
231 |
|
232 |
} |