svn-gvsig-desktop / tags / v1_0_2_Build_903 / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / ChooseResourceDialog.java @ 10704
History | View | Annotate | Download (3.7 KB)
1 | 2819 | jorpiell | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | 3818 | jorpiell | *
|
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 | 2819 | jorpiell | package es.gva.cit.gvsig.catalogClient.gui; |
42 | |||
43 | 3818 | jorpiell | import java.lang.reflect.InvocationTargetException; |
44 | 3567 | jorpiell | import java.util.Collection; |
45 | 2823 | jorpiell | |
46 | 2842 | jorpiell | import javax.swing.JOptionPane; |
47 | |||
48 | 4713 | cesar | import org.gvsig.i18n.Messages; |
49 | |||
50 | 2833 | jorpiell | import com.iver.andami.PluginServices; |
51 | 6877 | cesar | import com.iver.andami.ui.mdiManager.IWindow; |
52 | 6880 | cesar | import com.iver.andami.ui.mdiManager.WindowInfo; |
53 | 2819 | jorpiell | |
54 | 3567 | jorpiell | import es.gva.cit.catalogClient.schemas.discoverer.Resource; |
55 | 3224 | jorpiell | import es.gva.cit.catalogClient.ui.chooseResource.ChooseResourceDialogPanel; |
56 | 3818 | jorpiell | import es.gva.cit.gvsig.catalogClient.loaders.LayerLoader; |
57 | import es.gva.cit.gvsig.catalogClient.loaders.LayerLoaderException; |
||
58 | 2819 | jorpiell | |
59 | /**
|
||
60 | 2961 | jorpiell | * This class implements the resources list view.
|
61 | *
|
||
62 | 2819 | jorpiell | * @author Jorge Piera Llodra (piera_jor@gva.es)
|
63 | */
|
||
64 | public class ChooseResourceDialog extends ChooseResourceDialogPanel |
||
65 | 6877 | cesar | implements IWindow {
|
66 | 3818 | jorpiell | |
67 | /**
|
||
68 | * @param resources
|
||
69 | * Found resources array
|
||
70 | */
|
||
71 | public ChooseResourceDialog(Collection resources) { |
||
72 | 4713 | cesar | super(resources);
|
73 | 3818 | jorpiell | } |
74 | |||
75 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
76 | WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
||
77 | 2819 | jorpiell | m_viewinfo.setTitle(getName()); |
78 | return m_viewinfo;
|
||
79 | } |
||
80 | 3818 | jorpiell | |
81 | public void closeButtonActionPerformed() { |
||
82 | closeJDialog(); |
||
83 | } |
||
84 | |||
85 | public void closeJDialog() { |
||
86 | 2833 | jorpiell | setVisible(true);
|
87 | 6880 | cesar | PluginServices.getMDIManager().closeWindow(ChooseResourceDialog.this); |
88 | 2833 | jorpiell | } |
89 | 3818 | jorpiell | |
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 | 4713 | cesar | loader = LayerLoader.getLoader(resource); |
97 | 3818 | jorpiell | if (loader != null) { |
98 | loader.loadLayer(); |
||
99 | 3823 | jorpiell | } else {
|
100 | JOptionPane.showMessageDialog(this, |
||
101 | 4713 | cesar | Messages.getText("pluginNotFound") ,
|
102 | Messages.getText("pluginNotFoundTitle"),
|
||
103 | 3823 | jorpiell | JOptionPane.INFORMATION_MESSAGE);
|
104 | return;
|
||
105 | } |
||
106 | 3818 | jorpiell | |
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 | 3823 | jorpiell | JOptionPane.showMessageDialog(this, |
127 | 3818 | jorpiell | e.getMessage(), |
128 | e.getWindowMessage(), |
||
129 | JOptionPane.ERROR_MESSAGE);
|
||
130 | } |
||
131 | closeJDialog(); |
||
132 | } |
||
133 | } |
||
134 | 2819 | jorpiell | |
135 | 3818 | jorpiell | |
136 | |||
137 |