svn-gvsig-desktop / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / ui / mdiFrame / ThreadSafeDialogs.java @ 39484
History | View | Annotate | Download (6.79 KB)
1 |
package org.gvsig.andami.ui.mdiFrame; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.io.File; |
5 |
import javax.swing.filechooser.FileFilter; |
6 |
|
7 |
public interface ThreadSafeDialogs { |
8 |
|
9 |
/**
|
10 |
* Create a message dialog with an ok button.
|
11 |
*
|
12 |
* If message or title start whit a "_" then try to translate.
|
13 |
*
|
14 |
* This method is thread safe to use.
|
15 |
*
|
16 |
* @param message to present in the dialog
|
17 |
* @param title title of the dialog
|
18 |
* @param messageType type of icon to use.
|
19 |
*
|
20 |
* @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int)
|
21 |
*/
|
22 |
public void messageDialog(String message, String title, int messageType); |
23 |
|
24 |
/**
|
25 |
* Create a message dialog with ok button.
|
26 |
*
|
27 |
* If message or title start whit a "_" then try to translate.
|
28 |
* if messageArgs not is null the message can be formated whit MessageFormat.
|
29 |
*
|
30 |
* This method is thread safe to use.
|
31 |
*
|
32 |
* @param message to present in the dialog
|
33 |
* @param messageArgs string array of arguments used to format the message
|
34 |
* @param title title of the dialog
|
35 |
* @param messageType type of icon to use.
|
36 |
*
|
37 |
* @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int)
|
38 |
*/
|
39 |
public void messageDialog(String message, String messageArgs[], String title, int messageType); |
40 |
|
41 |
/**
|
42 |
* Show a JOptionPane confirm dialog.
|
43 |
*
|
44 |
* if this method is invoked out of the event dispatch thread of swing,
|
45 |
* the dialog is presented in the thread of swing and the calling thread
|
46 |
* wait to close to continue.
|
47 |
*
|
48 |
* @param message
|
49 |
* @param title
|
50 |
* @param optionType
|
51 |
* @param messageType
|
52 |
* @return
|
53 |
*
|
54 |
* @see javax.swing.JOptionPane#showConfirmDialog(Component, Object, String, int, int)
|
55 |
*
|
56 |
*/
|
57 |
public int confirmDialog(String message, String title, int optionType, int messageType) ; |
58 |
|
59 |
/**
|
60 |
* Show a JOptionPane input dialog.
|
61 |
*
|
62 |
* if this method is invoked out of the event dispatch thread of swing,
|
63 |
* the dialog is presented in the thread of swing and the calling thread
|
64 |
* wait to close to continue.
|
65 |
*
|
66 |
* @param message
|
67 |
* @param title
|
68 |
* @param optionType
|
69 |
* @param messageType
|
70 |
* @return
|
71 |
*
|
72 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int)
|
73 |
*
|
74 |
*/
|
75 |
public String inputDialog(String message, String title, int messageType, String initialValue) ; |
76 |
|
77 |
/**
|
78 |
* Show a JOptionPane input dialog.
|
79 |
*
|
80 |
* if this method is invoked out of the event dispatch thread of swing,
|
81 |
* the dialog is presented in the thread of swing and the calling thread
|
82 |
* wait to close to continue.
|
83 |
*
|
84 |
* @param message
|
85 |
* @param title
|
86 |
* @param optionType
|
87 |
* @param messageType
|
88 |
* @return
|
89 |
*
|
90 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int)
|
91 |
*
|
92 |
*/
|
93 |
public String inputDialog(String message, String title); |
94 |
|
95 |
/**
|
96 |
* Create a window with the contents and title specified as parameters
|
97 |
* and show as a dialog windows of gvSIG.
|
98 |
*
|
99 |
* if this method is invoked out of the event dispatch thread of swing,
|
100 |
* the dialog is presented in the thread of swing and the calling thread
|
101 |
* wait to close to continue. in this case the dialog is not presented as modal to
|
102 |
* other components of the gui.
|
103 |
*
|
104 |
* @param contents
|
105 |
* @param title
|
106 |
*/
|
107 |
public void showDialog(final Component contents, final String title); |
108 |
|
109 |
/**
|
110 |
* Creates an return a new instance of the component specified
|
111 |
*
|
112 |
* This method ensure that the component is created in the event dispatch thread of swing.
|
113 |
*
|
114 |
* @param theClass of component to be created
|
115 |
* @param parameters passed to the constructor of the component
|
116 |
*
|
117 |
* @return the instance of the component created
|
118 |
*/
|
119 |
public Component createComponent(final Class<? extends Component> theClass, final Object ... parameters); |
120 |
|
121 |
/**
|
122 |
* Creates an return a new instance of the component specified
|
123 |
*
|
124 |
* This method ensure that the component is created in the event dispatch thread of swing.
|
125 |
*
|
126 |
* @param theClass of component to be created
|
127 |
* @param parameters passed to the constructor of the component
|
128 |
*
|
129 |
* @return the instance of the component created
|
130 |
*/
|
131 |
public Component createComponentWithParams(final Class<? extends Component> theClass, final Object[] parameters); |
132 |
|
133 |
/**
|
134 |
* Creates and show a JFileChooser dialog.
|
135 |
*
|
136 |
* This method return an array whit the selected files. If multiselection is
|
137 |
* not allowed, an array with one element is returned.
|
138 |
*
|
139 |
* If the user select the cancel button, null is returned.
|
140 |
*
|
141 |
* if this method is invoked out of the event dispatch thread of swing,
|
142 |
* the dialog is presented in the thread of swing and the calling thread
|
143 |
* wait to close to continue.
|
144 |
*
|
145 |
* @param title, title of dialog
|
146 |
* @param type of the dialog, JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOG
|
147 |
* @param selectionMode of the dialog, values are: JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES
|
148 |
* @param multiselection, true if multiselection is allowed
|
149 |
* @param inihelpertialPath, to show in the dialog
|
150 |
* @param filter used to filter the files show in the dialog.
|
151 |
* @param fileHidingEnabled, if true hidden files are show
|
152 |
* @return an array whit the files selecteds or null.
|
153 |
*/
|
154 |
public File[] showChooserDialog( |
155 |
final String title, |
156 |
final int type, |
157 |
final int selectionMode, |
158 |
final boolean multiselection, |
159 |
final File inihelpertialPath, |
160 |
final FileFilter filter, |
161 |
final boolean fileHidingEnabled |
162 |
) ; |
163 |
|
164 |
/**
|
165 |
* Creates and show a JFileChooser dialog for folder selection.
|
166 |
*
|
167 |
* This is an utility method that wrap a showChooserDialog call.
|
168 |
*
|
169 |
* @param title, title of dialog
|
170 |
* @param initialPath, to show in the dialog
|
171 |
* @return an array whit the files selecteds or null.
|
172 |
*
|
173 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
|
174 |
*/
|
175 |
public File[] showOpenDirectoryDialog(String title, File initialPath) ; |
176 |
|
177 |
/**
|
178 |
* Creates and show a JFileChooser dialog for selection a file for open.
|
179 |
*
|
180 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call.
|
181 |
*
|
182 |
* @param title, title of dialog
|
183 |
* @param initialPath, to show in the dialog
|
184 |
* @return an array whit the files selecteds or null.
|
185 |
*
|
186 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
|
187 |
*/
|
188 |
public File[] showOpenFileDialog(String title, File initialPath) ; |
189 |
|
190 |
/**
|
191 |
* Creates and show a JFileChooser dialog for selection a file for save.
|
192 |
*
|
193 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call.
|
194 |
*
|
195 |
* @param title, title of dialog
|
196 |
* @param initialPath, to show in the dialog
|
197 |
* @return an array whit the files selecteds or null.
|
198 |
*
|
199 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
|
200 |
*/
|
201 |
public File[] showSaveFileDialog(String title, File initialPath) ; |
202 |
|
203 |
} |