Revision 1756 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutMainExtension.java
LayoutMainExtension.java | ||
---|---|---|
27 | 27 |
import java.io.FileInputStream; |
28 | 28 |
import java.io.IOException; |
29 | 29 |
import java.util.Iterator; |
30 |
import java.util.prefs.Preferences; |
|
31 | 30 |
import javax.swing.JOptionPane; |
31 |
import javax.swing.JPanel; |
|
32 | 32 |
import org.gvsig.andami.IconThemeHelper; |
33 | 33 |
import org.gvsig.andami.PluginServices; |
34 | 34 |
import org.gvsig.andami.plugins.Extension; |
... | ... | |
92 | 92 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameTextDialog; |
93 | 93 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameViewDialog; |
94 | 94 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
95 |
import org.gvsig.filedialogchooser.FileDialogChooser; |
|
96 |
import org.gvsig.filedialogchooser.FileDialogChooserManager; |
|
95 | 97 |
import org.gvsig.gui.beans.swing.JFileChooser; |
96 | 98 |
import org.gvsig.i18n.Messages; |
97 | 99 |
import org.gvsig.layout.mapbox.MapBoxUtils; |
... | ... | |
111 | 113 |
import org.gvsig.tools.persistence.PersistenceManager; |
112 | 114 |
import org.gvsig.tools.persistence.PersistentState; |
113 | 115 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
116 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
114 | 117 |
import org.gvsig.utils.GenericFileFilter; |
115 | 118 |
import org.slf4j.Logger; |
116 | 119 |
import org.slf4j.LoggerFactory; |
... | ... | |
205 | 208 |
private void openLayout() { |
206 | 209 |
LayoutPanel layout = null; |
207 | 210 |
|
208 |
if (templatesPath == null) { |
|
209 |
Preferences prefs = Preferences.userRoot().node("gvsig.foldering"); |
|
210 |
templatesPath = prefs.get("TemplatesFolder", null); |
|
211 |
} |
|
211 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
212 |
FileDialogChooserManager manager = ToolsUtilLocator.getFileDialogChooserManager(); |
|
213 |
FileDialogChooser fc = manager.create("_Last_layout_template_folder"); |
|
214 |
GenericFileFilter layoutMainFilter = new GenericFileFilter( |
|
215 |
LayoutManager.TEMPLATE_FILE_POINTEXT, |
|
216 |
i18n.getTranslation("_Layout_template") + " (*" |
|
217 |
+ LayoutManager.TEMPLATE_FILE_POINTEXT + ")"); |
|
212 | 218 |
|
213 |
JFileChooser jfc = new JFileChooser(LAYOUT_TEMPLATE_FILECHOOSER_ID, |
|
214 |
templatesPath); |
|
215 |
GenericFileFilter layoutMainExtensionFilter = new GenericFileFilter( |
|
216 |
LayoutManager.TEMPLATE_FILE_POINTEXT, |
|
217 |
Messages.getText("_Layout_template") + " (*" |
|
218 |
+ LayoutManager.TEMPLATE_FILE_POINTEXT + ")"); |
|
219 |
jfc.addChoosableFileFilter(layoutMainExtensionFilter); |
|
220 |
jfc.setFileFilter(layoutMainExtensionFilter); |
|
219 |
fc.addChoosableFileFilter(layoutMainFilter); |
|
220 |
fc.setFileFilter(layoutMainFilter); |
|
221 |
ApplicationManager application = ApplicationLocator.getApplicationManager(); |
|
222 |
|
|
223 |
File projectfile = application.getCurrentProject().getFile(); |
|
221 | 224 |
|
222 |
if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) { |
|
223 |
File file = jfc.getSelectedFile(); |
|
225 |
JPanel accesory = new LayoutExtension.AccesoryPanelForTemplates(projectfile, fc); |
|
226 |
fc.setAccessory(accesory); |
|
227 |
|
|
228 |
if (fc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) { |
|
229 |
File file = fc.getSelectedFile(); |
|
224 | 230 |
try { |
225 | 231 |
if (!file.exists()) { |
226 | 232 |
/* |
Also available in: Unified diff