svn-gvsig-desktop / tags / v1_1_Build_1014 / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / ChooseResourceDialog.java @ 13593
History | View | Annotate | Download (3.7 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package es.gva.cit.gvsig.catalogClient.gui; |
42 |
|
43 |
import java.lang.reflect.InvocationTargetException; |
44 |
import java.util.Collection; |
45 |
|
46 |
import javax.swing.JOptionPane; |
47 |
|
48 |
import org.gvsig.i18n.Messages; |
49 |
|
50 |
import com.iver.andami.PluginServices; |
51 |
import com.iver.andami.ui.mdiManager.IWindow; |
52 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
53 |
|
54 |
import es.gva.cit.catalogClient.schemas.discoverer.Resource; |
55 |
import es.gva.cit.catalogClient.ui.chooseResource.ChooseResourceDialogPanel; |
56 |
import es.gva.cit.gvsig.catalogClient.loaders.LayerLoader; |
57 |
import es.gva.cit.gvsig.catalogClient.loaders.LayerLoaderException; |
58 |
|
59 |
/**
|
60 |
* This class implements the resources list view.
|
61 |
*
|
62 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
63 |
*/
|
64 |
public class ChooseResourceDialog extends ChooseResourceDialogPanel |
65 |
implements IWindow {
|
66 |
|
67 |
/**
|
68 |
* @param resources
|
69 |
* Found resources array
|
70 |
*/
|
71 |
public ChooseResourceDialog(Collection resources) { |
72 |
super(resources);
|
73 |
} |
74 |
|
75 |
public WindowInfo getWindowInfo() {
|
76 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
77 |
m_viewinfo.setTitle(getName()); |
78 |
return m_viewinfo;
|
79 |
} |
80 |
|
81 |
public void closeButtonActionPerformed() { |
82 |
closeJDialog(); |
83 |
} |
84 |
|
85 |
public void closeJDialog() { |
86 |
setVisible(true);
|
87 |
PluginServices.getMDIManager().closeWindow(ChooseResourceDialog.this); |
88 |
} |
89 |
|
90 |
/**
|
91 |
* This method is invocated when a resource button is clicked
|
92 |
*/
|
93 |
public void resourceButtonActionPerformed(Resource resource){ |
94 |
LayerLoader loader = null;
|
95 |
try {
|
96 |
loader = LayerLoader.getLoader(resource); |
97 |
if (loader != null) { |
98 |
loader.loadLayer(); |
99 |
} else {
|
100 |
JOptionPane.showMessageDialog(this, |
101 |
Messages.getText("pluginNotFound") ,
|
102 |
Messages.getText("pluginNotFoundTitle"),
|
103 |
JOptionPane.INFORMATION_MESSAGE);
|
104 |
return;
|
105 |
} |
106 |
|
107 |
} catch (IllegalArgumentException e) { |
108 |
// TODO Auto-generated catch block
|
109 |
e.printStackTrace(); |
110 |
} catch (SecurityException e) { |
111 |
// TODO Auto-generated catch block
|
112 |
e.printStackTrace(); |
113 |
} catch (InstantiationException e) { |
114 |
// TODO Auto-generated catch block
|
115 |
e.printStackTrace(); |
116 |
} catch (IllegalAccessException e) { |
117 |
// TODO Auto-generated catch block
|
118 |
e.printStackTrace(); |
119 |
} catch (InvocationTargetException e) { |
120 |
// TODO Auto-generated catch block
|
121 |
e.printStackTrace(); |
122 |
} catch (NoSuchMethodException e) { |
123 |
// TODO Auto-generated catch block
|
124 |
e.printStackTrace(); |
125 |
} catch (LayerLoaderException e) {
|
126 |
JOptionPane.showMessageDialog(this, |
127 |
e.getMessage(), |
128 |
e.getWindowMessage(), |
129 |
JOptionPane.ERROR_MESSAGE);
|
130 |
} |
131 |
closeJDialog(); |
132 |
} |
133 |
} |
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|