Revision 38806 branches/v2_0_0_prep/extensions/org.gvsig.symbology.app/org.gvsig.symbology.app.importsymbols/src/main/java/org/gvsig/symbology/app/importsymbols/ImportPictureMarkerSymbolsPanel.java
ImportPictureMarkerSymbolsPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.symbology.app.importsymbols; |
2 | 2 |
|
3 |
import java.awt.Component; |
|
4 |
import java.awt.Container; |
|
3 | 5 |
import java.awt.event.ActionEvent; |
4 | 6 |
import java.awt.event.ActionListener; |
5 | 7 |
import java.io.File; |
... | ... | |
8 | 10 |
import java.util.Arrays; |
9 | 11 |
import java.util.List; |
10 | 12 |
|
13 |
import javax.swing.AbstractButton; |
|
11 | 14 |
import javax.swing.ComboBoxModel; |
15 |
import javax.swing.JButton; |
|
12 | 16 |
import javax.swing.JFileChooser; |
17 |
import javax.swing.JLabel; |
|
13 | 18 |
import javax.swing.JOptionPane; |
19 |
import javax.swing.JTextArea; |
|
20 |
import javax.swing.JTextField; |
|
14 | 21 |
import javax.swing.ListModel; |
15 | 22 |
import javax.swing.SpinnerNumberModel; |
16 | 23 |
import javax.swing.event.ListDataListener; |
17 | 24 |
import javax.swing.event.ListSelectionEvent; |
18 | 25 |
import javax.swing.event.ListSelectionListener; |
19 | 26 |
import javax.swing.filechooser.FileFilter; |
27 |
import javax.swing.text.JTextComponent; |
|
20 | 28 |
|
21 | 29 |
import org.apache.commons.io.FilenameUtils; |
22 | 30 |
import org.gvsig.app.ApplicationLocator; |
... | ... | |
76 | 84 |
} |
77 | 85 |
} |
78 | 86 |
|
87 |
private void translate(Container container) { |
|
88 |
for (int n = 0; n < container.getComponentCount(); n++) { |
|
89 |
Component component = container.getComponent(n); |
|
90 |
try { |
|
91 |
if (component instanceof JLabel) { |
|
92 |
JLabel label = (JLabel) component; |
|
93 |
if( label.getText().startsWith("_") ) { |
|
94 |
label.setText(application.translate(label.getText())); |
|
95 |
} |
|
96 |
} else if (component instanceof AbstractButton) { |
|
97 |
AbstractButton button = (AbstractButton) component; |
|
98 |
if( button.getText().startsWith("_") ) { |
|
99 |
button.setText(application.translate(button.getText())); |
|
100 |
} |
|
101 |
} else if (component instanceof JTextComponent) { |
|
102 |
JTextComponent text = (JTextComponent) component; |
|
103 |
if( text.getText().startsWith("_") ) { |
|
104 |
text.setText(application.translate(text.getText())); |
|
105 |
} |
|
106 |
} else if (component instanceof Container) { |
|
107 |
translate((Container) component); |
|
108 |
} |
|
109 |
} catch (Throwable e) { |
|
110 |
// Ignore if |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
79 | 115 |
private void initComponents() { |
116 |
translate(this); |
|
80 | 117 |
// ------------------------------------------------------------ |
81 | 118 |
// Image file names |
82 | 119 |
this.ctrlBrowseImagesToImport.addActionListener(new ActionListener() { |
... | ... | |
139 | 176 |
// ------------------------------------------------------------ |
140 | 177 |
// Overwrite options |
141 | 178 |
final OverwriteItem[] overwriteItems = new OverwriteItem[] { |
142 |
new OverwriteItem(application.translate("_Ask_to_the user"), YesNoAsk.ASK),
|
|
179 |
new OverwriteItem(application.translate("_Ask_to_the_user"), YesNoAsk.ASK),
|
|
143 | 180 |
new OverwriteItem(application.translate("_Dont_overwrite"), YesNoAsk.NO), |
144 | 181 |
new OverwriteItem(application.translate("_Overwrite_always"), YesNoAsk.YES) |
145 | 182 |
}; |
... | ... | |
188 | 225 |
private void doImport() { |
189 | 226 |
if( this.ctrltFolderName.getText().trim().length()==0 ) { |
190 | 227 |
application.messageDialog( |
191 |
application.translate("_Select_a_folder_name"), |
|
228 |
application.translate("_Should_select_a_folder_name"),
|
|
192 | 229 |
this.process.getName(), |
193 | 230 |
JOptionPane.WARNING_MESSAGE); |
194 | 231 |
return; |
195 | 232 |
} |
196 | 233 |
if( this.selectedFiles==null || this.selectedFiles.size()==0 ) { |
197 | 234 |
application.messageDialog( |
198 |
application.translate("_Select_images"),
|
|
235 |
application.translate("_Should_select_the_images_to_import"),
|
|
199 | 236 |
this.process.getName(), |
200 | 237 |
JOptionPane.WARNING_MESSAGE); |
201 | 238 |
return; |
... | ... | |
217 | 254 |
JFileChooser fc = new JFileChooser(); |
218 | 255 |
fc.setFileFilter(filter); |
219 | 256 |
fc.setMultiSelectionEnabled(multiselect); |
220 |
int r = fc.showDialog(application.getRootComponent(), application.translate("_Select_symbols"));
|
|
257 |
int r = fc.showDialog(application.getRootComponent(),title);
|
|
221 | 258 |
if( r == JFileChooser.APPROVE_OPTION ) { |
222 | 259 |
return Arrays.asList(fc.getSelectedFiles()); |
223 | 260 |
} |
... | ... | |
225 | 262 |
} |
226 | 263 |
|
227 | 264 |
private void doBrowseImagesToImport() { |
228 |
List<File> files = fileChooser(application.translate("_Select_symbols"), true, new FileFilter() {
|
|
265 |
List<File> files = fileChooser(application.translate("_Select_the_images"), true, new FileFilter() {
|
|
229 | 266 |
public String getDescription() { |
230 | 267 |
StringBuffer buffer = new StringBuffer(); |
231 | 268 |
List<String> extensions = new ArrayList<String>(); |
Also available in: Unified diff