Revision 42754 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/filesystem/swing/FilesystemExplorerAddLayerWizardPanel.java
FilesystemExplorerAddLayerWizardPanel.java | ||
---|---|---|
28 | 28 |
import java.awt.GridLayout; |
29 | 29 |
import java.awt.Window; |
30 | 30 |
import java.awt.event.ActionEvent; |
31 |
import java.awt.event.ActionListener; |
|
31 | 32 |
|
32 | 33 |
import javax.swing.JLabel; |
33 | 34 |
import javax.swing.JList; |
... | ... | |
35 | 36 |
import javax.swing.ListCellRenderer; |
36 | 37 |
import javax.swing.ListModel; |
37 | 38 |
import javax.swing.UIDefaults; |
39 |
import org.apache.commons.lang3.StringUtils; |
|
38 | 40 |
|
39 | 41 |
import org.cresques.cts.IProjection; |
40 | 42 |
import org.slf4j.Logger; |
41 | 43 |
import org.slf4j.LoggerFactory; |
42 | 44 |
|
43 | 45 |
import org.gvsig.andami.messages.Messages; |
46 |
import org.gvsig.app.ApplicationLocator; |
|
44 | 47 |
import org.gvsig.app.prepareAction.PrepareContext; |
45 | 48 |
import org.gvsig.app.prepareAction.PrepareContextView; |
46 | 49 |
import org.gvsig.fmap.dal.DataStore; |
... | ... | |
49 | 52 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
50 | 53 |
import org.gvsig.fmap.mapcontrol.MapControl; |
51 | 54 |
import org.gvsig.fmap.mapcontrol.swing.dynobject.DynObjectEditor; |
55 |
import org.gvsig.tools.ToolsLocator; |
|
52 | 56 |
import org.gvsig.tools.dynobject.DynField; |
53 | 57 |
import org.gvsig.tools.dynobject.DynObject; |
54 | 58 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
59 |
import org.gvsig.tools.i18n.I18nManager; |
|
55 | 60 |
import org.gvsig.tools.service.ServiceException; |
61 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
62 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
63 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
64 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
56 | 65 |
|
57 | 66 |
/** |
58 | 67 |
* @author jmvivo |
... | ... | |
87 | 96 |
IProjection proj = this.getMapCtrl().getProjection(); |
88 | 97 |
|
89 | 98 |
// Buscamos por el parametro de la proyeccion |
90 |
// que sean obligatorios y est?n a null
|
|
99 |
// que sean obligatorios y estén a null
|
|
91 | 100 |
// y le ponemos la proyeccion de la vista |
92 | 101 |
DynField[] fields = params.getDynClass().getDynFields(); |
93 | 102 |
for (DynField field : fields) { |
... | ... | |
109 | 118 |
public void actionPerformed(ActionEvent e) { |
110 | 119 |
|
111 | 120 |
String command = e.getActionCommand(); |
112 |
FilesystemStoreListModel model |
|
113 |
= (FilesystemStoreListModel) getFileList().getModel(); |
|
121 |
FilesystemStoreListModel model = (FilesystemStoreListModel) getFileList().getModel(); |
|
114 | 122 |
|
115 | 123 |
if (EDIT_COMMAND.equalsIgnoreCase(command)) { |
116 |
DynObject dynObject |
|
117 |
= model.getDynObjectAt(getFileList().getSelectedIndex()); |
|
124 |
showPropertiesDialog(model.getDynObjectAt(getFileList().getSelectedIndex())); |
|
125 |
} else { |
|
126 |
super.actionPerformed(e); |
|
127 |
} |
|
128 |
} |
|
118 | 129 |
|
119 |
// For store parameters with a CRS field, add the current view |
|
120 |
// CRS as default value when null. |
|
121 |
try { |
|
122 |
IProjection projection |
|
123 |
= (IProjection) dynObject.getDynValue("CRS"); |
|
124 |
if (projection == null) { |
|
125 |
projection = getDefaultProjection(); |
|
126 |
dynObject.setDynValue("CRS", projection); |
|
127 |
} |
|
128 |
} catch (DynFieldNotFoundException e1) { |
|
129 |
LOG.debug("Loading a store whose parameters " |
|
130 |
+ "don't have a CRS field"); |
|
130 |
private void showPropertiesDialog(final DynObject parameters) { |
|
131 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
132 |
|
|
133 |
// For store parameters with a CRS field, add the current view |
|
134 |
// CRS as default value when null. |
|
135 |
try { |
|
136 |
IProjection projection = (IProjection) parameters.getDynValue("CRS"); |
|
137 |
if (projection == null) { |
|
138 |
projection = getDefaultProjection(); |
|
139 |
parameters.setDynValue("CRS", projection); |
|
131 | 140 |
} |
141 |
} catch (DynFieldNotFoundException e1) { |
|
142 |
LOG.info("Loading a store whose parameters don't have a CRS field"); |
|
143 |
} |
|
132 | 144 |
|
133 |
try { |
|
134 |
DynObjectEditor editor = new DynObjectEditor(dynObject); |
|
135 |
editor.editObject(true); |
|
136 |
} catch (ServiceException ex) { |
|
137 |
LOG.error( |
|
138 |
"Error creating a Swing component for the DynObject: " |
|
139 |
+ dynObject, ex); |
|
140 |
} |
|
141 |
|
|
142 |
// force repaint |
|
143 |
ListModel lm = this.getFileList().getModel(); |
|
144 |
if (lm instanceof FilesystemStoreListModel) { |
|
145 |
FilesystemStoreListModel mm = (FilesystemStoreListModel) lm; |
|
146 |
mm.forceUpdate(getFileList().getSelectedIndex()); |
|
147 |
} |
|
148 |
|
|
149 |
} else { |
|
150 |
super.actionPerformed(e); |
|
145 |
FilesystemExplorerPropertiesPanelManager manager = ApplicationLocator.getFilesystemExplorerPropertiesPanelManager(); |
|
146 |
manager.showPropertiesDialog(parameters); |
|
147 |
|
|
148 |
// force repaint |
|
149 |
ListModel lm = this.getFileList().getModel(); |
|
150 |
if (lm instanceof FilesystemStoreListModel) { |
|
151 |
FilesystemStoreListModel mm = (FilesystemStoreListModel) lm; |
|
152 |
mm.forceUpdate(getFileList().getSelectedIndex()); |
|
151 | 153 |
} |
152 | 154 |
} |
153 | 155 |
|
Also available in: Unified diff