Revision 32370
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/.classpath | ||
---|---|---|
76 | 76 |
<classpathentry kind="src" path="/libFMap_dal"/> |
77 | 77 |
<classpathentry kind="src" path="/libFMap_dalfile"/> |
78 | 78 |
<classpathentry kind="src" path="/libFMap_dalindex"/> |
79 |
<classpathentry kind="src" path="/libFMap_dalRaster"/> |
|
80 | 79 |
<classpathentry kind="src" path="/libFMap_geometries"/> |
81 | 80 |
<classpathentry kind="src" path="/libFMap_mapcontext"/> |
82 | 81 |
<classpathentry kind="src" path="/libInternationalization"/> |
... | ... | |
91 | 90 |
<classpathentry kind="src" path="/libMetadata"/> |
92 | 91 |
<classpathentry kind="src" path="/libProjection"/> |
93 | 92 |
<classpathentry kind="src" path="/libRaster"/> |
94 |
<classpathentry kind="src" path="/libRaster_io"/> |
|
95 |
<classpathentry kind="src" path="/extRasterTools-SE"/> |
|
96 | 93 |
<classpathentry kind="src" path="/libRemoteServices"/> |
97 | 94 |
<classpathentry kind="src" path="/org.gvsig.symbology"/> |
98 | 95 |
<classpathentry kind="src" path="/libTools"/> |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/.project | ||
---|---|---|
12 | 12 |
<project>libFMap_dal</project> |
13 | 13 |
<project>libFMap_dalfile</project> |
14 | 14 |
<project>libFMap_dalindex</project> |
15 |
<project>libFMap_dalRaster</project> |
|
16 | 15 |
<project>libFMap_geometries</project> |
17 | 16 |
<project>libFMap_mapcontext</project> |
18 | 17 |
<project>libInternationalization</project> |
19 | 18 |
<project>libMetadata</project> |
20 | 19 |
<project>libProjection</project> |
21 | 20 |
<project>libRaster</project> |
22 |
<project>libRaster_io</project> |
|
23 |
<project>extRasterTools-SE</project> |
|
24 | 21 |
<project>libRemoteServices</project> |
25 | 22 |
<project>org.gvsig.symbology</project> |
26 | 23 |
<project>libTools</project> |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/ArcimsFeatureExtension.java | ||
---|---|---|
31 | 31 |
import org.gvsig.andami.plugins.Extension; |
32 | 32 |
import org.gvsig.app.extension.AddLayer; |
33 | 33 |
import org.gvsig.arcims.feature.gui.wizards.ArcImsFeatureWizard; |
34 |
import org.gvsig.fmap.dal.store.arcims.ArcImsLibrary; |
|
35 |
import org.gvsig.tools.library.Library; |
|
34 | 36 |
|
35 | 37 |
/** |
36 | 38 |
* This class implements the extension to access ArcIMS servers. |
37 | 39 |
* |
38 | 40 |
* @author jldominguez |
41 |
* @author vsanjaime version 2.0 |
|
39 | 42 |
* |
40 | 43 |
*/ |
41 | 44 |
public class ArcimsFeatureExtension extends Extension { |
... | ... | |
44 | 47 |
* right-click popup menus to the gvSIG resources. |
45 | 48 |
*/ |
46 | 49 |
public void initialize() { |
50 |
|
|
51 |
// Initialize ArcIMS Library |
|
52 |
Library lib = new ArcImsLibrary(); |
|
53 |
lib.postInitialize(); |
|
54 |
|
|
47 | 55 |
// must add menus and a new tab to the wizard.. |
48 | 56 |
AddLayer.addWizard(ArcImsFeatureWizard.class); |
57 |
|
|
49 | 58 |
// to create an arcims layer |
50 | 59 |
// FPopupMenu.addEntry(new ArcImsPropsTocMenuEntry()); |
51 | 60 |
// // FPopupMenu.addEntry(new ArcImsRasterPropsTocMenuEntry()); |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/fmap/datasource/ArcImsFeatureWizardData.java | ||
---|---|---|
65 | 65 |
*/ |
66 | 66 |
private ArcImsStatus status; |
67 | 67 |
private String testInfo; |
68 |
private String serviceType; |
|
69 |
private FMapFeatureArcImsDriver arcImsFeatureDriver = null; |
|
68 |
private String serviceType; |
|
70 | 69 |
private boolean missingSrs = false; |
71 | 70 |
private MapControl mapControl; |
72 | 71 |
private MyCancellable myCanc; |
73 | 72 |
|
74 | 73 |
public ArcImsFeatureWizardData() { |
75 |
myCanc = new MyCancellable(new DefaultCancellableMonitorable());
|
|
74 |
//TODO
|
|
76 | 75 |
} |
77 | 76 |
|
77 |
/** |
|
78 |
* |
|
79 |
* @param host |
|
80 |
* @param service |
|
81 |
* @param svcType |
|
82 |
* @throws Exception |
|
83 |
*/ |
|
78 | 84 |
public void setHostService(URL host, String service, String svcType) |
79 | 85 |
throws Exception { |
80 | 86 |
serviceType = svcType; |
... | ... | |
83 | 89 |
|
84 | 90 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
85 | 91 |
nogood = false; |
86 |
arcImsFeatureDriver = new FMapFeatureArcImsDriver(host.toString(), |
|
87 |
service, svcType); |
|
92 |
//TODO |
|
88 | 93 |
|
89 |
// Send a getCapabilities request; |
|
90 |
if (!arcImsFeatureDriver.connect(myCanc)) { |
|
91 |
Exception de = new Exception("cant_connect"); |
|
92 |
logger.error("While trying to connect ", de); |
|
93 |
throw de; |
|
94 |
} |
|
95 |
|
|
96 | 94 |
testInfo = "Connected successfully."; |
97 | 95 |
} |
98 | 96 |
|
... | ... | |
101 | 99 |
} |
102 | 100 |
} |
103 | 101 |
|
102 |
/** |
|
103 |
* |
|
104 |
* @param host |
|
105 |
* @param service |
|
106 |
* @param svcType |
|
107 |
* @param lyr |
|
108 |
* @throws Exception |
|
109 |
*/ |
|
104 | 110 |
public void setHostService(URL host, String service, String svcType, |
105 | 111 |
FLayer lyr) throws Exception { |
106 | 112 |
serviceType = svcType; |
... | ... | |
110 | 116 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
111 | 117 |
nogood = false; |
112 | 118 |
|
113 |
// arcImsFeatureDriver = new |
|
114 |
// FMapFeatureArcImsDriver(host.toString(), service, svcType); |
|
115 |
arcImsFeatureDriver = (FMapFeatureArcImsDriver) ((FFeatureLyrArcIMS) lyr) |
|
116 |
.getSource().getDriver(); |
|
119 |
//TODO |
|
117 | 120 |
|
118 |
// Send a getCapabilities request; |
|
119 |
if (!arcImsFeatureDriver.connect(myCanc)) { |
|
120 |
Exception de = new DriverException("cant_connect"); |
|
121 |
logger.error("While trying to connect ", de); |
|
122 |
throw de; |
|
123 |
} |
|
124 |
|
|
125 | 121 |
testInfo = "Connected successfully."; |
126 | 122 |
} |
127 | 123 |
|
... | ... | |
130 | 126 |
} |
131 | 127 |
} |
132 | 128 |
|
129 |
/** |
|
130 |
* Get service type |
|
131 |
* @return |
|
132 |
*/ |
|
133 | 133 |
public String getServiceType() { |
134 | 134 |
return serviceType; |
135 | 135 |
} |
136 | 136 |
|
137 |
/** |
|
138 |
* Set service type |
|
139 |
* @param t |
|
140 |
*/ |
|
137 | 141 |
public void setServiceType(String t) { |
138 | 142 |
serviceType = t; |
139 | 143 |
} |
140 | 144 |
|
141 |
public ArcImsDriver getDriver() { |
|
142 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
143 |
return arcImsFeatureDriver; |
|
144 |
} |
|
145 |
|
|
145 | 146 |
|
146 |
logger.error("Null value returned. Unable to find out serviceType "); |
|
147 |
|
|
148 |
return null; |
|
149 |
} |
|
150 |
|
|
151 |
public void setDriver(ArcImsDriver d) { |
|
152 |
boolean nogood = true; |
|
153 |
|
|
154 |
if (d instanceof FMapFeatureArcImsDriver) { |
|
155 |
arcImsFeatureDriver = (FMapFeatureArcImsDriver) d; |
|
156 |
nogood = false; |
|
157 |
} |
|
158 |
|
|
159 |
if (nogood) { |
|
160 |
logger.error("Nothing done. Unable to find out serviceType "); |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
147 |
/** |
|
148 |
* Get status |
|
149 |
* @return |
|
150 |
*/ |
|
164 | 151 |
public ArcImsStatus getStatus() { |
165 | 152 |
return status; |
166 | 153 |
} |
167 | 154 |
|
155 |
/** |
|
156 |
* Set status |
|
157 |
* @param s |
|
158 |
*/ |
|
168 | 159 |
public void setStatus(ArcImsStatus s) { |
169 | 160 |
status = s; |
170 | 161 |
} |
... | ... | |
177 | 168 |
public TreeMap getLayers() { |
178 | 169 |
|
179 | 170 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
180 |
return arcImsFeatureDriver.getLayers(); |
|
171 |
// TODo return layers availables |
|
172 |
return null; |
|
181 | 173 |
} |
182 | 174 |
|
183 | 175 |
logger |
... | ... | |
189 | 181 |
return null; |
190 | 182 |
} |
191 | 183 |
|
192 |
|
|
184 |
/** |
|
185 |
* |
|
186 |
* @return |
|
187 |
*/ |
|
193 | 188 |
public String getTestInfo() { |
194 | 189 |
return testInfo; |
195 | 190 |
} |
... | ... | |
340 | 335 |
return missingSrs; |
341 | 336 |
} |
342 | 337 |
|
338 |
/** |
|
339 |
* set SRS |
|
340 |
* @param missingSrs |
|
341 |
*/ |
|
343 | 342 |
public void setMissingSrs(boolean missingSrs) { |
344 | 343 |
this.missingSrs = missingSrs; |
345 | 344 |
} |
346 | 345 |
|
346 |
/** |
|
347 |
* set Mapcontrol |
|
348 |
* @param mapControl |
|
349 |
*/ |
|
347 | 350 |
public void setMapControl(MapControl mapControl) { |
348 | 351 |
this.mapControl = mapControl; |
349 | 352 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/gui/dialogs/LayerScaleDialog.java | ||
---|---|---|
61 | 61 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
62 | 62 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
63 | 63 |
import org.gvsig.app.project.documents.view.gui.IView; |
64 |
import org.gvsig.arcims.feature.fmap.listeners.FRasterLyrArcIMSListener; |
|
65 | 64 |
import org.gvsig.arcims.feature.gui.panels.LayerScaleDrawPanel; |
66 | 65 |
|
67 |
|
|
68 | 66 |
/** |
69 | 67 |
* This class shows the ArcIMS layer's scale limits status. |
70 |
* |
|
68 |
*
|
|
71 | 69 |
* @author jldominguez, vsanjaime |
72 | 70 |
*/ |
73 |
public class LayerScaleDialog extends JPanel implements ActionListener, IWindow,
|
|
74 |
FRasterLyrArcIMSListener {
|
|
75 |
private static final long serialVersionUID = 0;
|
|
76 |
private JPanel button_p;
|
|
77 |
private JButton b;
|
|
78 |
private LayerScaleDrawPanel dp;
|
|
79 |
private FRasterLyrArcIMS layer;
|
|
80 |
private WindowInfo theViewInfo;
|
|
81 |
private JScrollPane sp;
|
|
82 |
private String vistaName;
|
|
83 |
private JLabel southLabel;
|
|
71 |
public class LayerScaleDialog extends JPanel implements ActionListener, |
|
72 |
IWindow, FRasterLyrArcIMSListener {
|
|
73 |
private static final long serialVersionUID = 0;
|
|
74 |
private JPanel button_p;
|
|
75 |
private JButton b;
|
|
76 |
private LayerScaleDrawPanel dp;
|
|
77 |
//private FRasterLyrArcIMS layer;
|
|
78 |
private WindowInfo theViewInfo;
|
|
79 |
private JScrollPane sp;
|
|
80 |
private String vistaName;
|
|
81 |
private JLabel southLabel;
|
|
84 | 82 |
|
85 |
/** |
|
86 |
* Needs the layer as parameter. |
|
87 |
* |
|
88 |
* @param ailyr the layer |
|
89 |
*/ |
|
90 |
public LayerScaleDialog(FRasterLyrArcIMS ailyr, IView view) { |
|
91 |
super(); |
|
92 |
layer = ailyr; |
|
93 |
southLabel = new JLabel(); |
|
83 |
/** |
|
84 |
* Needs the layer as parameter. |
|
85 |
* |
|
86 |
* @param ailyr |
|
87 |
* the layer |
|
88 |
*/ |
|
89 |
// public LayerScaleDialog(FRasterLyrArcIMS ailyr, IView view) { |
|
90 |
// super(); |
|
91 |
// layer = ailyr; |
|
92 |
// southLabel = new JLabel(); |
|
93 |
// |
|
94 |
// if (view != null) { |
|
95 |
// vistaName = ((DefaultViewPanel) view).getName(); |
|
96 |
// } else { |
|
97 |
// vistaName = "Unknown"; |
|
98 |
// } |
|
99 |
// |
|
100 |
// ailyr.addActionlistener(this); |
|
101 |
// ailyr.addNameOrQueryListener(this); |
|
102 |
// |
|
103 |
// Vector infoV = layer.getLayerScaleInfoVector(); |
|
104 |
// int spHeight = 201 + (15 * infoV.size()); |
|
105 |
// |
|
106 |
// if (spHeight > 500) { |
|
107 |
// spHeight = 500; |
|
108 |
// } |
|
109 |
// |
|
110 |
// setLayout(new BorderLayout()); |
|
111 |
// setSize(140 + 680, spHeight + 10); |
|
112 |
// setMinimumSize(new Dimension(410, 226)); |
|
113 |
// |
|
114 |
// b = new JButton(PluginServices.getText(this, "close")); |
|
115 |
// b.setBounds(10, 10, 90, 25); |
|
116 |
// b.addActionListener(this); |
|
117 |
// |
|
118 |
// button_p = new JPanel(); |
|
119 |
// button_p.setLayout(new BorderLayout()); |
|
120 |
// button_p.add(southLabel, BorderLayout.WEST); // setPreferredSize(new |
|
121 |
// // Dimension(10, 5)); |
|
122 |
// // button_p.add(b); |
|
123 |
// |
|
124 |
// dp = new LayerScaleDrawPanel(infoV, this, southLabel); |
|
125 |
// dp.setDpi(ailyr.getArcimsStatus().getServiceInfo().getScreen_dpi()); |
|
126 |
// dp.setCurrentScale(1.0 * layer.getMapContext().getScaleView()); |
|
127 |
// |
|
128 |
// southLabel.setText(PluginServices.getText(this, "Escala") + " 1 : " |
|
129 |
// + getFormattedInteger(Math.round(dp.getCurrentScale()))); |
|
130 |
// |
|
131 |
// dp.setPreferredSize(new Dimension(300, 200 + (15 * infoV.size()))); |
|
132 |
// |
|
133 |
// sp = new JScrollPane(dp); |
|
134 |
// sp |
|
135 |
// .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
|
136 |
// sp |
|
137 |
// .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
138 |
// |
|
139 |
// add(BorderLayout.CENTER, sp); |
|
140 |
// add(BorderLayout.SOUTH, button_p); |
|
141 |
// } |
|
94 | 142 |
|
95 |
if (view != null) { |
|
96 |
vistaName = ((DefaultViewPanel)view).getName(); |
|
97 |
} |
|
98 |
else { |
|
99 |
vistaName = "Unknown"; |
|
100 |
} |
|
143 |
// public void resetDrawingPanel() { |
|
144 |
// Vector infoV = layer.getLayerScaleInfoVector(); |
|
145 |
// dp.resetInfo(infoV); |
|
146 |
// dp.setPreferredSize(new Dimension(300, 200 + (15 * infoV.size()))); |
|
147 |
// dp.repaint(); |
|
148 |
// } |
|
149 |
// |
|
150 |
// public void actionPerformed(ActionEvent arg0) { |
|
151 |
// if (arg0.getActionCommand().compareToIgnoreCase( |
|
152 |
// FRasterLyrArcIMS.SCALE_CHANGED_COMMAND) == 0) { |
|
153 |
// dp.setCurrentScale(1.0 * layer.getScale()); |
|
154 |
// dp.repaint(); |
|
155 |
// |
|
156 |
// return; |
|
157 |
// } |
|
158 |
// |
|
159 |
// if (arg0.getSource() == b) { |
|
160 |
// this.close(); |
|
161 |
// } |
|
162 |
// } |
|
101 | 163 |
|
102 |
ailyr.addActionlistener(this); |
|
103 |
ailyr.addNameOrQueryListener(this); |
|
164 |
public void close() { |
|
165 |
PluginServices.getMDIManager().closeWindow(this); |
|
166 |
} |
|
104 | 167 |
|
105 |
Vector infoV = layer.getLayerScaleInfoVector(); |
|
106 |
int spHeight = 201 + (15 * infoV.size()); |
|
168 |
// public WindowInfo getWindowInfo() { |
|
169 |
// if (theViewInfo == null) { |
|
170 |
// theViewInfo = new WindowInfo(0 + // palette |
|
171 |
// 16 + // no modal |
|
172 |
// 0 + // modal |
|
173 |
// 4 + // iconifiable |
|
174 |
// 2 + // maximizable |
|
175 |
// 1 // resizable |
|
176 |
// ); |
|
177 |
// theViewInfo.setTitle(PluginServices.getText(this, "view") + ": " |
|
178 |
// + vistaName + " - " + PluginServices.getText(this, "layer") |
|
179 |
// + ": " + layer.getName() + " - " |
|
180 |
// + PluginServices.getText(this, "layer_scale_status")); |
|
181 |
// theViewInfo.setWidth(getInitialWidth()); |
|
182 |
// theViewInfo.setHeight(getInitialHeight()); |
|
183 |
// } |
|
184 |
// |
|
185 |
// return theViewInfo; |
|
186 |
// } |
|
107 | 187 |
|
108 |
if (spHeight > 500) { |
|
109 |
spHeight = 500; |
|
110 |
} |
|
188 |
// public FRasterLyrArcIMS getLayer() { |
|
189 |
// return layer; |
|
190 |
// } |
|
191 |
// |
|
192 |
// public void setLayer(FRasterLyrArcIMS layer) { |
|
193 |
// this.layer = layer; |
|
194 |
// } |
|
111 | 195 |
|
112 |
setLayout(new BorderLayout());
|
|
113 |
setSize(140 + 680, spHeight + 10);
|
|
114 |
setMinimumSize(new Dimension(410, 226));
|
|
196 |
private int getInitialWidth() {
|
|
197 |
return 365;
|
|
198 |
}
|
|
115 | 199 |
|
116 |
b = new JButton(PluginServices.getText(this, "close"));
|
|
117 |
b.setBounds(10, 10, 90, 25);
|
|
118 |
b.addActionListener(this);
|
|
200 |
private int getInitialHeight() {
|
|
201 |
return 290 - 35;
|
|
202 |
}
|
|
119 | 203 |
|
120 |
button_p = new JPanel(); |
|
121 |
button_p.setLayout(new BorderLayout()); |
|
122 |
button_p.add(southLabel, BorderLayout.WEST); // setPreferredSize(new Dimension(10, 5)); |
|
123 |
// button_p.add(b); |
|
204 |
// public void thingsHaveChanged(String query, String name) { |
|
205 |
// resetDrawingPanel(); |
|
206 |
// } |
|
124 | 207 |
|
125 |
dp = new LayerScaleDrawPanel(infoV, this, southLabel); |
|
126 |
dp.setDpi(ailyr.getArcimsStatus().getServiceInfo().getScreen_dpi()); |
|
127 |
dp.setCurrentScale(1.0 * layer.getMapContext().getScaleView()); |
|
208 |
public static String getFormattedInteger(int n) { |
|
209 |
DecimalFormat df = new DecimalFormat(); |
|
210 |
df.setGroupingUsed(true); |
|
211 |
df.setGroupingSize(3); |
|
128 | 212 |
|
129 |
southLabel.setText(PluginServices.getText(this, "Escala") + " 1 : " + |
|
130 |
getFormattedInteger(Math.round(dp.getCurrentScale()))); |
|
213 |
DecimalFormatSymbols dfs = new DecimalFormatSymbols(); |
|
214 |
dfs.setGroupingSeparator('.'); |
|
215 |
df.setDecimalFormatSymbols(dfs); |
|
131 | 216 |
|
132 |
dp.setPreferredSize(new Dimension(300, 200 + (15 * infoV.size()))); |
|
217 |
return df.format(n); |
|
218 |
} |
|
133 | 219 |
|
134 |
sp = new JScrollPane(dp); |
|
135 |
sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
|
136 |
sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
137 |
|
|
138 |
add(BorderLayout.CENTER, sp); |
|
139 |
add(BorderLayout.SOUTH, button_p); |
|
140 |
} |
|
141 |
|
|
142 |
public void resetDrawingPanel() { |
|
143 |
Vector infoV = layer.getLayerScaleInfoVector(); |
|
144 |
dp.resetInfo(infoV); |
|
145 |
dp.setPreferredSize(new Dimension(300, 200 + (15 * infoV.size()))); |
|
146 |
dp.repaint(); |
|
147 |
} |
|
148 |
|
|
149 |
public void actionPerformed(ActionEvent arg0) { |
|
150 |
if (arg0.getActionCommand() |
|
151 |
.compareToIgnoreCase(FRasterLyrArcIMS.SCALE_CHANGED_COMMAND) == 0) { |
|
152 |
dp.setCurrentScale(1.0 * layer.getScale()); |
|
153 |
dp.repaint(); |
|
154 |
|
|
155 |
return; |
|
156 |
} |
|
157 |
|
|
158 |
if (arg0.getSource() == b) { |
|
159 |
this.close(); |
|
160 |
} |
|
161 |
} |
|
162 |
|
|
163 |
public void close() { |
|
164 |
PluginServices.getMDIManager().closeWindow(this); |
|
165 |
} |
|
166 |
|
|
167 |
public WindowInfo getWindowInfo() { |
|
168 |
if (theViewInfo == null) { |
|
169 |
theViewInfo = new WindowInfo(0 + // palette |
|
170 |
16 + // no modal |
|
171 |
0 + // modal |
|
172 |
4 + // iconifiable |
|
173 |
2 + // maximizable |
|
174 |
1 // resizable |
|
175 |
); |
|
176 |
theViewInfo.setTitle(PluginServices.getText(this, "view") + ": " + |
|
177 |
vistaName + " - " + PluginServices.getText(this, "layer") + |
|
178 |
": " + layer.getName() + " - " + |
|
179 |
PluginServices.getText(this, "layer_scale_status")); |
|
180 |
theViewInfo.setWidth(getInitialWidth()); |
|
181 |
theViewInfo.setHeight(getInitialHeight()); |
|
182 |
} |
|
183 |
|
|
184 |
return theViewInfo; |
|
185 |
} |
|
186 |
|
|
187 |
public FRasterLyrArcIMS getLayer() { |
|
188 |
return layer; |
|
189 |
} |
|
190 |
|
|
191 |
public void setLayer(FRasterLyrArcIMS layer) { |
|
192 |
this.layer = layer; |
|
193 |
} |
|
194 |
|
|
195 |
private int getInitialWidth() { |
|
196 |
return 365; |
|
197 |
} |
|
198 |
|
|
199 |
private int getInitialHeight() { |
|
200 |
return 290 - 35; |
|
201 |
} |
|
202 |
|
|
203 |
public void thingsHaveChanged(String query, String name) { |
|
204 |
resetDrawingPanel(); |
|
205 |
} |
|
206 |
|
|
207 |
public static String getFormattedInteger(int n) { |
|
208 |
DecimalFormat df = new DecimalFormat(); |
|
209 |
df.setGroupingUsed(true); |
|
210 |
df.setGroupingSize(3); |
|
211 |
|
|
212 |
DecimalFormatSymbols dfs = new DecimalFormatSymbols(); |
|
213 |
dfs.setGroupingSeparator('.'); |
|
214 |
df.setDecimalFormatSymbols(dfs); |
|
215 |
|
|
216 |
return df.format(n); |
|
217 |
} |
|
218 |
|
|
219 | 220 |
public Object getWindowProfile() { |
220 | 221 |
return WindowInfo.DIALOG_PROFILE; |
221 | 222 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/gui/dialogs/ArcImsPropsDialog.java | ||
---|---|---|
148 | 148 |
private void getNewLayerConfig() { |
149 | 149 |
|
150 | 150 |
if (fLayer instanceof FFeatureLyrArcIMS) { |
151 |
((FFeatureLyrArcIMS) fLayer).setLayerQuery(arcImsWizard |
|
152 |
.getLayerQuery()); |
|
153 |
((FLayer) fLayer).setName(arcImsWizard.getNewLayerName()); |
|
151 |
((FFeatureLyrArcIMS) fLayer).setLayerQuery(arcImsWizard.getServerExplorer().getStatus().getLayerQueryString()); |
|
152 |
((FLayer) fLayer).setName(arcImsWizard.getServerExplorer().getStatus().getNewLayerName()); |
|
154 | 153 |
} |
155 | 154 |
} |
156 | 155 |
|
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/gui/panels/FeatureServicePanel.java | ||
---|---|---|
77 | 77 |
import javax.swing.tree.DefaultMutableTreeNode; |
78 | 78 |
import javax.swing.tree.DefaultTreeModel; |
79 | 79 |
|
80 |
import org.slf4j.Logger; |
|
81 |
import org.slf4j.LoggerFactory; |
|
82 | 80 |
import org.gvsig.andami.PluginServices; |
83 | 81 |
import org.gvsig.app.addlayer.AddLayerDialog; |
84 | 82 |
import org.gvsig.arcims.feature.gui.panels.utils.AvailableLayersTreeCellRenderer; |
... | ... | |
90 | 88 |
import org.gvsig.arcims.feature.gui.wizards.ArcImsFeatureWizard; |
91 | 89 |
import org.gvsig.remoteclient.arcims.utils.ServiceInformation; |
92 | 90 |
import org.gvsig.remoteclient.arcims.utils.ServiceInformationLayer; |
91 |
import org.slf4j.Logger; |
|
92 |
import org.slf4j.LoggerFactory; |
|
93 | 93 |
|
94 | 94 |
|
95 | 95 |
|
... | ... | |
722 | 722 |
|
723 | 723 |
idAcum = idAcum.substring(1); // elimina la coma inicial |
724 | 724 |
|
725 |
parentWizard.setLayerQuery(idAcum);
|
|
726 |
parentWizard.setNewLayerName(this.newLayerNameTextField.getText()); |
|
725 |
parentWizard.getServerExplorer().getStatus().setLayerQueryString(idAcum);
|
|
726 |
parentWizard.getServerExplorer().getStatus().setNewLayerName(this.newLayerNameTextField.getText());
|
|
727 | 727 |
} |
728 | 728 |
|
729 | 729 |
/** |
... | ... | |
731 | 731 |
*/ |
732 | 732 |
public void emptyTables() { |
733 | 733 |
// re-start available layers' tree node: |
734 |
layersTreeRootObject = new ServiceNamesObject(parentWizard.getServiceName(), |
|
734 |
layersTreeRootObject = new ServiceNamesObject(parentWizard.getServerExplorer().getStatus().getServiceName(),
|
|
735 | 735 |
"ImageServer", "Enabled"); |
736 | 736 |
layersTreeRootNode = new DefaultMutableTreeNode(layersTreeRootObject); |
737 | 737 |
|
... | ... | |
750 | 750 |
|
751 | 751 |
refreshSelectedLayersList(); |
752 | 752 |
|
753 |
newLayerNameTextField.setText(parentWizard.getServiceName()); |
|
753 |
newLayerNameTextField.setText(parentWizard.getServerExplorer().getStatus().getServiceName());
|
|
754 | 754 |
} |
755 | 755 |
|
756 | 756 |
/** |
... | ... | |
957 | 957 |
*/ |
958 | 958 |
public void keyReleased(KeyEvent e) { |
959 | 959 |
if (e.getSource() == newLayerNameTextField) { |
960 |
this.parentWizard.setNewLayerName(this.newLayerNameTextField.getText()); |
|
960 |
this.parentWizard.getServerExplorer().getStatus().setNewLayerName(this.newLayerNameTextField.getText());
|
|
961 | 961 |
this.parentWizard.fireWizardComplete(this.isCorrectlyConfigured()); |
962 | 962 |
} |
963 | 963 |
} |
... | ... | |
984 | 984 |
public void loadServiceDetailsTable(ServiceInformation si) { |
985 | 985 |
Vector data = new Vector(); |
986 | 986 |
Vector item = new Vector(); |
987 |
Vector cols = new Vector();
|
|
987 |
Vector cols = new Vector();
|
|
988 | 988 |
|
989 | 989 |
if (si != null) { |
990 | 990 |
// A valid ArcImsProtocolHandler.ServiceInformation parameter |
... | ... | |
1138 | 1138 |
String service_name_title = PluginServices.getText(this, "service"); |
1139 | 1139 |
String service_type_title = PluginServices.getText(this, "service_type"); |
1140 | 1140 |
|
1141 |
String serverURL = parentWizard.getHostName();
|
|
1142 |
String serviceName = parentWizard.getServiceName(); |
|
1143 |
String serviceType = lowerPS(parentWizard.getServiceType()); |
|
1141 |
String serverURL = parentWizard.getServerExplorer().getStatus().getServerURL();
|
|
1142 |
String serviceName = parentWizard.getServerExplorer().getStatus().getServiceName();
|
|
1143 |
String serviceType = lowerPS(parentWizard.getServerExplorer().getStatus().getServiceType());
|
|
1144 | 1144 |
|
1145 | 1145 |
String html = "<html><body>\n" + |
1146 | 1146 |
"<table align=\"center\" width=\"425\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">\n" + |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/gui/panels/utils/ServicesTableDataSource.java | ||
---|---|---|
42 | 42 |
*/ |
43 | 43 |
package org.gvsig.arcims.feature.gui.panels.utils; |
44 | 44 |
|
45 |
import java.net.URL; |
|
46 | 45 |
import java.util.ArrayList; |
47 | 46 |
import java.util.Iterator; |
48 | 47 |
import java.util.List; |
49 | 48 |
import java.util.TreeSet; |
50 | 49 |
import java.util.Vector; |
51 | 50 |
|
52 |
import org.slf4j.Logger; |
|
53 |
import org.slf4j.LoggerFactory; |
|
54 | 51 |
import org.gvsig.andami.PluginServices; |
55 |
import org.gvsig.remoteclient.arcims.ArcImsProtocolHandler; |
|
56 | 52 |
import org.gvsig.remoteclient.arcims.exceptions.ArcImsException; |
57 | 53 |
import org.gvsig.remoteclient.arcims.utils.ServiceInfoTags; |
54 |
import org.slf4j.Logger; |
|
55 |
import org.slf4j.LoggerFactory; |
|
58 | 56 |
|
59 |
|
|
60 | 57 |
/** |
61 |
* This class is used to get and use the data model of the
|
|
62 |
* available services table.
|
|
63 |
|
|
64 |
* @author jldominguez |
|
65 |
*/ |
|
58 |
* This class is used to get and use the data model of the available services
|
|
59 |
* table.
|
|
60 |
* |
|
61 |
* @author jldominguez
|
|
62 |
*/
|
|
66 | 63 |
public class ServicesTableDataSource { |
67 |
protected static Logger logger = LoggerFactory.getLogger(ServicesTableDataSource.class.getName()); |
|
68 |
private Vector colNames; |
|
69 |
private Vector data; // vector of vectors |
|
70 |
private String nameColString = PluginServices.getText(this, "name"); |
|
71 |
private String typeColString = PluginServices.getText(this, |
|
72 |
"arcims_server_type_col_name"); |
|
73 |
private String statusColString = PluginServices.getText(this, |
|
74 |
"arcims_server_status_col_name"); |
|
64 |
protected static Logger logger = LoggerFactory |
|
65 |
.getLogger(ServicesTableDataSource.class.getName()); |
|
66 |
private Vector<String> colNames; |
|
67 |
private Vector<Vector<String>> data; // vector of vectors |
|
68 |
private String nameColString = PluginServices.getText(this, "name"); |
|
69 |
private String typeColString = PluginServices.getText(this, |
|
70 |
"arcims_server_type_col_name"); |
|
71 |
private String statusColString = PluginServices.getText(this, |
|
72 |
"arcims_server_status_col_name"); |
|
75 | 73 |
|
76 |
/** |
|
77 |
* The constructor is called with the server's URL as a parameter. |
|
78 |
* Sets the columns names to "Name", "Type" and |
|
79 |
* "Status" and gets the table data by sending a request to the server. |
|
80 |
* @throws ArcImsException |
|
81 |
*/ |
|
82 |
public ServicesTableDataSource(URL svrURL, boolean overrride) |
|
83 |
throws ArcImsException { |
|
84 |
colNames = new Vector(); |
|
85 |
loadDataAndColNames(svrURL, overrride); |
|
74 |
/** |
|
75 |
* The constructor is called with the server's URL as a parameter. Sets the |
|
76 |
* columns names to "Name", "Type" and "Status" and gets the table data by |
|
77 |
* sending a request to the server. |
|
78 |
* |
|
79 |
* @throws ArcImsException |
|
80 |
*/ |
|
81 |
public ServicesTableDataSource(List<List<String>> services) |
|
82 |
throws ArcImsException { |
|
83 |
colNames = new Vector<String>(); |
|
84 |
loadDataAndColNames(services); |
|
86 | 85 |
|
87 |
if (data.size() > 0) {
|
|
88 |
colNames.addElement(nameColString);
|
|
89 |
colNames.addElement(typeColString);
|
|
90 |
colNames.addElement(statusColString);
|
|
91 |
}
|
|
92 |
}
|
|
86 |
if (data.size() > 0) {
|
|
87 |
colNames.addElement(nameColString);
|
|
88 |
colNames.addElement(typeColString);
|
|
89 |
colNames.addElement(statusColString);
|
|
90 |
}
|
|
91 |
}
|
|
93 | 92 |
|
94 |
/**
|
|
95 |
* Gets a vector with the column names.
|
|
96 |
*
|
|
97 |
* @return the vector with the column names.
|
|
98 |
*/
|
|
99 |
public Vector getColNamesVector() {
|
|
100 |
return colNames;
|
|
101 |
}
|
|
93 |
/**
|
|
94 |
* Gets a vector with the column names.
|
|
95 |
*
|
|
96 |
* @return the vector with the column names.
|
|
97 |
*/
|
|
98 |
public Vector<String> getColNamesVector() {
|
|
99 |
return colNames;
|
|
100 |
}
|
|
102 | 101 |
|
103 |
/**
|
|
104 |
* Gets a vector with the table's data.
|
|
105 |
*
|
|
106 |
* @return the table's data is a vector of vectors
|
|
107 |
*/
|
|
108 |
public Vector getDataVector() {
|
|
109 |
return data;
|
|
110 |
}
|
|
102 |
/**
|
|
103 |
* Gets a vector with the table's data.
|
|
104 |
*
|
|
105 |
* @return the table's data is a vector of vectors
|
|
106 |
*/
|
|
107 |
public Vector<Vector<String>> getDataVector() {
|
|
108 |
return data;
|
|
109 |
}
|
|
111 | 110 |
|
112 |
/**
|
|
113 |
* Sends a request to the server (ServiceName=catalog)
|
|
114 |
* and loads the private vectors (data and column names)
|
|
115 |
* @param tmpDriver
|
|
116 |
*
|
|
117 |
* @param serverURL server's URL
|
|
118 |
* @throws ArcImsException
|
|
119 |
*/
|
|
120 |
private void loadDataAndColNames(URL serverURL, boolean override)
|
|
121 |
throws ArcImsException {
|
|
122 |
List<List<String>> _services = ArcImsProtocolHandler.getCatalog(serverURL,
|
|
123 |
override);
|
|
111 |
/**
|
|
112 |
* Sends a request to the server (ServiceName=catalog) and loads the private
|
|
113 |
* vectors (data and column names)
|
|
114 |
*
|
|
115 |
* @param tmpDriver
|
|
116 |
*
|
|
117 |
* @param serverURL
|
|
118 |
* server's URL
|
|
119 |
* @throws ArcImsException
|
|
120 |
*/
|
|
121 |
private void loadDataAndColNames(List<List<String>> _services)
|
|
122 |
throws ArcImsException {
|
|
124 | 123 |
|
125 |
ArrayList services = leaveKnownServices(_services);
|
|
124 |
List<List<String>> services = leaveKnownServices(_services);
|
|
126 | 125 |
|
127 |
data = new Vector();
|
|
126 |
data = new Vector<Vector<String>>();
|
|
128 | 127 |
|
129 |
TreeSet auxTree = new TreeSet();
|
|
128 |
TreeSet<String> auxTree = new TreeSet<String>();
|
|
130 | 129 |
|
131 |
for (int i = 0; i < services.size(); i++) {
|
|
132 |
ArrayList item = (ArrayList) services.get(i);
|
|
133 |
auxTree.add(item.get(0));
|
|
134 |
}
|
|
130 |
for (int i = 0; i < services.size(); i++) {
|
|
131 |
List<String> item = services.get(i);
|
|
132 |
auxTree.add(item.get(0));
|
|
133 |
}
|
|
135 | 134 |
|
136 |
Iterator iter = auxTree.iterator();
|
|
135 |
Iterator<String> iter = auxTree.iterator();
|
|
137 | 136 |
|
138 |
while (iter.hasNext()) {
|
|
139 |
String name = (String) iter.next();
|
|
140 |
data.add(getItemWithName(services, name));
|
|
141 |
}
|
|
137 |
while (iter.hasNext()) {
|
|
138 |
String name = iter.next();
|
|
139 |
data.add(getItemWithName(services, name));
|
|
140 |
}
|
|
142 | 141 |
|
143 |
// for (int i=0; i<services.size(); i++) { |
|
144 |
// ArrayList item = (ArrayList) services.get(i); |
|
145 |
// Vector vv = new Vector(); |
|
146 |
// vv.addElement( item.get(0) ); |
|
147 |
// vv.addElement( item.get(1) ); |
|
148 |
// vv.addElement( item.get(2) ); |
|
149 |
// // int insert = getInsertPosition(String str, data); |
|
150 |
// // data.insertElementAt(vv); //, insert); |
|
151 |
// } |
|
152 |
} |
|
142 |
} |
|
153 | 143 |
|
154 |
private ArrayList leaveKnownServices(List<List<String>> list) { |
|
155 |
ArrayList resp = new ArrayList(); |
|
156 |
ArrayList item; |
|
157 |
String type; |
|
158 |
String enabled; |
|
144 |
/** |
|
145 |
* |
|
146 |
* @param list |
|
147 |
* @return |
|
148 |
*/ |
|
149 |
private List<List<String>> leaveKnownServices(List<List<String>> list) { |
|
159 | 150 |
|
160 |
for (int i = 0; i < list.size(); i++) {
|
|
161 |
item = (ArrayList) list.get(i);
|
|
162 |
type = (String) item.get(1);
|
|
163 |
enabled = (String) item.get(2);
|
|
151 |
List<List<String>> resp = new ArrayList<List<String>>();
|
|
152 |
ArrayList<String> item;
|
|
153 |
String type;
|
|
154 |
String enabled;
|
|
164 | 155 |
|
165 |
if (isKnownServiceType(type) && (isEnabled(enabled))) {
|
|
166 |
resp.add((ArrayList) item.clone());
|
|
167 |
}
|
|
168 |
}
|
|
156 |
for (int i = 0; i < list.size(); i++) {
|
|
157 |
item = (ArrayList) list.get(i);
|
|
158 |
type = (String) item.get(1);
|
|
159 |
enabled = (String) item.get(2);
|
|
169 | 160 |
|
170 |
return resp; |
|
171 |
} |
|
161 |
if (isKnownServiceType(type) && (isEnabled(enabled))) { |
|
162 |
resp.add((List) item.clone()); |
|
163 |
} |
|
164 |
} |
|
172 | 165 |
|
173 |
private boolean isEnabled(String str) { |
|
174 |
if (str.compareToIgnoreCase("enabled") == 0) { |
|
175 |
return true; |
|
176 |
} |
|
166 |
return resp; |
|
167 |
} |
|
177 | 168 |
|
178 |
return false; |
|
179 |
} |
|
169 |
/** |
|
170 |
* |
|
171 |
* @param str |
|
172 |
* @return |
|
173 |
*/ |
|
174 |
private boolean isEnabled(String str) { |
|
175 |
if (str.compareToIgnoreCase("enabled") == 0) { |
|
176 |
return true; |
|
177 |
} |
|
180 | 178 |
|
181 |
private boolean isKnownServiceType(String type) { |
|
182 |
// if (type.compareToIgnoreCase(ServiceInfoTags.vIMAGESERVICE) == 0) { |
|
183 |
// return true; |
|
184 |
// } |
|
179 |
return false; |
|
180 |
} |
|
185 | 181 |
|
186 |
if (type.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
187 |
return true; |
|
188 |
} |
|
182 |
private boolean isKnownServiceType(String type) { |
|
183 |
// if (type.compareToIgnoreCase(ServiceInfoTags.vIMAGESERVICE) == 0) { |
|
184 |
// return true; |
|
185 |
// } |
|
189 | 186 |
|
190 |
return false; |
|
191 |
} |
|
187 |
if (type.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
188 |
return true; |
|
189 |
} |
|
192 | 190 |
|
193 |
private Vector getItemWithName(ArrayList allitems, String name) { |
|
194 |
for (int i = 0; i < allitems.size(); i++) { |
|
195 |
if (((String) ((ArrayList) allitems.get(i)).get(0)).compareToIgnoreCase( |
|
196 |
name) == 0) { |
|
197 |
Vector vv = new Vector(); |
|
198 |
vv.addElement(((ArrayList) allitems.get(i)).get(0)); |
|
199 |
vv.addElement(((ArrayList) allitems.get(i)).get(1)); |
|
200 |
vv.addElement(((ArrayList) allitems.get(i)).get(2)); |
|
191 |
return false; |
|
192 |
} |
|
201 | 193 |
|
202 |
return vv; |
|
203 |
} |
|
204 |
} |
|
194 |
/** |
|
195 |
* |
|
196 |
* @param allitems |
|
197 |
* @param name |
|
198 |
* @return |
|
199 |
*/ |
|
200 |
private Vector<String> getItemWithName(List<List<String>> allitems, |
|
201 |
String name) { |
|
202 |
for (int i = 0; i < allitems.size(); i++) { |
|
203 |
if (allitems.get(i).get(0).compareToIgnoreCase(name) == 0) { |
|
204 |
Vector<String> vv = new Vector<String>(); |
|
205 |
vv.addElement(allitems.get(i).get(0)); |
|
206 |
vv.addElement(allitems.get(i).get(1)); |
|
207 |
vv.addElement(allitems.get(i).get(2)); |
|
205 | 208 |
|
206 |
logger.error("Service name not found "); |
|
209 |
return vv; |
|
210 |
} |
|
211 |
} |
|
212 |
logger.error("Service name not found "); |
|
213 |
return null; |
|
214 |
} |
|
207 | 215 |
|
208 |
return null; |
|
209 |
} |
|
216 |
private int getInsertPosition(String str, Vector data) { |
|
217 |
for (int i = 0; i < data.size(); i++) { |
|
218 |
String aux = (String) ((ArrayList) data.get(i)).get(0); |
|
210 | 219 |
|
211 |
private int getInsertPosition(String str, Vector data) { |
|
212 |
for (int i = 0; i < data.size(); i++) { |
|
213 |
String aux = (String) ((ArrayList) data.get(i)).get(0); |
|
220 |
if (aux.compareToIgnoreCase(str) > 0) { |
|
221 |
return i; |
|
222 |
} |
|
223 |
} |
|
214 | 224 |
|
215 |
if (aux.compareToIgnoreCase(str) > 0) { |
|
216 |
return i; |
|
217 |
} |
|
218 |
} |
|
225 |
return data.size(); |
|
226 |
} |
|
219 | 227 |
|
220 |
return data.size(); |
|
221 |
} |
|
228 |
/** |
|
229 |
* Gets the name of the <i>n</i>th column (<i>n</i> = columnIndex) |
|
230 |
* |
|
231 |
* @return column name |
|
232 |
*/ |
|
233 |
public String getColumnName(int columnIndex) { |
|
234 |
if (columnIndex == 0) { |
|
235 |
return nameColString; |
|
236 |
} |
|
222 | 237 |
|
223 |
/** |
|
224 |
* Gets the name of the <i>n</i>th column (<i>n</i> = columnIndex) |
|
225 |
* |
|
226 |
* @return column name |
|
227 |
*/ |
|
228 |
public String getColumnName(int columnIndex) { |
|
229 |
if (columnIndex == 0) { |
|
230 |
return nameColString; |
|
231 |
} |
|
238 |
if (columnIndex == 1) { |
|
239 |
return typeColString; |
|
240 |
} |
|
232 | 241 |
|
233 |
if (columnIndex == 1) {
|
|
234 |
return typeColString;
|
|
235 |
}
|
|
242 |
if (columnIndex == 2) {
|
|
243 |
return statusColString;
|
|
244 |
}
|
|
236 | 245 |
|
237 |
if (columnIndex == 2) { |
|
238 |
return statusColString; |
|
239 |
} |
|
240 |
|
|
241 |
return "(Columna desconocida)"; |
|
242 |
} |
|
246 |
return "(Columna desconocida)"; |
|
247 |
} |
|
243 | 248 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/gui/panels/ServiceNamesPanel.java | ||
---|---|---|
51 | 51 |
import java.awt.event.KeyListener; |
52 | 52 |
import java.awt.event.MouseEvent; |
53 | 53 |
import java.awt.event.MouseListener; |
54 |
import java.net.MalformedURLException; |
|
55 | 54 |
import java.net.URL; |
55 |
import java.util.ArrayList; |
|
56 |
import java.util.List; |
|
56 | 57 |
import java.util.Vector; |
57 | 58 |
|
58 | 59 |
import javax.swing.JButton; |
... | ... | |
70 | 71 |
import javax.swing.table.TableColumnModel; |
71 | 72 |
|
72 | 73 |
import org.gvsig.andami.PluginServices; |
73 |
import org.gvsig.arcims.feature.fmap.drivers.FMapFeatureArcImsDriver; |
|
74 | 74 |
import org.gvsig.arcims.feature.gui.panels.utils.ServicesTableDataSource; |
75 | 75 |
import org.gvsig.arcims.feature.gui.panels.utils.ServicesTableModel; |
76 | 76 |
import org.gvsig.arcims.feature.gui.panels.utils.ServicesTableSelectionListener; |
77 | 77 |
import org.gvsig.arcims.feature.gui.wizards.ArcImsFeatureWizard; |
78 |
import org.gvsig.fmap.dal.DALLocator; |
|
79 |
import org.gvsig.fmap.dal.DataManager; |
|
80 |
import org.gvsig.fmap.dal.serverexplorer.arcims.ArcImsServerExplorer; |
|
81 |
import org.gvsig.fmap.dal.serverexplorer.arcims.ArcImsServerExplorerParameters; |
|
78 | 82 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
79 | 83 |
import org.gvsig.remoteclient.arcims.ArcImsClient; |
80 | 84 |
import org.gvsig.remoteclient.arcims.ArcImsProtocolHandler; |
... | ... | |
97 | 101 |
* |
98 | 102 |
* |
99 | 103 |
* @author jldominguez |
104 |
* @author vsanjaime version 2.0 |
|
100 | 105 |
*/ |
101 | 106 |
public class ServiceNamesPanel extends JPanel implements ActionListener, |
102 | 107 |
MouseListener, KeyListener, ItemListener { |
... | ... | |
117 | 122 |
private Vector<String> favoriteServers = new Vector<String>(); |
118 | 123 |
private ServicesTableSelectionListener tableSelectionListener; |
119 | 124 |
private JPanel userDefinedServiceNamePanel = null; |
120 |
|
|
121 |
// private JRadioButton serviceNameSelectionModeUserRadioButton = null; |
|
122 |
// private JRadioButton serviceNameSelectionModeListRadioButton = null; |
|
123 |
// private ButtonGroup serviceSelectionModeButtonGroup = null; |
|
124 | 125 |
private JLabel serviceNameLabel = null; |
125 | 126 |
private JTextField userDefinedServiceNameTextField = null; |
126 | 127 |
private String serviceType = ""; |
... | ... | |
142 | 143 |
initialize(); |
143 | 144 |
} |
144 | 145 |
|
146 |
/** |
|
147 |
* initialize components |
|
148 |
*/ |
|
145 | 149 |
private void initialize() { |
146 | 150 |
this.setSize(501, 470); |
147 | 151 |
this.setLayout(null); |
... | ... | |
338 | 342 |
* @param v |
339 | 343 |
* a vector of Strings (servers' URLs) |
340 | 344 |
*/ |
341 |
private void writeServerVectorToXML(Vector v) { |
|
345 |
private void writeServerVectorToXML(Vector<String> v) {
|
|
342 | 346 |
String s = ""; |
343 | 347 |
|
344 | 348 |
for (int i = 0; i < v.size(); i++) |
345 |
s = s + "," + ((String) v.get(i));
|
|
349 |
s = s + "," + (v.get(i)); |
|
346 | 350 |
|
347 | 351 |
s = s.substring(1); |
348 | 352 |
|
... | ... | |
364 | 368 |
*/ |
365 | 369 |
private void loadFavoriteServers() { |
366 | 370 |
favoriteServers.add("http://njgin.state.nj.us"); |
367 |
//favoriteServers.add("http://massotti.carm.es"); |
|
371 |
// favoriteServers.add("http://massotti.carm.es");
|
|
368 | 372 |
// favoriteServers.add("http://cartoweb.paeria.es"); // Ayunt. de Lerida |
369 | 373 |
// favoriteServers.add("http://geodaten.stadt-bottrop.de"); // Ayunt. de |
370 | 374 |
// Bottrop (Alemania) |
371 |
//favoriteServers.add("http://comercio.ideam.gov.co"); |
|
372 |
//favoriteServers.add("http://atl.cenapred.unam.mx"); |
|
375 |
// favoriteServers.add("http://comercio.ideam.gov.co");
|
|
376 |
// favoriteServers.add("http://atl.cenapred.unam.mx");
|
|
373 | 377 |
// favoriteServers.add("http://gdz1.leipzig.ifag.de"); |
374 | 378 |
|
375 | 379 |
XMLEntity xml = PluginServices.getPluginServices(this) |
... | ... | |
390 | 394 |
} |
391 | 395 |
} |
392 | 396 |
|
393 |
private void addIfNotRepeated(Vector v, String s) { |
|
397 |
/** |
|
398 |
* |
|
399 |
* @param v |
|
400 |
* @param s |
|
401 |
*/ |
|
402 |
private void addIfNotRepeated(Vector<String> v, String s) { |
|
394 | 403 |
if (v.contains(s)) { |
395 | 404 |
return; |
396 | 405 |
} |
397 |
|
|
398 | 406 |
v.add(0, s); |
399 | 407 |
} |
400 | 408 |
|
401 |
private void removeServerFromVector(Vector v, String s) { |
|
409 |
/** |
|
410 |
* |
|
411 |
* @param v |
|
412 |
* @param s |
|
413 |
*/ |
|
414 |
private void removeServerFromVector(Vector<String> v, String s) { |
|
402 | 415 |
if (!(v.contains(s))) { |
403 | 416 |
return; |
404 | 417 |
} |
... | ... | |
445 | 458 |
} |
446 | 459 |
} |
447 | 460 |
|
461 |
/** |
|
462 |
* |
|
463 |
*/ |
|
448 | 464 |
public void mouseEntered(MouseEvent e) { |
449 | 465 |
} |
450 | 466 |
|
467 |
/** |
|
468 |
* |
|
469 |
*/ |
|
451 | 470 |
public void mouseExited(MouseEvent e) { |
452 | 471 |
} |
453 | 472 |
|
473 |
/** |
|
474 |
* |
|
475 |
*/ |
|
454 | 476 |
public void mousePressed(MouseEvent e) { |
455 | 477 |
} |
456 | 478 |
|
479 |
/** |
|
480 |
* |
|
481 |
*/ |
|
457 | 482 |
public void mouseReleased(MouseEvent e) { |
458 | 483 |
} |
459 | 484 |
|
... | ... | |
477 | 502 |
url = new URL(serverComboBox.getSelectedItem().toString()); |
478 | 503 |
completeURL = ArcImsProtocolHandler.getUrlWithServlet(url); |
479 | 504 |
|
505 |
DataManager dataManager = DALLocator.getDataManager(); |
|
506 |
// Create the server explorer parameters |
|
507 |
ArcImsServerExplorerParameters parameters = (ArcImsServerExplorerParameters) dataManager |
|
508 |
.createServerExplorerParameters(ArcImsServerExplorer.NAME); |
|
509 |
parameters.setUrl(completeURL.toString()); |
|
510 |
parameters.setVersion("4.0.1"); |
|
511 |
|
|
512 |
// Create the server explorer |
|
513 |
ArcImsServerExplorer explorer = (ArcImsServerExplorer) dataManager |
|
514 |
.createServerExplorer(parameters); |
|
515 |
this.parentWizard.setServerExplorer(explorer); |
|
516 |
|
|
517 |
List<List<String>> services = explorer.listServices(); |
|
518 |
|
|
480 | 519 |
// this truly loads the service names, types and status: |
481 |
stds = new ServicesTableDataSource(completeURL, cacheOverride |
|
482 |
.isSelected()); |
|
483 |
} catch (MalformedURLException e1) { |
|
520 |
stds = new ServicesTableDataSource(services); |
|
521 |
} catch (Exception e1) { |
|
484 | 522 |
badURL = true; |
485 |
} catch (ArcImsException e1) { |
|
486 |
badURL = true; |
|
487 | 523 |
} |
488 | 524 |
|
489 | 525 |
if (badURL) { |
... | ... | |
506 | 542 |
|
507 | 543 |
// remove useless url: |
508 | 544 |
removeServerFromVector(favoriteServers, url.toString()); |
509 |
// writeServerVectorToXML(favoriteServers); |
|
545 |
|
|
510 | 546 |
|
511 | 547 |
return; |
512 | 548 |
} |
... | ... | |
519 | 555 |
favoriteServers.add(0, url.toString()); |
520 | 556 |
writeServerVectorToXML(favoriteServers); |
521 | 557 |
|
522 |
parentWizard.setHostName(completeURL.toString());
|
|
558 |
parentWizard.getServerExplorer().getStatus().setServerURL(completeURL.toString());
|
|
523 | 559 |
|
524 | 560 |
ServicesTableModel dtm = new ServicesTableModel(stds |
525 | 561 |
.getDataVector(), stds.getColNamesVector()); |
... | ... | |
532 | 568 |
servicesTableScrollPane.setViewportView(servicesTable); |
533 | 569 |
servicesTable.repaint(); |
534 | 570 |
servicesTableScrollPane.repaint(); |
535 |
|
|
536 |
// setEnableComponent(servicesTable, |
|
537 |
// serviceNameSelectionModeListRadioButton.isSelected()); |
|
571 |
|
|
538 | 572 |
// ---------------------- CONNECT BUTTON - END |
539 | 573 |
} |
540 | 574 |
|
541 | 575 |
// ---------------------- NEXT BUTTON - START |
542 | 576 |
if (e.getSource() == nextButton) { |
543 |
// if the 'user defined' option is set, local variables get values |
|
544 |
// from |
|
545 |
// the combobox |
|
546 |
// if (serviceNameSelectionModeUserRadioButton.isSelected()) { |
|
577 |
|
|
578 |
// get serverexplorer |
|
579 |
ArcImsServerExplorer explorer = this.parentWizard |
|
580 |
.getServerExplorer(); |
|
581 |
|
|
582 |
// Get service name |
|
547 | 583 |
String userServiceName = userDefinedServiceNameTextField.getText(); |
584 |
|
|
585 |
|
|
548 | 586 |
int ind = -1; |
549 | 587 |
|
550 | 588 |
try { |
... | ... | |
568 | 606 |
selectedServiceType = ServicesTableModel |
569 | 607 |
.getColumnValueOfRowWithIndex(servicesTable, 1, ind); |
570 | 608 |
selectedServiceName = userServiceName; |
609 |
explorer.getStatus().setServiceName(userServiceName); |
|
610 |
explorer.getStatus().setServiceType(selectedServiceType); |
|
611 |
explorer.getClient().getHandler().setService(userServiceName); |
|
571 | 612 |
|
572 | 613 |
// } |
573 | 614 |
|
... | ... | |
576 | 617 |
return; |
577 | 618 |
} |
578 | 619 |
|
579 |
// +++++++++++++ This line truly starts the connection: ++++++++++++ |
|
580 |
// +++++++++++++ creates driver, client and gets capabilities |
|
581 |
// ++++++++++++ |
|
620 |
// Get list layers of selected service |
|
621 |
List<String> layers = new ArrayList<String>(); |
|
582 | 622 |
try { |
583 |
parentWizard.getDataSource().setHostService(completeURL, |
|
584 |
selectedServiceName, selectedServiceType);
|
|
623 |
|
|
624 |
layers = explorer.list();
|
|
585 | 625 |
} catch (Exception de) { |
586 | 626 |
logger.error("While setting host service ", de); |
587 | 627 |
showErrorMessage(de.getMessage()); |
588 | 628 |
return; |
589 | 629 |
} |
590 |
|
|
591 |
// get service information: |
|
592 |
ArcImsClient cli = null; |
|
593 |
|
|
594 |
if (selectedServiceType |
|
595 |
.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
596 |
FMapFeatureArcImsDriver fdrv = (FMapFeatureArcImsDriver) parentWizard |
|
597 |
.getDataSource().getDriver(); |
|
598 |
cli = (ArcImsClient) fdrv.getClient(); |
|
599 |
} |
|
600 |
|
|
601 |
ServiceInformation si = cli.getServiceInformation(); |
|
602 |
|
|
603 |
// |
|
604 |
if ((si.getLayers() == null) || (si.getLayers().size() == 0)) { |
|
605 |
logger.warn("No layers found "); |
|
606 |
JOptionPane.showMessageDialog(this, PluginServices.getText( |
|
607 |
this, "no_layers_found") |
|
608 |
+ ". " |
|
609 |
+ PluginServices.getText(this, "service") |
|
610 |
+ ": " |
|
611 |
+ selectedServiceName, PluginServices.getText(this, |
|
612 |
"no_layers_found"), JOptionPane.ERROR_MESSAGE); |
|
613 |
|
|
614 |
return; |
|
615 |
} |
|
616 |
|
|
617 |
parentWizard.setServiceName(selectedServiceName); |
|
618 |
parentWizard.setServiceType(selectedServiceType); |
|
630 |
|
|
619 | 631 |
parentWizard.fillAndMoveTabbedPaneToEnabled(); |
620 | 632 |
|
621 | 633 |
// ---------------------- NEXT BUTTON - END |
622 | 634 |
} |
623 | 635 |
} |
624 | 636 |
|
637 |
/** |
|
638 |
* |
|
639 |
* @param lyr |
|
640 |
*/ |
|
625 | 641 |
public void pseudoNextFired(FLayer lyr) { |
626 | 642 |
// if the 'user defined' option is set, local variables get values from |
627 | 643 |
// the combobox |
... | ... | |
662 | 678 |
// +++++++++++++ This line truly starts the connection: ++++++++++++ |
663 | 679 |
// +++++++++++++ creates driver, client and gets capabilities |
664 | 680 |
// ++++++++++++ |
665 |
parentWizard.getDataSource().setHostService(completeURL, |
|
666 |
selectedServiceName, selectedServiceType, lyr); |
|
681 |
// FIXME Vicent |
|
682 |
// parentWizard.getDataSource().setHostService(completeURL, |
|
683 |
// selectedServiceName, selectedServiceType, lyr); |
|
667 | 684 |
} catch (Exception de) { |
668 | 685 |
logger.error("While setting host service ", de); |
669 | 686 |
showErrorMessage(de.getMessage()); |
... | ... | |
676 | 693 |
|
677 | 694 |
if (selectedServiceType |
678 | 695 |
.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
679 |
FMapFeatureArcImsDriver fdrv = (FMapFeatureArcImsDriver) parentWizard |
|
680 |
.getDataSource().getDriver(); |
|
681 |
cli = (ArcImsClient) fdrv.getClient(); |
|
696 |
// FIXME |
|
697 |
// FMapFeatureArcImsDriver fdrv = (FMapFeatureArcImsDriver) |
|
698 |
// parentWizard |
|
699 |
// .getDataSource().getDriver(); |
|
700 |
// cli = (ArcImsClient) fdrv.getClient(); |
|
682 | 701 |
} |
683 | 702 |
|
684 | 703 |
ServiceInformation si = cli.getServiceInformation(); |
... | ... | |
697 | 716 |
return; |
698 | 717 |
} |
699 | 718 |
|
700 |
parentWizard.setServiceName(selectedServiceName); |
|
701 |
parentWizard.setServiceType(selectedServiceType); |
|
702 | 719 |
parentWizard.fillAndMoveTabbedPaneToEnabled(); |
703 | 720 |
} |
704 | 721 |
|
722 |
/** |
|
723 |
* |
|
724 |
* @param table |
|
725 |
* @param m |
|
726 |
*/ |
|
705 | 727 |
private void setModelAndWidths(JTable table, ServicesTableModel m) { |
706 | 728 |
table.setModel(m); |
707 | 729 |
|
... | ... | |
720 | 742 |
} |
721 | 743 |
} |
722 | 744 |
|
745 |
/** |
|
746 |
* |
|
747 |
* @param message |
|
748 |
*/ |
|
723 | 749 |
private void showErrorMessage(String message) { |
724 | 750 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, |
725 | 751 |
message), PluginServices.getText(this, "error"), |
726 | 752 |
JOptionPane.ERROR_MESSAGE); |
727 | 753 |
} |
728 | 754 |
|
755 |
/** |
|
756 |
* |
|
757 |
* @return |
|
758 |
*/ |
|
729 | 759 |
private boolean servicesTableHasSelection() { |
730 | 760 |
return (servicesTable.getSelectedRow() != -1); |
731 | 761 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.arcims.feature.extension/src/main/java/org/gvsig/arcims/feature/gui/wizards/ArcImsFeatureWizard.java | ||
---|---|---|
43 | 43 |
package org.gvsig.arcims.feature.gui.wizards; |
44 | 44 |
|
45 | 45 |
import java.awt.BorderLayout; |
46 |
import java.util.List; |
|
46 | 47 |
|
47 | 48 |
import javax.swing.JPanel; |
48 | 49 |
import javax.swing.JScrollPane; |
... | ... | |
51 | 52 |
import org.gvsig.app.gui.WizardPanel; |
52 | 53 |
import org.gvsig.app.gui.wizards.WizardListener; |
53 | 54 |
import org.gvsig.app.gui.wizards.WizardListenerSupport; |
54 |
import org.gvsig.arcims.feature.fmap.datasource.ArcImsFeatureWizardData; |
|
55 |
import org.gvsig.arcims.feature.fmap.drivers.FMapFeatureArcImsDriver; |
|
56 |
import org.gvsig.arcims.feature.fmap.layers.FFeatureLyrArcIMSCollection; |
|
57 | 55 |
import org.gvsig.arcims.feature.gui.panels.FeatureServicePanel; |
58 | 56 |
import org.gvsig.arcims.feature.gui.panels.ServiceNamesPanel; |
59 | 57 |
import org.gvsig.arcims.feature.gui.panels.utils.LayersListElement; |
58 |
import org.gvsig.fmap.dal.DALLocator; |
|
59 |
import org.gvsig.fmap.dal.DataManager; |
|
60 | 60 |
import org.gvsig.fmap.dal.DataStoreParameters; |
61 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
62 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
63 |
import org.gvsig.fmap.dal.serverexplorer.arcims.ArcImsServerExplorer; |
|
64 |
import org.gvsig.fmap.dal.store.arcims.ArcImsStoreParameters; |
|
65 |
import org.gvsig.fmap.dal.store.arcims.ArcImsStoreProvider; |
|
66 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
61 | 67 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
68 |
import org.gvsig.fmap.mapcontext.layers.LayerFactory; |
|
62 | 69 |
import org.gvsig.remoteclient.arcims.ArcImsClient; |
70 |
import org.gvsig.remoteclient.arcims.ArcImsFeatureClient; |
|
71 |
import org.gvsig.remoteclient.arcims.ArcImsStatus; |
|
72 |
import org.gvsig.remoteclient.arcims.ArcImsVectStatus; |
|
63 | 73 |
import org.gvsig.remoteclient.arcims.utils.ServiceInfoTags; |
64 | 74 |
import org.gvsig.remoteclient.arcims.utils.ServiceInformation; |
65 | 75 |
import org.gvsig.remoteclient.arcims.utils.ServiceInformationLayerFeatures; |
... | ... | |
82 | 92 |
.getLogger(ArcImsFeatureWizard.class.getName()); |
83 | 93 |
private static final long serialVersionUID = 0; |
84 | 94 |
private WizardListenerSupport listenerSupport = new WizardListenerSupport(); |
85 |
private ArcImsFeatureWizardData dataSource;
|
|
95 |
// PANELS
|
|
86 | 96 |
private ServiceNamesPanel svsNamesPanel; |
87 | 97 |
private FeatureServicePanel feaServicePanel; |
88 | 98 |
private JPanel mainPanel = null; |
89 |
private String nombreTema = "ArcIMS layer"; |
|
90 |
private String layerQuery = "Empty query"; |
|
91 |
private String host = ""; |
|
92 |
private String serviceName = ""; |
|
93 |
private String serviceType = ""; |
|
94 |
private String imageFormat; |
|
99 |
// DAL |
|
100 |
private ArcImsServerExplorer serverExplorer = null; |
|
101 |
// LAYER |
|
95 | 102 |
private FLayer theLayer; |
96 | 103 |
|
97 | 104 |
/** |
... | ... | |
111 | 118 |
public ArcImsFeatureWizard(boolean editionallowed, boolean props) { |
112 | 119 |
super(); |
113 | 120 |
initialize(editionallowed, props); |
121 |
|
|
114 | 122 |
} |
115 | 123 |
|
116 | 124 |
/** |
125 |
* Get services names PANEL |
Also available in: Unified diff