Revision 6115
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/wizards/WMSWizard.java | ||
---|---|---|
85 | 85 |
protected int page; |
86 | 86 |
protected boolean connected = false; |
87 | 87 |
private JComboServer cmbHost = null; |
88 |
private javax.swing.JButton btnConnect = null;
|
|
88 |
private org.gvsig.gui.beans.swing.JButton btnConnect = null;
|
|
89 | 89 |
private javax.swing.JPanel jPanel = null; |
90 | 90 |
private javax.swing.JLabel jLabel1 = null; |
91 | 91 |
private javax.swing.JLabel lblTitle = null; |
92 | 92 |
private javax.swing.JScrollPane jScrollPane = null; |
93 | 93 |
private javax.swing.JTextArea txtAbstract = null; |
94 | 94 |
private javax.swing.JPanel panelPage1 = null; |
95 |
private javax.swing.JButton btnSiguiente = null;
|
|
96 |
private javax.swing.JButton btnAnterior = null;
|
|
95 |
private org.gvsig.gui.beans.swing.JButton btnSiguiente = null;
|
|
96 |
private org.gvsig.gui.beans.swing.JButton btnAnterior = null;
|
|
97 | 97 |
private javax.swing.JPanel jPanel1 = null; |
98 | 98 |
protected WizardListenerSupport listenerSupport = new WizardListenerSupport(); |
99 | 99 |
protected WMSWizardData dataSource; |
... | ... | |
106 | 106 |
protected int firstPage; |
107 | 107 |
|
108 | 108 |
public WMSWizard (WMSParamsPanel params){ |
109 |
|
|
109 |
|
|
110 | 110 |
super(); |
111 | 111 |
firstPage = 1; |
112 | 112 |
page = firstPage; |
113 |
this.wmsParamsPanel = params;
|
|
113 |
this.wmsParamsPanel = params; |
|
114 | 114 |
this.dataSource = wmsParamsPanel.dataSource; |
115 | 115 |
|
116 |
setTabName("WMS");
|
|
116 |
setTabName("WMS"); |
|
117 | 117 |
lblServerType = new JLabel(); |
118 | 118 |
lblServerType.setBounds(20, 444, 100, 20); |
119 | 119 |
lblServerType.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
... | ... | |
142 | 142 |
this.add(lblServerType, null); |
143 | 143 |
this.add(lblServerTypeValue, null); |
144 | 144 |
getPanelPage2().setVisible(true); |
145 |
connected = true;
|
|
145 |
connected = true; |
|
146 | 146 |
} |
147 |
|
|
147 |
|
|
148 | 148 |
/** |
149 | 149 |
* This is the default constructor |
150 | 150 |
*/ |
... | ... | |
153 | 153 |
firstPage = 0; |
154 | 154 |
page = firstPage; |
155 | 155 |
initialize(); |
156 |
}
|
|
156 |
} |
|
157 | 157 |
/** |
158 | 158 |
* This method initializes this |
159 | 159 |
*/ |
... | ... | |
282 | 282 |
} else if (page == wmsParamsPanel.getNumTabs()) { |
283 | 283 |
getBtnSiguiente().setVisible(false); |
284 | 284 |
getBtnSiguiente().setEnabled(false); |
285 |
listenerSupport.callStateChanged(wmsParamsPanel
|
|
285 |
listenerSupport.callStateChanged(wmsParamsPanel |
|
286 | 286 |
.isCorrectlyConfigured()); |
287 | 287 |
} |
288 | 288 |
} |
... | ... | |
298 | 298 |
cmbHost.setModel(new DefaultComboBoxModel()); |
299 | 299 |
cmbHost.setPreferredSize(new java.awt.Dimension(350, 20)); |
300 | 300 |
cmbHost.setBounds(11, 26, 454, 20); |
301 |
cmbHost.setEditable(true);
|
|
301 |
cmbHost.setEditable(true); |
|
302 | 302 |
|
303 | 303 |
ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_WMS); |
304 | 304 |
ServerData[] servers = persistence.getArrayOfServerData(); |
... | ... | |
332 | 332 |
} |
333 | 333 |
|
334 | 334 |
for (int i=0 ; i<servers.length ; i++){ |
335 |
persistence.addServerData(servers[i]);
|
|
335 |
persistence.addServerData(servers[i]); |
|
336 | 336 |
} |
337 |
persistence.setPersistent();
|
|
337 |
persistence.setPersistent(); |
|
338 | 338 |
} |
339 | 339 |
|
340 | 340 |
cmbHost.setServerList(servers); |
... | ... | |
385 | 385 |
|
386 | 386 |
// } // this bracket will be removed too in version <= 0.7 |
387 | 387 |
// xml.putProperty("wms-servers", servers); |
388 |
// }
|
|
388 |
// } |
|
389 | 389 |
// try { |
390 | 390 |
// String[] servers = xml.getStringArrayProperty("wms-servers"); |
391 | 391 |
// for (int i = 0; i < servers.length; i++) { |
... | ... | |
396 | 396 |
} |
397 | 397 |
|
398 | 398 |
return cmbHost; |
399 |
}
|
|
399 |
} |
|
400 | 400 |
|
401 | 401 |
|
402 | 402 |
/** |
... | ... | |
406 | 406 |
*/ |
407 | 407 |
private javax.swing.JButton getBtnConnect() { |
408 | 408 |
if (btnConnect == null) { |
409 |
btnConnect = new javax.swing.JButton();
|
|
409 |
btnConnect = new org.gvsig.gui.beans.swing.JButton();
|
|
410 | 410 |
btnConnect.setPreferredSize(new java.awt.Dimension(100, 20)); |
411 | 411 |
btnConnect.setBounds(366, 50, 100, 20); |
412 | 412 |
btnConnect.setText(PluginServices.getText(this, "conectar")); |
... | ... | |
532 | 532 |
*/ |
533 | 533 |
private javax.swing.JButton getBtnSiguiente() { |
534 | 534 |
if (btnSiguiente == null) { |
535 |
btnSiguiente = new javax.swing.JButton();
|
|
535 |
btnSiguiente = new org.gvsig.gui.beans.swing.JButton();
|
|
536 | 536 |
btnSiguiente.setPreferredSize(new java.awt.Dimension(100, 30)); |
537 | 537 |
btnSiguiente.setBounds(395, 444, 100, 20); |
538 | 538 |
btnSiguiente.setText(PluginServices.getText(this, "siguiente")); |
... | ... | |
561 | 561 |
*/ |
562 | 562 |
private javax.swing.JButton getBtnAnterior() { |
563 | 563 |
if (btnAnterior == null) { |
564 |
btnAnterior = new javax.swing.JButton(); |
|
564 |
btnAnterior = new org.gvsig.gui.beans.swing.JButton(); |
|
565 |
btnAnterior.setBounds(292, 444, 100, 20); |
|
565 | 566 |
btnAnterior.setText(PluginServices.getText(this, "anterior")); |
566 |
btnAnterior.setBounds(292, 444, 100, 20); |
|
567 | 567 |
btnAnterior.setPreferredSize(new java.awt.Dimension(100, 30)); |
568 | 568 |
btnAnterior.addActionListener(new java.awt.event.ActionListener() { |
569 | 569 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
... | ... | |
583 | 583 |
getPanelPage1().setVisible(true); |
584 | 584 |
getPanelPage2().setVisible(false); |
585 | 585 |
getBtnSiguiente().setEnabled(false); |
586 |
connected = false;
|
|
586 |
connected = false; |
|
587 | 587 |
} |
588 | 588 |
listenerSupport.callStateChanged(wmsParamsPanel.isCorrectlyConfigured()); |
589 | 589 |
} |
... | ... | |
699 | 699 |
public URL getHost() { |
700 | 700 |
try { |
701 | 701 |
if ((cmbHost == null)|| (cmbHost.getModel().getSelectedItem() == null)) |
702 |
return new URL(dataSource.getHost());
|
|
702 |
return new URL(dataSource.getHost()); |
|
703 | 703 |
else |
704 | 704 |
return new URL(cmbHost.getModel().getSelectedItem().toString()); |
705 | 705 |
} catch (MalformedURLException e) { |
... | ... | |
735 | 735 |
} |
736 | 736 |
|
737 | 737 |
public FLayer getLayer(){ |
738 |
|
|
739 |
return wmsParamsPanel.getLayer();
|
|
738 |
|
|
739 |
return wmsParamsPanel.getLayer(); |
|
740 | 740 |
// if(wmsParamsPanel.getDisagregatedLayers()){ |
741 | 741 |
// return getLayerTree(); |
742 | 742 |
// }else{ |
743 | 743 |
// return getLayerPlain(); |
744 |
// }
|
|
744 |
// } |
|
745 | 745 |
} |
746 |
|
|
747 |
// private Object[] getFullPath(String name){
|
|
746 |
|
|
747 |
// private Object[] getFullPath(String name){ |
|
748 | 748 |
// Vector path = new Vector(); |
749 |
// WMSLayerNode layerNode;
|
|
749 |
// WMSLayerNode layerNode; |
|
750 | 750 |
// WMSLayerNode parent; |
751 | 751 |
// for (int i = 0; i <wmsParamsPanel.getLstSelectedLayers().getModel().getSize(); i++) { |
752 | 752 |
// layerNode = (WMSLayerNode)wmsParamsPanel.getLstSelectedLayers().getModel().getElementAt(i); |
... | ... | |
761 | 761 |
// } |
762 | 762 |
// return path.toArray(); |
763 | 763 |
// } |
764 |
|
|
764 |
|
|
765 | 765 |
/** |
766 | 766 |
* If user does not select the chekbox Disagregate layers, will get the layer tree in WMS |
767 | 767 |
* @return |
768 | 768 |
*/ |
769 |
protected FLayer getLayerTree() {
|
|
770 |
LayerTree layerTree = wmsParamsPanel.getLayerStructure();
|
|
769 |
protected FLayer getLayerTree() { |
|
770 |
LayerTree layerTree = wmsParamsPanel.getLayerStructure(); |
|
771 | 771 |
TreePath[] selection = (TreePath[])wmsParamsPanel.getSelectedPaths().toArray(new TreePath[0]);//layerTree.getSelectionPaths(); |
772 |
if (selection!=null){
|
|
773 |
return getSubTree((WMSLayerNode)layerTree.getModel().getRoot(), selection);
|
|
774 |
}
|
|
772 |
if (selection!=null){ |
|
773 |
return getSubTree((WMSLayerNode)layerTree.getModel().getRoot(), selection); |
|
774 |
} |
|
775 | 775 |
return null; |
776 | 776 |
} |
777 |
|
|
777 |
|
|
778 | 778 |
protected boolean nodeSelected(TreePath[] selection, WMSLayerNode node){ |
779 |
for (int i = 0; i < selection.length; i++) {
|
|
779 |
for (int i = 0; i < selection.length; i++) { |
|
780 | 780 |
Object[] components = selection[i].getPath(); |
781 | 781 |
for (int j=0; j < components.length ; j++) |
782 |
{
|
|
782 |
{ |
|
783 | 783 |
if (components[j] instanceof WMSLayerNode){ |
784 | 784 |
if (((WMSLayerNode)components[j]).getTitle().compareTo(node.getTitle()) == 0){ |
785 | 785 |
return true; |
786 | 786 |
} |
787 | 787 |
} |
788 |
}
|
|
789 |
}
|
|
788 |
} |
|
789 |
} |
|
790 | 790 |
return false; |
791 | 791 |
} |
792 |
|
|
792 |
|
|
793 | 793 |
protected FLayer getSubTree(WMSLayerNode node, TreePath[] selection) |
794 |
{
|
|
794 |
{ |
|
795 | 795 |
if (node.getChildren().size() > 0) |
796 | 796 |
{ |
797 | 797 |
//com.iver.cit.gvsig.gui.View v = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
798 |
FLayers l = new FLayers(this.getMapCtrl().getMapContext(), null);
|
|
798 |
FLayers l = new FLayers(this.getMapCtrl().getMapContext(), null); |
|
799 | 799 |
l.setName(node.getTitle()); |
800 | 800 |
for(int i = 0; i < node.getChildren().size(); i++ ){ |
801 | 801 |
if (nodeSelected(selection, (WMSLayerNode)(node.getChildren().get(i)))) |
... | ... | |
814 | 814 |
FLyrWMS layer = new FLyrWMS(); |
815 | 815 |
layer.setHost(getHost()); |
816 | 816 |
try { |
817 |
layer.setFullExtent(getLayersRectangle());
|
|
818 |
} catch (CannotReprojectException e) {
|
|
817 |
layer.setFullExtent(getLayersRectangle()); |
|
818 |
} catch (CannotReprojectException e) { |
|
819 | 819 |
e.printStackTrace(); |
820 | 820 |
return null; |
821 |
}
|
|
821 |
} |
|
822 | 822 |
layer.setFormat(getFormat()); |
823 | 823 |
layer.setLayerQuery(node.getName()); |
824 | 824 |
layer.setInfoLayerQuery(getQueryableLayerQuery()); |
... | ... | |
831 | 831 |
layer.setOnlineResources(getOnlineResources()); |
832 | 832 |
layer.setFixedSize(getFixedSize()); |
833 | 833 |
layer.setQueryable(isQueryable()); |
834 |
|
|
834 |
|
|
835 | 835 |
return layer; |
836 |
|
|
836 |
|
|
837 | 837 |
}else{ |
838 | 838 |
return null; |
839 |
}
|
|
840 |
}
|
|
841 |
}
|
|
839 |
} |
|
840 |
} |
|
841 |
} |
|
842 | 842 |
|
843 | 843 |
/** |
844 | 844 |
* If user selects the chekbox Disagregate layers, will get the selected layers rendered in one |
... | ... | |
915 | 915 |
} |
916 | 916 |
|
917 | 917 |
/** |
918 |
* This method initializes chkCaching
|
|
919 |
*
|
|
920 |
* @return javax.swing.JCheckBox
|
|
921 |
*/
|
|
918 |
* This method initializes chkCaching |
|
919 |
* |
|
920 |
* @return javax.swing.JCheckBox |
|
921 |
*/ |
|
922 | 922 |
private JCheckBox getChkCaching() { |
923 | 923 |
if (chkCaching == null) { |
924 | 924 |
chkCaching = new JCheckBox(); |
... | ... | |
926 | 926 |
chkCaching.setText(PluginServices.getText(this, "refresh_capabilities")); |
927 | 927 |
chkCaching.setToolTipText(PluginServices.getText(this, "refresh_capabilities_tooltip")); |
928 | 928 |
chkCaching.setSelected(refreshing); |
929 |
chkCaching.addItemListener(new java.awt.event.ItemListener() {
|
|
929 |
chkCaching.addItemListener(new java.awt.event.ItemListener() { |
|
930 | 930 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
931 | 931 |
refreshing = chkCaching.isSelected(); |
932 | 932 |
} |
933 | 933 |
}); |
934 |
chkCaching.addActionListener(new java.awt.event.ActionListener() {
|
|
935 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
934 |
chkCaching.addActionListener(new java.awt.event.ActionListener() { |
|
935 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
936 | 936 |
fPrefs.putBoolean("refresh_capabilities", chkCaching.isSelected()); |
937 | 937 |
} |
938 | 938 |
}); |
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/dialogs/WMSPropsDialog.java | ||
---|---|---|
48 | 48 |
import java.util.HashMap; |
49 | 49 |
import java.util.Vector; |
50 | 50 |
|
51 |
import javax.swing.JButton;
|
|
51 |
import org.gvsig.gui.beans.swing.JButton;
|
|
52 | 52 |
import javax.swing.JDialog; |
53 | 53 |
import javax.swing.JOptionPane; |
54 | 54 |
import javax.swing.JPanel; |
55 | 55 |
import javax.swing.tree.TreePath; |
56 | 56 |
|
57 |
import org.gvsig.gui.beans.controls.dnd.JDnDList; |
|
58 |
import org.gvsig.gui.beans.controls.dnd.JDnDListModel; |
|
59 |
|
|
60 | 57 |
import com.iver.andami.PluginServices; |
61 | 58 |
import com.iver.andami.ui.mdiManager.View; |
62 | 59 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
... | ... | |
75 | 72 |
|
76 | 73 |
/** |
77 | 74 |
* The TOC WMS properties panel container. |
78 |
*
|
|
75 |
* |
|
79 | 76 |
* @author jaume - jaume.dominguez@iver.es |
80 | 77 |
* |
81 | 78 |
*/ |
... | ... | |
86 | 83 |
private FLayer fLayer = null; |
87 | 84 |
boolean applied = false;; |
88 | 85 |
private ViewInfo m_ViewInfo = null; |
89 |
|
|
86 |
|
|
90 | 87 |
private JButton btnApply = null; |
91 | 88 |
private JButton btnOk = null; |
92 | 89 |
private JButton btnCancel = null; |
... | ... | |
97 | 94 |
super(); |
98 | 95 |
initialize(layer); |
99 | 96 |
} |
100 |
|
|
101 |
|
|
97 |
|
|
98 |
|
|
102 | 99 |
private void initialize(FLayer layer) { |
103 | 100 |
setLayout(null); |
104 |
|
|
101 |
|
|
105 | 102 |
setFLayer(layer); |
106 | 103 |
wmsParamsTabbedPane = getParamsPanel(((FLyrWMS) layer).getProperties()); |
107 | 104 |
wmsParamsTabbedPane.addWizardListener(new WizardListener(){ |
... | ... | |
112 | 109 |
|
113 | 110 |
public void error(Exception e) { |
114 | 111 |
} |
115 |
|
|
112 |
|
|
116 | 113 |
}) ; |
117 | 114 |
wmsParamsTabbedPane.disableDisagregatedLayers(); |
118 | 115 |
this.add(wmsParamsTabbedPane); |
119 | 116 |
this.add(getButtonsPanel(), null); |
120 |
|
|
117 |
|
|
121 | 118 |
} |
122 |
|
|
123 | 119 |
|
120 |
|
|
124 | 121 |
public void setFLayer(FLayer f) { |
125 | 122 |
fLayer = f; |
126 | 123 |
} |
... | ... | |
131 | 128 |
* recovered) it is been automatically constructed by connecting to the server, |
132 | 129 |
* reloading the necessary data, filling up the content and setting the selected |
133 | 130 |
* values that were selected when the projet was saved. |
134 |
*
|
|
135 |
*
|
|
131 |
* |
|
132 |
* |
|
136 | 133 |
* Since a connection to the server is needed when rebuiliding the panel, this |
137 | 134 |
* causes a delay for the panel's showing up or a nullPointer error if there is |
138 | 135 |
* no path to the server. |
139 |
*
|
|
140 |
*
|
|
136 |
* |
|
137 |
* |
|
141 | 138 |
* Con getParamsPanel tenemos acceso a juego de pesta�as de configuraci�n |
142 | 139 |
* del mapa. Si este panel todav�a no existe (como puede ser cuando |
143 | 140 |
* recuperamos un proyecto guardado) �ste se crea autom�ticamente conectando |
144 | 141 |
* al servidor, recuperando los datos necesarios, rellenando el contenido y |
145 | 142 |
* dejando seleccionados los valores que estaban seleccionados cuando se |
146 | 143 |
* guard� el proyecto. |
147 |
*
|
|
148 |
*
|
|
144 |
* |
|
145 |
* |
|
149 | 146 |
* Como para reconstruirse requiere una conexi�n con el servidor esto causa |
150 | 147 |
* un retardo en la aparici�n en el toc o un error de nullPointer si no |
151 | 148 |
* hay conexi�n hasta el servidor. |
152 |
*
|
|
153 |
*
|
|
149 |
* |
|
150 |
* |
|
154 | 151 |
* @return WMSParamsPanel |
155 | 152 |
*/ |
156 | 153 |
public WMSParamsPanel getParamsPanel(HashMap info) { |
157 | 154 |
if (info!=null){ |
158 | 155 |
try { |
159 |
|
|
156 |
|
|
160 | 157 |
// host |
161 | 158 |
URL host = (URL) info.get("host"); |
162 | 159 |
WMSWizardData dataSource = new WMSWizardData(); |
163 | 160 |
dataSource.setHost(host, false); |
164 |
|
|
161 |
|
|
165 | 162 |
// name |
166 |
WMSParamsPanel toc = new WMSParamsPanel();
|
|
167 |
toc.setLayerName((String)info.get("name"));
|
|
163 |
WMSParamsPanel toc = new WMSParamsPanel(); |
|
164 |
toc.setLayerName((String)info.get("name")); |
|
168 | 165 |
toc.setWizardData(dataSource); |
169 |
|
|
166 |
|
|
170 | 167 |
toc.setVisible(true); |
171 | 168 |
toc.setListenerSupport(new WizardListenerSupport()); |
172 |
|
|
169 |
|
|
173 | 170 |
WMSLayerNode[] selectedLayers = (WMSLayerNode[]) ((Vector) info.get("selectedLayers")).toArray(new WMSLayerNode[0]); |
174 | 171 |
//boolean any = false; |
175 | 172 |
// selected layers |
176 | 173 |
//((JDnDListModel) toc.getLstSelectedLayers().getModel()).clear(); |
177 | 174 |
for (int i = 0; i < selectedLayers.length; i++) { |
178 | 175 |
toc.getJustTreeLayer().clearSelection(); |
179 |
// Se a?ade a la lista de layers seleccionados
|
|
176 |
// Se a?ade a la lista de layers seleccionados |
|
180 | 177 |
TreePath path = new TreePath(((LayerTreeModel)toc.getJustTreeLayer() |
181 | 178 |
.getModel()).getNodeByName(selectedLayers[i].getName())); |
182 | 179 |
toc.getJustTreeLayer().addSelectionPath(path); |
183 | 180 |
toc.addLayer(); |
184 | 181 |
//This block is deleted since this is implemented in the addLayer method. |
185 |
// JDnDListModel modelo = (JDnDListModel) toc.getLstSelectedLayers().getModel();
|
|
182 |
// JDnDListModel modelo = (JDnDListModel) toc.getLstSelectedLayers().getModel(); |
|
186 | 183 |
// if (modelo.addElement(0, selectedLayers[i])) { |
187 | 184 |
// any = true; |
188 | 185 |
// } |
... | ... | |
190 | 187 |
// if (any) { |
191 | 188 |
// toc.refreshData(); |
192 | 189 |
// } |
193 |
|
|
190 |
|
|
194 | 191 |
// srs |
195 | 192 |
String srs = (String) info.get("srs"); |
196 | 193 |
int index = toc.getSRSIndex( srs ); |
197 | 194 |
if (index != -1) |
198 | 195 |
toc.getLstSRSs().setSelectedIndex(index); |
199 |
|
|
196 |
|
|
200 | 197 |
// format |
201 | 198 |
String format = (String) info.get("format"); |
202 | 199 |
index = toc.getFormatIndex(format); |
203 | 200 |
if (index != -1) |
204 | 201 |
toc.getLstFormats().setSelectedIndex(index); |
205 |
|
|
202 |
|
|
206 | 203 |
// transparency |
207 | 204 |
toc.setTransparent(((Boolean) info.get("wmsTransparency")).booleanValue()); |
208 |
|
|
205 |
|
|
209 | 206 |
// styles |
210 | 207 |
Vector v = (Vector) info.get("styles"); |
211 | 208 |
if (v != null) |
212 | 209 |
toc.setStyleSelections(v); |
213 |
|
|
210 |
|
|
214 | 211 |
// dimensions |
215 | 212 |
v = (Vector) info.get("dimensions"); |
216 | 213 |
if (v != null) toc.setDimensions(v); |
217 |
|
|
214 |
|
|
218 | 215 |
// fixed sizes |
219 | 216 |
Dimension sz = (Dimension) info.get("fixedSize"); |
220 | 217 |
if (sz != null) toc.setFixedSize(sz); |
... | ... | |
227 | 224 |
e.printStackTrace(); |
228 | 225 |
} |
229 | 226 |
} |
230 |
return null;
|
|
227 |
return null; |
|
231 | 228 |
} |
232 |
|
|
233 | 229 |
|
230 |
|
|
234 | 231 |
public JPanel getButtonsPanel() { |
235 | 232 |
if (buttonsPanel == null) { |
236 | 233 |
m_actionListener = new CommandListener(this); |
237 | 234 |
buttonsPanel = new JPanel(); |
238 | 235 |
buttonsPanel.setBounds(5, wmsParamsTabbedPane.getHeight(), 471, 40); |
239 |
buttonsPanel.setLayout(null);
|
|
236 |
buttonsPanel.setLayout(null); |
|
240 | 237 |
buttonsPanel.setName("buttonPanel"); |
241 |
|
|
238 |
|
|
242 | 239 |
buttonsPanel.add(getBtnOk(), null); |
243 | 240 |
buttonsPanel.add(getBtnApply(), null); |
244 | 241 |
buttonsPanel.add(getBtnCancel(), null); |
245 | 242 |
} |
246 | 243 |
return buttonsPanel; |
247 | 244 |
} |
248 |
|
|
245 |
|
|
249 | 246 |
public JButton getBtnOk() { |
250 | 247 |
if (btnOk == null) { |
251 | 248 |
btnOk = new JButton("ok"); |
... | ... | |
256 | 253 |
} |
257 | 254 |
return btnOk; |
258 | 255 |
} |
259 |
|
|
256 |
|
|
260 | 257 |
public JButton getBtnApply() { |
261 | 258 |
if (btnApply == null) { |
262 | 259 |
btnApply = new JButton("apply"); |
... | ... | |
268 | 265 |
} |
269 | 266 |
return btnApply; |
270 | 267 |
} |
271 |
|
|
268 |
|
|
272 | 269 |
public JButton getBtnCancel() { |
273 | 270 |
if (btnCancel == null) { |
274 | 271 |
btnCancel = new JButton("cancel"); |
... | ... | |
279 | 276 |
} |
280 | 277 |
return btnCancel; |
281 | 278 |
} |
282 |
|
|
279 |
|
|
283 | 280 |
private class CommandListener implements ActionListener { |
284 |
|
|
281 |
|
|
285 | 282 |
/** |
286 | 283 |
* Creates a new ComandosListener object. |
287 | 284 |
* |
... | ... | |
304 | 301 |
ex.printStackTrace(); |
305 | 302 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage()); |
306 | 303 |
return; |
307 |
}
|
|
304 |
} |
|
308 | 305 |
((FLyrWMS) fLayer).setFormat(wmsParamsTabbedPane.getFormat()); |
309 |
|
|
306 |
|
|
310 | 307 |
if (!wmsParamsTabbedPane.getDisagregatedLayers()) |
311 | 308 |
((FLyrWMS) fLayer).setLayerQuery(wmsParamsTabbedPane.getLayersQuery()); |
312 | 309 |
((FLyrWMS) fLayer).setInfoLayerQuery(wmsParamsTabbedPane.getQueryableLayerQuery()); |
... | ... | |
316 | 313 |
((FLyrWMS) fLayer).setStyles(wmsParamsTabbedPane.getStyles()); |
317 | 314 |
((FLyrWMS) fLayer).setDimensions(wmsParamsTabbedPane.getDimensions()); |
318 | 315 |
((FLyrWMS) fLayer).setFixedSize(wmsParamsTabbedPane.getFixedSize()); |
319 |
|
|
316 |
|
|
320 | 317 |
//fLayer = wmsParamsTabbedPane.getLayer(); |
321 | 318 |
FLayers parent = fLayer.getParentLayer(); |
322 |
|
|
319 |
|
|
323 | 320 |
if (e.getActionCommand() == "APPLY"){ |
324 | 321 |
com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
325 | 322 |
MapControl mapCtrl = vista.getMapControl(); |
326 |
|
|
323 |
|
|
327 | 324 |
if (parent != null){ |
328 | 325 |
if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){ |
329 | 326 |
mapCtrl.getMapContext().getLayers(). |
... | ... | |
336 | 333 |
//mapCtrl.getMapContext().getLayers().addLayer( fLayer ); |
337 | 334 |
mapCtrl.getMapContext().invalidate(); |
338 | 335 |
applied = true; |
339 |
getBtnApply().setEnabled(!applied);
|
|
340 |
}
|
|
336 |
getBtnApply().setEnabled(!applied); |
|
337 |
} |
|
341 | 338 |
if (e.getActionCommand() == "OK") { |
342 | 339 |
if (!applied) { |
343 |
|
|
340 |
|
|
344 | 341 |
com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
345 | 342 |
MapControl mapCtrl = vista.getMapControl(); |
346 |
|
|
343 |
|
|
347 | 344 |
if (parent != null){ |
348 | 345 |
if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){ |
349 | 346 |
mapCtrl.getMapContext().getLayers(). |
... | ... | |
366 | 363 |
* @return |
367 | 364 |
*/ |
368 | 365 |
private FLayers mergeFLayers(FLayers group1, FLayers group2) |
369 |
{
|
|
366 |
{ |
|
370 | 367 |
//FLayers agrupation = new FLayers(group1.getFMap(), group1.getParentLayer()); |
371 | 368 |
FLayer layer; |
372 | 369 |
for(int i = 0; i < group2.getLayersCount(); i++) |
... | ... | |
376 | 373 |
group1.addLayer( layer ); |
377 | 374 |
} |
378 | 375 |
} |
379 |
|
|
376 |
|
|
380 | 377 |
return group1; |
381 | 378 |
} |
382 |
|
|
383 |
|
|
384 |
|
|
379 |
|
|
380 |
|
|
381 |
|
|
385 | 382 |
public ViewInfo getViewInfo() { |
386 | 383 |
if (m_ViewInfo==null){ |
387 | 384 |
m_ViewInfo=new ViewInfo(ViewInfo.MODALDIALOG); |
... | ... | |
392 | 389 |
} |
393 | 390 |
return m_ViewInfo; |
394 | 391 |
} |
395 |
|
|
392 |
|
|
396 | 393 |
public void close() { |
397 |
PluginServices.getMDIManager().closeView(this);
|
|
394 |
PluginServices.getMDIManager().closeView(this); |
|
398 | 395 |
} |
399 | 396 |
|
400 | 397 |
} // @jve:decl-index=0:visual-constraint="10,10" |
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/DimensionPanel.java | ||
---|---|---|
45 | 45 |
import java.util.Vector; |
46 | 46 |
|
47 | 47 |
import javax.swing.ButtonGroup; |
48 |
import javax.swing.JButton;
|
|
48 |
import org.gvsig.gui.beans.swing.JButton;
|
|
49 | 49 |
import javax.swing.JEditorPane; |
50 | 50 |
import javax.swing.JLabel; |
51 | 51 |
import javax.swing.JList; |
... | ... | |
63 | 63 |
|
64 | 64 |
/** |
65 | 65 |
* This is the Dimensions tab of the WMS wizard. |
66 |
*
|
|
66 |
* |
|
67 | 67 |
* @author jaume |
68 |
*
|
|
68 |
* |
|
69 | 69 |
*/ |
70 | 70 |
public class DimensionPanel extends DefaultBean { |
71 | 71 |
static private final int SINGLE_VALUE = 0; |
... | ... | |
106 | 106 |
* Will contain the settings for a getMap query which are just text. Since |
107 | 107 |
* only one Dimension definition expression is allowed the key for this hash |
108 | 108 |
* map is the dimension name. |
109 |
*
|
|
109 |
* |
|
110 | 110 |
* <b>key:</b> dimension name as string <br> |
111 | 111 |
* <b>value:</b> dimension value as string |
112 | 112 |
*/ |
... | ... | |
122 | 122 |
|
123 | 123 |
/** |
124 | 124 |
* This method initializes this |
125 |
*
|
|
125 |
* |
|
126 | 126 |
* @return void |
127 | 127 |
*/ |
128 | 128 |
private void initialize() { |
... | ... | |
138 | 138 |
|
139 | 139 |
/** |
140 | 140 |
* This method initializes jPanel |
141 |
*
|
|
141 |
* |
|
142 | 142 |
* @return javax.swing.JPanel |
143 | 143 |
*/ |
144 | 144 |
private Pager getJPanel() { |
... | ... | |
158 | 158 |
|
159 | 159 |
/** |
160 | 160 |
* This method initializes jPanel1 |
161 |
*
|
|
161 |
* |
|
162 | 162 |
* @return javax.swing.JPanel |
163 | 163 |
*/ |
164 | 164 |
private JPanel getJPanel1() { |
... | ... | |
194 | 194 |
|
195 | 195 |
/** |
196 | 196 |
* This method initializes jRadioButton |
197 |
*
|
|
197 |
* |
|
198 | 198 |
* @return javax.swing.JRadioButton |
199 | 199 |
*/ |
200 | 200 |
private JRadioButton getRdBtnSingleValue() { |
... | ... | |
214 | 214 |
|
215 | 215 |
/** |
216 | 216 |
* This method initializes jRadioButton1 |
217 |
*
|
|
217 |
* |
|
218 | 218 |
* @return javax.swing.JRadioButton |
219 | 219 |
*/ |
220 | 220 |
private JRadioButton getRdBtnMultipleValue() { |
... | ... | |
236 | 236 |
|
237 | 237 |
/** |
238 | 238 |
* This method initializes jRadioButton2 |
239 |
*
|
|
239 |
* |
|
240 | 240 |
* @return javax.swing.JRadioButton |
241 | 241 |
*/ |
242 | 242 |
private JRadioButton getRdBtnInterval() { |
... | ... | |
257 | 257 |
|
258 | 258 |
/** |
259 | 259 |
* This method initializes btnAdd |
260 |
*
|
|
260 |
* |
|
261 | 261 |
* @return javax.swing.JButton |
262 | 262 |
*/ |
263 | 263 |
private JButton getBtnAdd() { |
... | ... | |
316 | 316 |
settings.remove(currentDimension.getName()); |
317 | 317 |
callValueChanged(getDimensions()); |
318 | 318 |
} else if (actionCommand.equals("set")) { |
319 |
|
|
319 |
|
|
320 | 320 |
/* |
321 | 321 |
* Two kinds of input data is accepted: - An array of Integer |
322 | 322 |
* representing points which are computed and obtained from the |
... | ... | |
340 | 340 |
if ((type == Value.EXPR && !((String) val).equals("")) || |
341 | 341 |
(type == Value.INDEXES && ((Integer[]) val).length>0)){ |
342 | 342 |
settings.put(currentDimension.getName(), new Value(type, mode, val, currentDimension)); |
343 |
|
|
343 |
|
|
344 | 344 |
} |
345 | 345 |
callValueChanged(getDimensions()); |
346 | 346 |
} |
347 | 347 |
refreshInfo(); |
348 |
|
|
348 |
|
|
349 | 349 |
return b; |
350 | 350 |
} |
351 | 351 |
|
... | ... | |
414 | 414 |
|
415 | 415 |
/** |
416 | 416 |
* This method initializes txt |
417 |
*
|
|
417 |
* |
|
418 | 418 |
* @return javax.swing.JTextField |
419 | 419 |
*/ |
420 | 420 |
private JTextField getTxt() { |
... | ... | |
432 | 432 |
|
433 | 433 |
/** |
434 | 434 |
* This method initializes scrlDimension |
435 |
*
|
|
435 |
* |
|
436 | 436 |
* @return javax.swing.JScrollPane |
437 | 437 |
*/ |
438 | 438 |
private JScrollPane getScrlDimension() { |
... | ... | |
446 | 446 |
|
447 | 447 |
/** |
448 | 448 |
* This method initializes jList |
449 |
*
|
|
449 |
* |
|
450 | 450 |
* @return javax.swing.JList |
451 | 451 |
*/ |
452 | 452 |
private JList getLstDimensions() { |
... | ... | |
490 | 490 |
else |
491 | 491 |
getRdBtnInterval().setSelected(true); |
492 | 492 |
} |
493 |
|
|
493 |
|
|
494 | 494 |
// text of VALUE |
495 | 495 |
if (val.type == Value.EXPR) { |
496 | 496 |
txt.setText(val.getExpr()); |
... | ... | |
511 | 511 |
|
512 | 512 |
/** |
513 | 513 |
* This method initializes editionPanel |
514 |
*
|
|
514 |
* |
|
515 | 515 |
* @return javax.swing.JPanel |
516 | 516 |
*/ |
517 | 517 |
private JPanel getEditionPanel() { |
... | ... | |
538 | 538 |
|
539 | 539 |
/** |
540 | 540 |
* This method initializes scrDimInfo |
541 |
*
|
|
541 |
* |
|
542 | 542 |
* @return javax.swing.JScrollPane |
543 | 543 |
*/ |
544 | 544 |
private JScrollPane getScrDimInfo() { |
... | ... | |
552 | 552 |
|
553 | 553 |
/** |
554 | 554 |
* This method initializes infoEditor |
555 |
*
|
|
555 |
* |
|
556 | 556 |
* @return javax.swing.JEditorPane |
557 | 557 |
*/ |
558 | 558 |
private JEditorPane getInfoEditor() { |
... | ... | |
565 | 565 |
|
566 | 566 |
/** |
567 | 567 |
* This method initializes valuePanel |
568 |
*
|
|
568 |
* |
|
569 | 569 |
* @return javax.swing.JPanel |
570 | 570 |
*/ |
571 | 571 |
private JPanel getValuePanel() { |
... | ... | |
587 | 587 |
|
588 | 588 |
/** |
589 | 589 |
* This method initializes btnSet |
590 |
*
|
|
590 |
* |
|
591 | 591 |
* @return javax.swing.JButton |
592 | 592 |
*/ |
593 | 593 |
private JButton getBtnSet() { |
... | ... | |
606 | 606 |
|
607 | 607 |
/** |
608 | 608 |
* This method initializes btnClear |
609 |
*
|
|
609 |
* |
|
610 | 610 |
* @return javax.swing.JButton |
611 | 611 |
*/ |
612 | 612 |
private JButton getBtnClear() { |
... | ... | |
625 | 625 |
|
626 | 626 |
public void addDimension(IFMapWMSDimension d) throws IllegalArgumentException { |
627 | 627 |
d.compile(); |
628 |
|
|
628 |
|
|
629 | 629 |
if (dim == null) { |
630 | 630 |
dim = new IFMapWMSDimension[] { d }; |
631 | 631 |
} else { |
... | ... | |
680 | 680 |
* Sets the value for a Dimension given by the dimension name. The value is |
681 | 681 |
* set as a plain text expressions and the panel will not keep track of what |
682 | 682 |
* position represents this value. |
683 |
*
|
|
683 |
* |
|
684 | 684 |
* @param name |
685 | 685 |
* @param value |
686 | 686 |
*/ |
... | ... | |
710 | 710 |
private Object value; |
711 | 711 |
private IFMapWMSDimension owner; |
712 | 712 |
|
713 |
|
|
714 |
|
|
713 |
|
|
714 |
|
|
715 | 715 |
public Value(int type, int mode, Object value, IFMapWMSDimension owner) { |
716 | 716 |
this.type = type; |
717 | 717 |
this.valueMode = mode; |
... | ... | |
730 | 730 |
* a plain String that can be directly used as much it should represent |
731 | 731 |
* a valid value for the WMS server. </li> |
732 | 732 |
* </ol> |
733 |
*
|
|
733 |
* |
|
734 | 734 |
* @return int |
735 | 735 |
*/ |
736 | 736 |
public int getType() { |
... | ... | |
747 | 747 |
} |
748 | 748 |
|
749 | 749 |
/** |
750 |
* Expression of this value, if its type is EXPR
|
|
750 |
* Expression of this value, if its type is EXPR |
|
751 | 751 |
* @return |
752 | 752 |
*/ |
753 | 753 |
public String getExpr() { |
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/WMSParamsPanel.java | ||
---|---|---|
58 | 58 |
import java.util.prefs.Preferences; |
59 | 59 |
|
60 | 60 |
import javax.swing.ImageIcon; |
61 |
import javax.swing.JButton; |
|
62 | 61 |
import javax.swing.JCheckBox; |
63 | 62 |
import javax.swing.JOptionPane; |
64 | 63 |
import javax.swing.JPanel; |
... | ... | |
73 | 72 |
import org.cresques.cts.gt2.CoordTrans; |
74 | 73 |
import org.gvsig.gui.beans.controls.dnd.JDnDListModel; |
75 | 74 |
import org.gvsig.gui.beans.listeners.BeanListener; |
75 |
import org.gvsig.gui.beans.swing.JButton; |
|
76 | 76 |
|
77 | 77 |
import com.iver.andami.PluginServices; |
78 | 78 |
import com.iver.andami.messages.NotificationManager; |
... | ... | |
92 | 92 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
93 | 93 |
/** |
94 | 94 |
* This class implements the map option panel. |
95 |
*
|
|
95 |
* |
|
96 | 96 |
* It includes a set of Listeners that implement some control rules which |
97 | 97 |
* refresh the component values that depends on those selected in the other |
98 | 98 |
* components to avoid to choose an invalid set of options. It also includes a |
99 | 99 |
* method (isCorrectlyConfigured()) that checks if the current set of values is |
100 | 100 |
* enough to correctly launch a GetMap request. |
101 |
*
|
|
101 |
* |
|
102 | 102 |
* The information is obtained from a WMSWizardDataSource object. |
103 |
*
|
|
104 |
*
|
|
103 |
* |
|
104 |
* |
|
105 | 105 |
* Esta clase implementa el panel de opciones disponibles sobre el mapa |
106 |
*
|
|
106 |
* |
|
107 | 107 |
* Incluye una serie de Listeners que implementan unas reglas de control que |
108 |
* refrescan los valores de componentes cuyos valores dependen de aqu?llos
|
|
108 |
* refrescan los valores de componentes cuyos valores dependen de aqu?llos |
|
109 | 109 |
* seleccionados en otros componentes para evitar que se escoja una combinaci?n |
110 | 110 |
* de opciones err?nea as? como una funci?n (isCorrectlyConfigured()) que |
111 | 111 |
* comprueba si la combinaci?n escogida actualmente es suficiente para lanzar |
112 | 112 |
* una operaci?n GetMap correctamente. |
113 |
*
|
|
113 |
* |
|
114 | 114 |
* La informaci?n obtiene a partir de un objeto WMSWizardDataSource. |
115 |
*
|
|
115 |
* |
|
116 | 116 |
* @author jaume - jaume dominguez faus |
117 | 117 |
* |
118 | 118 |
*/ |
119 | 119 |
public class WMSParamsPanel extends WizardPanel { |
120 |
|
|
120 |
|
|
121 | 121 |
private javax.swing.JScrollPane jScrollPane1 = null; |
122 | 122 |
private javax.swing.JScrollPane jScrollPane2 = null; |
123 | 123 |
private javax.swing.JScrollPane jScrollPane5 = null; |
124 |
private javax.swing.JButton btnAdd = null;
|
|
125 |
private javax.swing.JButton btnDel = null;
|
|
124 |
private JButton btnAdd = null; |
|
125 |
private JButton btnDel = null; |
|
126 | 126 |
private javax.swing.JScrollPane jScrollPane6 = null; |
127 | 127 |
private javax.swing.JPanel jPanel2 = null; |
128 | 128 |
private javax.swing.JPanel tabFormats = null; |
... | ... | |
153 | 153 |
private JButton btnDown = null; |
154 | 154 |
public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wms-wizard" ); |
155 | 155 |
private JCheckBox chkDisagregate = null; |
156 |
|
|
156 |
|
|
157 | 157 |
public WMSParamsPanel(){ |
158 | 158 |
super(); |
159 | 159 |
initialize(); |
160 | 160 |
} |
161 |
|
|
162 |
//TODO: crear nuevo constructor para a?adir los panels que quieras...
|
|
161 |
|
|
162 |
//TODO: crear nuevo constructor para a?adir los panels que quieras... |
|
163 | 163 |
public WMSParamsPanel(WMSWizardData data) |
164 |
{
|
|
164 |
{ |
|
165 | 165 |
super(); |
166 | 166 |
setWizardData(data); |
167 | 167 |
this.setLayout(null); |
168 | 168 |
this.setVisible(false); |
169 | 169 |
this.setBounds(10, 5, 481, 427); |
170 |
|
|
170 |
|
|
171 | 171 |
if (jTabbedPane == null) { |
172 | 172 |
jTabbedPane = new JTabbedPane(); |
173 | 173 |
jTabbedPane.setBounds(3, 3, 475, 415); |
174 |
|
|
174 |
|
|
175 | 175 |
StylesPanel sp = getTabStyle(); |
176 | 176 |
DimensionPanel dp = getTabDimensions(); |
177 |
|
|
177 |
|
|
178 | 178 |
jTabbedPane.addTab(PluginServices.getText(this, "capas"), null, getTabLayers(), null); |
179 | 179 |
jTabbedPane.addTab(PluginServices.getText(this, "estilos"), null, sp, null); |
180 | 180 |
stylesTabIndex = jTabbedPane.getTabCount()-1; |
... | ... | |
185 | 185 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
186 | 186 |
} |
187 | 187 |
this.add(jTabbedPane, null); |
188 |
|
|
188 |
|
|
189 | 189 |
setListenerSupport(new WizardListenerSupport()); |
190 | 190 |
} |
191 |
|
|
192 |
|
|
191 |
|
|
192 |
|
|
193 | 193 |
/** |
194 | 194 |
* This method initializes panelPage2 |
195 | 195 |
* |
... | ... | |
216 | 216 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
217 | 217 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
218 | 218 |
jPanel2.add(getChkExtendedNames(), null); |
219 |
|
|
219 |
|
|
220 | 220 |
jPanel2.add(getJScrollPane1(), null); |
221 | 221 |
jPanel2.add(getBtnDel(), null); |
222 | 222 |
jPanel2.add(getBtnAdd(), null); |
... | ... | |
228 | 228 |
|
229 | 229 |
return jPanel2; |
230 | 230 |
} |
231 |
|
|
231 |
|
|
232 | 232 |
/** |
233 | 233 |
* This method initializes jPanel4 |
234 | 234 |
* |
... | ... | |
248 | 248 |
|
249 | 249 |
return jPanel4; |
250 | 250 |
} |
251 |
|
|
251 |
|
|
252 | 252 |
/** |
253 | 253 |
* This method initializes jPanel3 |
254 | 254 |
* |
... | ... | |
279 | 279 |
|
280 | 280 |
return jScrollPane1; |
281 | 281 |
} |
282 |
|
|
282 |
|
|
283 | 283 |
/** |
284 | 284 |
* This method initializes btnDel |
285 | 285 |
* |
286 | 286 |
* @return javax.swing.JButton |
287 | 287 |
*/ |
288 |
private javax.swing.JButton getBtnDel() {
|
|
288 |
private JButton getBtnDel() { |
|
289 | 289 |
if (btnDel == null) { |
290 |
btnDel = new javax.swing.JButton();
|
|
290 |
btnDel = new JButton(); |
|
291 | 291 |
//btnDel.setPreferredSize(new java.awt.Dimension(23, 23)); |
292 | 292 |
btnDel.setText(PluginServices.getText(this, "remove")); |
293 | 293 |
btnDel.setMargin(new java.awt.Insets(2, 0, 2, 0)); |
... | ... | |
301 | 301 |
} |
302 | 302 |
return btnDel; |
303 | 303 |
} |
304 |
|
|
304 |
|
|
305 | 305 |
/** |
306 | 306 |
* This method initializes btnAdd |
307 | 307 |
* |
... | ... | |
309 | 309 |
*/ |
310 | 310 |
private javax.swing.JButton getBtnAdd() { |
311 | 311 |
if (btnAdd == null) { |
312 |
btnAdd = new javax.swing.JButton();
|
|
312 |
btnAdd = new JButton(); |
|
313 | 313 |
//btnAdd.setPreferredSize(new java.awt.Dimension(23, 23)); |
314 | 314 |
btnAdd.setText(PluginServices.getText(this, "add")); |
315 | 315 |
btnAdd.setMargin(new java.awt.Insets(2, 0, 2, 0)); |
... | ... | |
323 | 323 |
} |
324 | 324 |
return btnAdd; |
325 | 325 |
} |
326 |
|
|
326 |
|
|
327 | 327 |
/** |
328 | 328 |
* This method initializes jScrollPane5 |
329 | 329 |
* |
... | ... | |
339 | 339 |
|
340 | 340 |
return jScrollPane5; |
341 | 341 |
} |
342 |
|
|
342 |
|
|
343 | 343 |
/** |
344 | 344 |
* This method initializes jTextField |
345 | 345 |
* |
... | ... | |
350 | 350 |
jTxtNomCapa = new JTextField(); |
351 | 351 |
jTxtNomCapa.setBounds(10, 19, 437, 20); |
352 | 352 |
jTxtNomCapa.setText(PluginServices.getText(this, "WMSLayer")); |
353 |
jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() {
|
|
354 |
public void keyTyped(java.awt.event.KeyEvent e) {
|
|
353 |
jTxtNomCapa.addKeyListener(new java.awt.event.KeyAdapter() { |
|
354 |
public void keyTyped(java.awt.event.KeyEvent e) { |
|
355 | 355 |
fireWizardComplete(isCorrectlyConfigured()); |
356 | 356 |
} |
357 | 357 |
}); |
... | ... | |
376 | 376 |
|
377 | 377 |
return jScrollPane6; |
378 | 378 |
} |
379 |
|
|
379 |
|
|
380 | 380 |
/** |
381 | 381 |
* This method initializes jScrollPane2 |
382 | 382 |
* |
... | ... | |
392 | 392 |
|
393 | 393 |
return jScrollPane2; |
394 | 394 |
} |
395 |
|
|
395 |
|
|
396 | 396 |
/** |
397 | 397 |
* Gets the available layers in WMS maintaining the tree structure |
398 | 398 |
* @return |
... | ... | |
400 | 400 |
public LayerTree getLayerStructure(){ |
401 | 401 |
return treeLayers; |
402 | 402 |
} |
403 |
|
|
403 |
|
|
404 | 404 |
/** |
405 | 405 |
* This method initializes treeLayers |
406 | 406 |
* |
... | ... | |
410 | 410 |
if (treeLayers == null) { |
411 | 411 |
treeLayers = new LayerTree(); |
412 | 412 |
treeLayers.setRootVisible(true); |
413 |
treeLayers.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
414 |
public void mouseClicked(java.awt.event.MouseEvent e) {
|
|
413 |
treeLayers.addMouseListener(new java.awt.event.MouseAdapter() { |
|
414 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
|
415 | 415 |
if (e.getClickCount() == 2){ |
416 | 416 |
addLayer(); |
417 | 417 |
} |
... | ... | |
420 | 420 |
treeLayers.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { |
421 | 421 |
public void valueChanged( |
422 | 422 |
javax.swing.event.TreeSelectionEvent e) { |
423 |
|
|
423 |
|
|
424 | 424 |
boolean isGetMapable = false; // pffff, jajaja |
425 | 425 |
TreePath[] selecciones = getTreeLayers().getSelectionPaths(); |
426 | 426 |
if (selecciones!=null) // no entenc perqu� peta ac� i li arriba null a voltes... |
... | ... | |
429 | 429 |
WMSLayerNode layer = ((WMSLayerNode) selecciones[i].getLastPathComponent()); |
430 | 430 |
isGetMapable = layer.getChildren().size()==0 || layer.getName()!=null; |
431 | 431 |
} |
432 |
|
|
432 |
|
|
433 | 433 |
} |
434 | 434 |
getBtnAdd().setEnabled(isGetMapable); |
435 | 435 |
fireWizardComplete(isCorrectlyConfigured()); |
... | ... | |
439 | 439 |
|
440 | 440 |
return treeLayers; |
441 | 441 |
} |
442 |
|
|
443 | 442 |
|
443 |
|
|
444 | 444 |
/** |
445 |
* This method checks for the options selected within the configuration dialog are
|
|
445 |
* This method checks for the options selected within the configuration dialog are |
|
446 | 446 |
* correct and enough to perform a GetMap request. |
447 | 447 |
* @return true if you're done, false if not. |
448 | 448 |
*/ |
449 | 449 |
public boolean isCorrectlyConfigured() { |
450 |
|
|
450 |
|
|
451 | 451 |
boolean b; |
452 | 452 |
this.repaint(); |
453 | 453 |
if ((getLstSRSs().getSelectedIndex() != -1) && |
... | ... | |
457 | 457 |
} else { |
458 | 458 |
b = false; |
459 | 459 |
} |
460 |
|
|
460 |
|
|
461 | 461 |
// Enable or disable del button. |
462 | 462 |
int[] selectedIndices = getLstSelectedLayers().getSelectedIndices(); |
463 |
|
|
463 |
|
|
464 | 464 |
getBtnDel().setEnabled( |
465 |
selectedIndices != null
|
|
465 |
selectedIndices != null |
|
466 | 466 |
&& selectedIndices.length>0 |
467 | 467 |
); |
468 |
|
|
468 |
|
|
469 | 469 |
return b; |
470 | 470 |
} |
471 |
|
|
471 |
|
|
472 | 472 |
public WMSLayerNode[] selectedLayersToArray() { |
473 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel());
|
|
473 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
|
474 | 474 |
ArrayList elements = modelo.getElements(); |
475 | 475 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
476 | 476 |
return layers; |
477 | 477 |
} |
478 |
|
|
478 |
|
|
479 | 479 |
/** |
480 | 480 |
* DOCUMENT ME! |
481 | 481 |
*/ |
... | ... | |
485 | 485 |
try { |
486 | 486 |
ArrayList removeList = new ArrayList(); |
487 | 487 |
WMSLayerNode[] infos = selectedLayersToArray(); |
488 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel());
|
|
488 |
JDnDListModel modelo = ((JDnDListModel) lstSelectedLayers.getModel()); |
|
489 | 489 |
for (int i = 0; i < indices.length; i++) { |
490 | 490 |
removeList.add(infos[indices[i]]); |
491 |
}
|
|
491 |
} |
|
492 | 492 |
modelo.delIndices(indices); |
493 | 493 |
lstSelectedLayers.clearSelection(); |
494 | 494 |
fireWizardComplete(isCorrectlyConfigured()); |
495 |
|
|
495 |
|
|
496 | 496 |
//delete from selectedPaths as well |
497 | 497 |
WMSLayerNode elemento = null; |
498 | 498 |
WMSLayerNode last = null; |
... | ... | |
501 | 501 |
elemento = (WMSLayerNode)removeList.get(i); |
502 | 502 |
for(int j = 0; j < selectedPaths.size(); j++){ |
503 | 503 |
path = (TreePath)selectedPaths.get( j ); |
504 |
last = (WMSLayerNode)path.getLastPathComponent();
|
|
504 |
last = (WMSLayerNode)path.getLastPathComponent(); |
|
505 | 505 |
if (last.getTitle().compareTo(elemento.getTitle()) == 0 ){ |
506 | 506 |
selectedPaths.remove(path); |
507 | 507 |
} |
508 | 508 |
} |
509 | 509 |
} |
510 |
|
|
510 |
|
|
511 | 511 |
refreshData(); |
512 | 512 |
refreshInfo(); |
513 | 513 |
} catch (ArrayIndexOutOfBoundsException ex) { |
... | ... | |
515 | 515 |
ex.printStackTrace(); |
516 | 516 |
} |
517 | 517 |
} |
518 |
|
|
518 |
|
|
519 | 519 |
/** |
520 | 520 |
* Fires a notification to this wizard listeners telling them if the |
521 | 521 |
* configuration is fair enough to send a GetMap request. |
... | ... | |
525 | 525 |
listenerSupport.callStateChanged(b); |
526 | 526 |
callStateChanged(b); |
527 | 527 |
} |
528 |
|
|
528 |
|
|
529 | 529 |
/** |
530 | 530 |
* Refreshes the content shown by this. |
531 | 531 |
*/ |
... | ... | |
534 | 534 |
getLstSelectedLayers().repaint(); |
535 | 535 |
refreshStyleTree(); |
536 | 536 |
refreshDimensions(); |
537 |
|
|
537 |
|
|
538 | 538 |
} |
539 |
|
|
539 |
|
|
540 | 540 |
/** |
541 | 541 |
* Refreshes the info tab |
542 | 542 |
* |
543 | 543 |
*/ |
544 | 544 |
public void refreshInfo() { |
545 |
getTabInfo().refresh(dataSource,
|
|
545 |
getTabInfo().refresh(dataSource, |
|
546 | 546 |
selectedLayersVector(), |
547 | 547 |
getStyleTitles(), |
548 | 548 |
getFormat(), |
... | ... | |
560 | 560 |
|
561 | 561 |
for (int j = 0; j < node.getDimensions().size(); j++) { |
562 | 562 |
IFMapWMSDimension dim = (IFMapWMSDimension) node.getDimensions().get(j); |
563 |
|
|
563 |
|
|
564 | 564 |
try { |
565 | 565 |
getTabDimensions().addDimension(dim); |
566 | 566 |
enable = true; |
... | ... | |
571 | 571 |
} |
572 | 572 |
} |
573 | 573 |
jTabbedPane.setEnabledAt(dimensionTabIndex, enable); |
574 |
|
|
574 |
|
|
575 | 575 |
} |
576 | 576 |
|
577 | 577 |
/** |
578 |
*
|
|
578 |
* |
|
579 | 579 |
*/ |
580 | 580 |
private void refreshStyleTree() { |
581 |
|
|
581 |
|
|
582 | 582 |
int size = getLstSelectedLayers().getModel().getSize(); |
583 | 583 |
WMSLayerNode styleRoot = new WMSLayerNode(); |
584 | 584 |
styleRoot.setTitle(PluginServices.getText(this, "selected_layers")); |
585 |
|
|
585 |
|
|
586 | 586 |
StyleTreeModel model = new StyleTreeModel(styleRoot); |
587 | 587 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
588 | 588 |
for (int i=0; i<size; i++){ |
... | ... | |
592 | 592 |
jTabbedPane.setEnabledAt(stylesTabIndex, true); |
593 | 593 |
} |
594 | 594 |
} |
595 |
|
|
595 |
|
|
596 | 596 |
getStyleTree().setModel(model); |
597 | 597 |
getStyleTree().expandAll(); |
598 | 598 |
getStyleTree().repaint(); |
599 | 599 |
} |
600 |
|
|
600 |
|
|
601 | 601 |
/** |
602 | 602 |
* Takes the array of selected layers and a vector containing the style names |
603 | 603 |
* and set them as selected in the styles panel |
... | ... | |
605 | 605 |
* @param styles |
606 | 606 |
*/ |
607 | 607 |
public void setStyleSelections(Vector styles) { |
608 |
|
|
608 |
|
|
609 | 609 |
WMSLayerNode[] layers = selectedLayersToArray(); |
610 | 610 |
int length = layers.length; |
611 | 611 |
for (int i = 0; i < length; i++) { |
... | ... | |
613 | 613 |
layers[length - i - 1].setSelectedStyleByName(styleName); |
614 | 614 |
} |
615 | 615 |
} |
616 |
|
|
616 |
|
|
617 | 617 |
/** |
618 | 618 |
* Gets the currently shown style tree. |
619 | 619 |
* @return |
... | ... | |
621 | 621 |
private StyleTree getStyleTree() { |
622 | 622 |
return getTabStyle().getStyleTree(); |
623 | 623 |
} |
624 |
|
|
625 |
|
|
626 | 624 |
|
625 |
|
|
626 |
|
|
627 | 627 |
/** |
628 | 628 |
* Method called when pressing the Add layer button or when double-clicking on |
629 | 629 |
* a layer from the server's layer tree. |
... | ... | |
635 | 635 |
if (selecciones == null) |
636 | 636 |
return; |
637 | 637 |
for (int i = 0; i < selecciones.length; i++) { |
638 |
selectedPaths.add(selecciones[i]);
|
|
638 |
selectedPaths.add(selecciones[i]); |
|
639 | 639 |
WMSLayerNode nodo = (WMSLayerNode) selecciones[i].getLastPathComponent(); |
640 | 640 |
if (nodo.getName() == null || nodo.getName().equals("")) |
641 | 641 |
// no es un node que es puga demanar |
... | ... | |
663 | 663 |
} |
664 | 664 |
refreshInfo(); |
665 | 665 |
} |
666 |
|
|
666 |
|
|
667 | 667 |
/** |
668 | 668 |
* This method initializes lstSelectedLayers |
669 | 669 |
* |
... | ... | |
681 | 681 |
}); |
682 | 682 |
lstSelectedLayers.addMouseListener(new MouseAdapter(){ |
683 | 683 |
public void mouseReleased(MouseEvent e) { |
684 |
refreshData();
|
|
684 |
refreshData(); |
|
685 | 685 |
} |
686 | 686 |
}); |
687 | 687 |
} |
688 | 688 |
|
689 | 689 |
return lstSelectedLayers; |
690 | 690 |
} |
691 |
|
|
691 |
|
|
692 | 692 |
/** |
693 | 693 |
* This method initializes lstSRSs |
694 | 694 |
* |
... | ... | |
738 | 738 |
private void refreshSRS() { |
739 | 739 |
ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements(); |
740 | 740 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
741 |
|
|
742 |
SRSListModel model = new SRSListModel(); |
|
743 | 741 |
|
742 |
SRSListModel model = new SRSListModel(); |
|
743 |
|
|
744 | 744 |
if (layers.length == 0) { |
745 | 745 |
lstSRSs.setModel(model);//new DefaultListModel()); |
746 | 746 |
sizeFixed = null; |
... | ... | |
756 | 756 |
int srsIndex = getSRSIndex( oldSRS ); |
757 | 757 |
if (srsIndex!=-1) |
758 | 758 |
getLstSRSs().setSelectedIndex(srsIndex); |
759 |
|
|
759 |
|
|
760 | 760 |
} |
761 | 761 |
|
762 | 762 |
public void setListenerSupport(WizardListenerSupport support) { |
... | ... | |
767 | 767 |
this.dataSource = data; |
768 | 768 |
((JDnDListModel) getLstSelectedLayers().getModel()).clear(); |
769 | 769 |
getLstSelectedLayers().repaint(); |
770 |
|
|
770 |
|
|
771 | 771 |
getLstFormats().setModel(new FormatListModel(this.dataSource.getFormats())); |
772 | 772 |
getTreeLayers().setModel(new LayerTreeModel(this.dataSource.getLayer())); |
773 | 773 |
refreshInfo(); |
774 | 774 |
} |
775 |
|
|
775 |
|
|
776 | 776 |
private Vector getStyleTitles() { |
777 | 777 |
return getTabStyle().getStyleTree().getStyleSelectionTitles(); |
778 | 778 |
} |
... | ... | |
796 | 796 |
public String getLayersQuery() { |
797 | 797 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements(); |
798 | 798 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
799 |
|
|
799 |
|
|
800 | 800 |
//Nombre separado por comas de las capas |
801 | 801 |
String layersQuery = layers[layers.length-1].getName(); |
802 | 802 |
|
... | ... | |
805 | 805 |
} |
806 | 806 |
|
807 | 807 |
return layersQuery; |
808 |
|
|
808 |
|
|
809 | 809 |
} |
810 | 810 |
|
811 | 811 |
/** |
... | ... | |
817 | 817 |
} |
818 | 818 |
|
819 | 819 |
/** |
820 |
* Returns the name of the layer that the user has typed-in
|
|
820 |
* Returns the name of the layer that the user has typed-in |
|
821 | 821 |
* @return |
822 | 822 |
*/ |
823 | 823 |
public String getLayerName() { |
824 |
return getJTxtNomCapa().getText();
|
|
824 |
return getJTxtNomCapa().getText(); |
|
825 | 825 |
} |
826 |
|
|
826 |
|
|
827 | 827 |
public void setLayerName(String name) { |
828 |
getJTxtNomCapa().setText(name);
|
|
828 |
getJTxtNomCapa().setText(name); |
|
829 | 829 |
} |
830 |
|
|
830 |
|
|
831 | 831 |
public Rectangle2D getLayersRectangle() throws CannotReprojectException{ |
832 | 832 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements(); |
833 | 833 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
... | ... | |
837 | 837 |
} |
838 | 838 |
//Boundingbox de todas las capas |
839 | 839 |
//ArrayList rectangulos = new ArrayList(); |
840 |
|
|
840 |
|
|
841 | 841 |
Rectangle2D rect; |
842 | 842 |
String latLonID; |
843 |
|
|
843 |
|
|
844 | 844 |
rect = dataSource.getBoundingBox(layerNames, getSRS()); |
845 | 845 |
if(rect == null) { |
846 | 846 |
latLonID = "EPSG:4326"; |
... | ... | |
848 | 848 |
if (rect == null) { |
849 | 849 |
rect = dataSource.getBoundingBox(layerNames, "CRS:84"); |
850 | 850 |
} |
851 |
|
|
851 |
|
|
852 | 852 |
IProjection reqProj = ProjectionPool.get(getSRS()); |
853 |
IProjection latLonProj = ProjectionPool.get(latLonID); |
|
853 |
IProjection latLonProj = ProjectionPool.get(latLonID); |
Also available in: Unified diff