svn-gvsig-desktop / tags / Root_v061 / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / ChooseResourceDialog.java @ 4812
History | View | Annotate | Download (3.83 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 | 2833 | jorpiell | import com.iver.andami.PluginServices; |
49 | 2819 | jorpiell | import com.iver.andami.ui.mdiManager.View; |
50 | import com.iver.andami.ui.mdiManager.ViewInfo; |
||
51 | |||
52 | 3567 | jorpiell | import es.gva.cit.catalogClient.schemas.discoverer.Resource; |
53 | 3823 | jorpiell | import es.gva.cit.catalogClient.traductor.Translator; |
54 | 3224 | jorpiell | import es.gva.cit.catalogClient.ui.chooseResource.ChooseResourceDialogPanel; |
55 | 3818 | jorpiell | import es.gva.cit.gvsig.catalogClient.loaders.LayerLoader; |
56 | import es.gva.cit.gvsig.catalogClient.loaders.LayerLoaderException; |
||
57 | 3202 | jorpiell | import es.gva.cit.gvsig.catalogClient.translation.AndamiTranslation; |
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 | implements View { |
||
66 | 3818 | jorpiell | |
67 | /**
|
||
68 | * @param resources
|
||
69 | * Found resources array
|
||
70 | */
|
||
71 | public ChooseResourceDialog(Collection resources) { |
||
72 | super(resources,new AndamiTranslation()); |
||
73 | } |
||
74 | |||
75 | public ViewInfo getViewInfo() {
|
||
76 | 2819 | jorpiell | ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
77 | 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 | PluginServices.getMDIManager().closeView(ChooseResourceDialog.this); |
||
88 | } |
||
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 | loader = LayerLoader.getLoader(resource,translator); |
||
97 | if (loader != null) { |
||
98 | loader.loadLayer(); |
||
99 | 3823 | jorpiell | } else {
|
100 | JOptionPane.showMessageDialog(this, |
||
101 | Translator.getText(translator,"pluginNotFound") ,
|
||
102 | Translator.getText(translator,"pluginNotFoundTitle"),
|
||
103 | 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 |