Revision 1161

View differences:

org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/buildNumber.properties
1
#Sun Jul 09 18:53:36 CEST 2023
2
buildNumber=2279
0 3

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
    <dependencySet>
27
      <useProjectArtifact>false</useProjectArtifact>
28
      <useTransitiveDependencies>false</useTransitiveDependencies>
29
      <outputDirectory>lib</outputDirectory>
30
      <includes>
31
<!--           		<include>org.gvsig:org.gvsig.raster.wcs.io</include> -->
32
<!--       			<include>org.gvsig:org.gvsig.raster.wcs.app.wcsclient</include> -->
33
           		<include>org.gvsig:org.gvsig.catalog.lib</include>
34
           		<!--
35
        		<include>org.gvsig:org.gvsig.remoteclient</include>
36
        		-->
37
        		<include>org.jzkit:a2j-runtime</include>
38
        		<include>org.jzkit:a2j</include>
39
        		<include>commons-beanutils:commons-beanutils</include>
40
        		<include>commons-httpclient:commons-httpclient</include>
41
        		<include>commons-logging:commons-logging</include>
42
        		<include>org.dspace:cql-java</include>
43
        		<include>jdom:jdom</include>
44
        		<include>org.jzkit:jzkit2-core</include>
45
        		<include>org.jzkit:jzkit2-z3950</include>
46
        		<include>org.jzkit:jzkit2-origin</include>
47
        		<include>soap:soap</include>
48
        		<include>net.swing:amic-util</include>
49
        		<include>org.springframework:spring</include> 
50

  
51
      </includes>
52
    </dependencySet>
53
  </dependencySets>
54

  
55
</assembly>
0 56

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/SearchDialog.java
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 org.gvsig.catalog.gui;
42

  
43
import java.awt.Frame;
44
import java.awt.geom.Rectangle2D;
45

  
46
import javax.swing.Icon;
47
import javax.swing.JDialog;
48

  
49
import org.gvsig.andami.IconThemeHelper;
50
import org.gvsig.andami.PluginServices;
51
import org.gvsig.andami.ui.mdiManager.IWindow;
52
import org.gvsig.andami.ui.mdiManager.WindowInfo;
53
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
54
import org.gvsig.catalog.CatalogClient;
55
import org.gvsig.catalog.drivers.GetRecordsReply;
56
import org.gvsig.catalog.querys.Coordinates;
57
import org.gvsig.catalog.ui.search.SearchDialogPanel;
58
import org.gvsig.catalog.utils.Frames;
59
import org.gvsig.fmap.mapcontext.events.ColorEvent;
60
import org.gvsig.fmap.mapcontext.events.ExtentEvent;
61
import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
62
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener;
63
import org.gvsig.i18n.Messages;
64

  
65

  
66
/**
67
 * This class is used to search a record using the catalog client
68
 * @author luisw
69
 * @modified by Jorge Piera
70
 */
71
public class SearchDialog extends SearchDialogPanel implements
72
IWindow,ViewPortListener {    
73
	public WindowInfo m_windowInfo = null;
74
	public ConnectDialog parentDialog = null;
75
	public JDialog frame = null;
76

  
77
	public SearchDialog(CatalogClient client, Object serverConnectFrame) {
78
		super(client,serverConnectFrame);
79
		parentDialog = (ConnectDialog)serverConnectFrame;
80
		setViewChangeListener();		
81
		loadViewPortCoordinates();
82
	}
83

  
84
	/* (non-Javadoc)
85
	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
86
	 */
87
	public WindowInfo getWindowInfo() {
88
		if (m_windowInfo == null){
89
			m_windowInfo = new WindowInfo(WindowInfo.PALETTE);
90
			m_windowInfo.setTitle(Messages.getText("gazetteer_search") + " [" +
91
					getCurrentServer() + "]");		
92
			m_windowInfo.setHeight(80);
93
			m_windowInfo.setWidth(525);
94
		}
95
		return m_windowInfo;
96

  
97
	}
98
	public Object getWindowProfile(){
99
		return WindowInfo.TOOL_PROFILE;
100
	}
101

  
102
	protected void showResultsActionPerformed(GetRecordsReply recordsReply) {
103
		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
104
		Frames.centerFrame(panel,620,420);
105
		panel.setTitle(Messages.getText( "search_results")); 
106
		panel.setResizable(false);
107
		ShowResultsDialog dialog = new ShowResultsDialog(panel,
108
				client,
109
				recordsReply,
110
				1);
111
		panel.getContentPane().add(dialog);
112
		panel.setVisible(true); 
113
	}
114

  
115
	protected void closeButtonActionPerformed() {
116
		closeJDialog();
117
	}
118

  
119
	/**
120
	 * Size button action performed
121
	 */	 
122
	protected void resizeButtonActionPerformed(){
123
		if (isMinimized){
124
			frame.setSize(frame.getWidth(),495);
125
			getLowerPanel().setVisible(true);
126
			getUpperPanel().setUpIcon();
127
		}else{
128
			frame.setSize(frame.getWidth(),165);
129
			getLowerPanel().setVisible(false);	 			
130
			getUpperPanel().setDownIcon();
131
		}
132
		isMinimized = !isMinimized;
133
	}
134
	
135
	/*
136
	 * (non-Javadoc)
137
	 * @see org.gvsig.catalog.ui.search.SearchDialogPanel#getUpIcon()
138
	 */
139
	protected Icon getUpIcon(){
140
	    // catalog-move-down
141
        // catalog-move-up
142
        // catalog-server-properties
143
        return IconThemeHelper.getImageIcon("catalog-move-up");
144
	}
145
	
146
	/*
147
	 * (non-Javadoc)
148
	 * @see org.gvsig.catalog.ui.search.SearchDialogPanel#getDownIcon()
149
	 */
150
	protected Icon getDownIcon() {
151
        // catalog-move-down
152
        // catalog-move-up
153
        // catalog-server-properties
154
        return IconThemeHelper.getImageIcon("catalog-move-down");
155
	}
156
	
157
	/**
158
	 * Return button action
159
	 */
160
	protected void lastButtonActionPerformed() {  
161
		closeJDialog();
162
		ConnectDialog serverConnect = (ConnectDialog)serverConnectFrame;
163
		serverConnect.setVisible(true);
164
		serverConnect.getControlsPanel().enableSearchButton(false);
165
		PluginServices.getMDIManager().addWindow(serverConnect);
166
	} 
167

  
168
	public void closeJDialog() {
169
		frame.setVisible(false);
170
	}
171

  
172
	/**
173
	 * This method loads the view coordinates to the catalog search dialog
174
	 *
175
	 */
176
	private void loadViewPortCoordinates(){
177
		AbstractViewPanel activeView = 
178
			(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
179

  
180
		Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent();
181

  
182
		try{
183
			getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
184
					r2d.getMaxY(),
185
					r2d.getMaxX(),
186
					r2d.getMinY()));
187
		}catch(NullPointerException E){
188
			//We cant retrieve the coordinates if it doesn't 
189
			//exist a loaded layer
190
		}
191
	}
192
	/*
193
	 * This method joins the viewPort event to the listener
194
	 */
195
	private void setViewChangeListener(){
196
		AbstractViewPanel activeView = 
197
			(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
198

  
199
		activeView.getMapControl().getViewPort().addViewPortListener(this);
200

  
201
	}
202

  
203
	public void extentChanged(ExtentEvent e) {
204
		loadViewPortCoordinates();   
205

  
206
	}
207

  
208
	public void backColorChanged(ColorEvent e) {
209
		// TODO Auto-generated method stub
210

  
211
	}
212

  
213
	public void projectionChanged(ProjectionEvent e) {
214
		loadViewPortCoordinates();		
215
	}
216

  
217
	public void setFrame(JDialog frame) {
218
		this.frame = frame;
219
	} 	 	    
220
}
0 221

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/LoaderWizardPanel.java
1
package org.gvsig.catalog.gui;
2

  
3
import java.awt.Dimension;
4
import java.awt.event.ActionEvent;
5
import java.awt.event.ActionListener;
6

  
7
import javax.swing.JButton;
8
import javax.swing.JComponent;
9
import javax.swing.JOptionPane;
10
import javax.swing.event.ListSelectionEvent;
11
import javax.swing.event.ListSelectionListener;
12

  
13
import org.apache.commons.lang3.StringUtils;
14
import org.gvsig.app.gui.WizardPanel;
15
import org.gvsig.app.gui.wizards.WizardListener;
16
import org.gvsig.catalog.loaders.WCSLayerLoader;
17
import org.gvsig.fmap.dal.DataStoreParameters;
18
import org.gvsig.i18n.Messages;
19
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.WCSParamsPanel;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22

  
23
public class LoaderWizardPanel implements WizardListener, ListSelectionListener{
24
	
25
	private Logger logger = LoggerFactory.getLogger(LoaderWizardPanel.class);
26

  
27
	private WizardPanel wizardPanel;
28
	private JButton OKButton;
29
	private JButton CancelButton;
30
	private DataStoreParameters dataStoreParameters;
31
	
32
	public LoaderWizardPanel(WizardPanel panel){
33
		this(panel, null);
34
	}
35
	
36
	public LoaderWizardPanel(WizardPanel panel, DataStoreParameters dataStoreParameters){
37
		this.dataStoreParameters = dataStoreParameters;
38
		
39
		this.wizardPanel = panel;
40
		this.wizardPanel.setVisible(true);
41
		this.wizardPanel.setPreferredSize(new Dimension(510, 427));
42
		
43
		this.wizardPanel.addWizardListener(this);
44
		((WCSParamsPanel)this.wizardPanel).getFormatsPanel().getLstCRSs().addListSelectionListener(this);
45
		((WCSParamsPanel)this.wizardPanel).getFormatsPanel().getLstFormats().addListSelectionListener(this);
46

  
47
//		if(this.dataStoreParameters != null && 
48
//				this.wizardPanel instanceof WCSParamsPanel){
49
//			//((WCSParamsPanel)this.wizardPanel).refreshData((WCSDataParametersImpl) this.dataStoreParameters);
50
//		}
51
		
52
		this.OKButton = new JButton(Messages.getText("Connect"));
53
		this.OKButton.addActionListener(new ActionListener() {
54
            public void actionPerformed(ActionEvent e) {
55
                JOptionPane pane = getOptionPane((JComponent)e.getSource());
56
                pane.setValue(OKButton);
57
            }
58
        });
59
		this.OKButton.setEnabled(false);
60
		
61
		this.CancelButton = new JButton(Messages.getText("Cancel"));
62
		this.CancelButton.addActionListener(new ActionListener() {
63
            public void actionPerformed(ActionEvent e) {
64
                JOptionPane pane = getOptionPane((JComponent)e.getSource());
65
                pane.setValue(CancelButton);
66
            }
67
        });
68
	}
69

  
70
	
71
	protected JOptionPane getOptionPane(JComponent parent) {
72
        JOptionPane pane = null;
73
        if (!(parent instanceof JOptionPane)) {
74
            pane = getOptionPane((JComponent)parent.getParent());
75
        } else {
76
            pane = (JOptionPane) parent;
77
        }
78
        return pane;
79
    }
80
	
81
	public void wizardStateChanged(boolean finishable) {
82
		logger.debug("Thing happened!");
83
	}
84
	
85
	public WizardPanel getWizardPanel(){
86
		return this.wizardPanel;
87
	}
88
	
89

  
90
	public void error(Exception e) {
91
		// TODO Auto-generated method stub
92
		
93
	}
94

  
95
	public boolean showWizardOnDialog() {
96
		
97
		int option = JOptionPane.
98
				showOptionDialog(null, this.wizardPanel, Messages.getText("WCS_Parameters"),
99
				JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,
100
				null, new JButton[]{this.CancelButton, this.OKButton}, this.OKButton);
101
		if(option==1){
102
			WCSParamsPanel wcsParamsPanel = (WCSParamsPanel)this.wizardPanel;
103
			dataStoreParameters.setDynValue(WCSLayerLoader.FIELD_SRSSTR, wcsParamsPanel.getSRS());
104
			dataStoreParameters.setDynValue(WCSLayerLoader.FIELD_FORMAT, wcsParamsPanel.getFormat());
105
//			dataStoreParameters.setDynValue(WCSLayerLoader.FIELD_WIDTH, nameValue[1]);
106
//			dataStoreParameters.setDynValue(WCSLayerLoader.FIELD_HEIGHT, nameValue[1]);
107
			dataStoreParameters.setDynValue(WCSLayerLoader.FIELD_PARAM, wcsParamsPanel.getParameterPanel().getParameterString());
108
			return true;
109
		}
110
		return false;
111
	}
112

  
113
	public void valueChanged(ListSelectionEvent e) {
114
		logger.debug("Thing happened!");
115
		WCSParamsPanel wcsParamsPanel = (WCSParamsPanel)this.wizardPanel;
116
		if(!StringUtils.isBlank(wcsParamsPanel.getSRS()) && !StringUtils.isBlank(wcsParamsPanel.getFormat())){
117
			this.OKButton.setEnabled(true);
118
		}
119
	}
120

  
121
}
0 122

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ChooseResourceDialog.java
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 org.gvsig.catalog.gui;
42

  
43
import java.lang.reflect.InvocationTargetException;
44
import java.util.Collection;
45

  
46
import javax.swing.JOptionPane;
47

  
48
import org.gvsig.andami.PluginServices;
49
import org.gvsig.andami.ui.mdiManager.IWindow;
50
import org.gvsig.andami.ui.mdiManager.WindowInfo;
51
import org.gvsig.catalog.CatalogLocator;
52
import org.gvsig.catalog.CatalogManager;
53
import org.gvsig.catalog.loaders.LayerLoader;
54
import org.gvsig.catalog.loaders.LayerLoaderException;
55
import org.gvsig.catalog.schemas.Resource;
56
import org.gvsig.catalog.ui.chooseresource.ChooseResourceDialogPanel;
57
import org.gvsig.i18n.Messages;
58

  
59

  
60

  
61
/**
62
 * This class implements the resources list view.
63
 * 
64
 * @author Jorge Piera Llodra (piera_jor@gva.es)
65
 */
66
public class ChooseResourceDialog extends ChooseResourceDialogPanel
67
implements IWindow {
68
	private static final CatalogManager catalogManager = CatalogLocator.getCatalogManager();
69
	/**
70
	 * @param resources
71
	 * Found resources array
72
	 */
73
	public ChooseResourceDialog(Collection resources) {
74
		super(resources);
75
	}   
76
	
77
	public WindowInfo getWindowInfo() {
78
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
79
		m_viewinfo.setTitle(getName());
80
		return m_viewinfo;
81
	}
82
	
83
	
84
	public Object getWindowProfile(){
85
		return WindowInfo.DIALOG_PROFILE;
86
	}
87
	
88
	public void closeButtonActionPerformed() {
89
		closeJDialog();
90
	}
91
	
92
	public void closeJDialog() {
93
		setVisible(true);
94
		PluginServices.getMDIManager().closeWindow(ChooseResourceDialog.this);
95
	}
96
	
97
	/**
98
	 * This method is invocated when a resource button is clicked
99
	 */
100
	public void resourceButtonActionPerformed(Resource resource){
101
		LayerLoader loader = null;
102
		try {
103
			loader = catalogManager.getLayerLoader(resource);
104
			if (loader != null) {
105
				loader.loadLayer();
106
			} else {
107
				JOptionPane.showMessageDialog(this,
108
						Messages.getText("pluginNotFound") ,
109
						Messages.getText("pluginNotFoundTitle"),			
110
						JOptionPane.INFORMATION_MESSAGE);	
111
				return;
112
			}
113
			
114
		} catch (IllegalArgumentException e) {
115
			// TODO Auto-generated catch block
116
			e.printStackTrace();
117
		} catch (SecurityException e) {
118
			// TODO Auto-generated catch block
119
			e.printStackTrace();
120
		} catch (InstantiationException e) {
121
			// TODO Auto-generated catch block
122
			e.printStackTrace();
123
		} catch (IllegalAccessException e) {
124
			// TODO Auto-generated catch block
125
			e.printStackTrace();
126
		} catch (InvocationTargetException e) {
127
			// TODO Auto-generated catch block
128
			e.printStackTrace();
129
		} catch (NoSuchMethodException e) {
130
			// TODO Auto-generated catch block
131
			e.printStackTrace();
132
		} catch (LayerLoaderException e) {
133
			e.printStackTrace();
134
			JOptionPane.showMessageDialog(this,
135
					e.getMessage(),
136
					e.getWindowMessage(),			
137
					JOptionPane.ERROR_MESSAGE);	
138
		}		
139
		closeJDialog();
140
	}   
141
}
142

  
143

  
144

  
145

  
146

  
0 147

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ConnectDialog.java
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 org.gvsig.catalog.gui;
42

  
43
import java.awt.Frame;
44
import java.util.Map;
45

  
46
import javax.swing.Icon;
47
import javax.swing.JDialog;
48

  
49
import org.gvsig.andami.IconThemeHelper;
50
import org.gvsig.andami.PluginServices;
51
import org.gvsig.andami.ui.mdiManager.IWindow;
52
import org.gvsig.andami.ui.mdiManager.WindowInfo;
53
import org.gvsig.catalog.CatalogLocator;
54
import org.gvsig.catalog.CatalogManager;
55
import org.gvsig.catalog.drivers.ICatalogServiceDriver;
56
import org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel;
57
import org.gvsig.catalog.utils.Frames;
58
import org.gvsig.i18n.Messages;
59
import org.gvsig.utils.swing.jcomboServer.ServerData;
60

  
61

  
62
/**
63
 * Inicia la consulta de cat?logo de metadatos
64
 *
65
 * @author luisw
66
 */
67
public class ConnectDialog extends ServerConnectDialogPanel implements IWindow {
68
	public WindowInfo m_windowInfo = null;
69
	private static final CatalogManager catalogManager = CatalogLocator.getCatalogManager();
70

  
71
	/**
72
	 * Constructor de la ventana de dialogo.
73
	 */
74
	public ConnectDialog() {
75
		super(null);
76
		init();
77
	}
78

  
79
	/**
80
	 * Inicializa el Dialog
81
	 */
82
	private void init() {
83
		this.setBounds(0, 0, 597, 238);
84
		setName("connectDialog");
85
	}
86

  
87
	/**
88
	 * Search Button action
89
	 */
90
	protected void searchButtonActionPerformed() {
91
		addCurrentHost();
92
		closeJDialog();
93

  
94
		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
95
		Frames.centerFrame(panel,525,165);
96
		panel.setTitle(Messages.getText( "catalog_search"));
97
		SearchDialog dialog = new SearchDialog(getClient(),this);
98
		dialog.setCurrentServer(getCurrentServer());
99
		dialog.setFrame(panel);
100
		panel.getContentPane().add(dialog);
101
		panel.setVisible(true);
102
	}
103

  
104
	/**
105
	 * Save the current host (if is neccessary) in a file using the andami
106
	 * persistence
107
	 */
108
	private void addCurrentHost() {
109
		String host = getClient().getSUri();
110
		ServerData newServerData = new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol(),getControlsPanel().getDatabase());
111
		if (client.getServerData() != null){
112
			if ((client.getServerData().getServerAddress().compareTo(newServerData.getServerAddress()) == 0) &&
113
					(client.getServerData() .getServiceSubType().compareTo(newServerData.getServiceSubType()) == 0)){
114
				newServerData.setProperies(client.getServerData().getProperies());
115
			}
116
		}
117
        Map serversMap = catalogManager.getServersPersistence();
118
        serversMap.put(newServerData.getServerAddress(), newServerData);
119
	}
120

  
121
	/*
122
	 * (non-Javadoc)
123
	 * @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed()
124
	 */
125
	protected void closeButtonActionPerformed() {
126
		closeJDialog();
127
	}
128

  
129
	/*
130
	 * (non-Javadoc)
131
	 * @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#serverPropertiesButtonActionPerformed()
132
	 */
133
	protected void serverPropertiesButtonActionPerformed(){
134
		createClient();
135
		PluginServices.getMDIManager().addWindow(new ServerPropertiesDialog(
136
				getControlsPanel().getServer(),
137
				client,
138
				((ICatalogServiceDriver)getControlsPanel().getDriver()).getProfile(),
139
				null));
140
	}
141

  
142
	/**
143
	 * Close the dialog
144
	 */
145
	public void closeJDialog() {
146
		PluginServices.getMDIManager().closeWindow(ConnectDialog.this);
147
	}
148

  
149
	/* (non-Javadoc)
150
	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
151
	 */
152
	public WindowInfo getWindowInfo() {
153
		if (m_windowInfo == null){
154
			m_windowInfo = new WindowInfo(WindowInfo.MODALDIALOG);
155
			m_windowInfo.setTitle(Messages.getText("metadata_catalog"));
156
			m_windowInfo.setHeight(200);
157
			m_windowInfo.setWidth(600);
158
		}
159
		return m_windowInfo;
160
	}
161
	public Object getWindowProfile(){
162
		return WindowInfo.DIALOG_PROFILE;
163
	}
164

  
165
	/* (non-Javadoc)
166
	 * @see org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel#getPropertiesIcon()
167
	 */
168
	protected Icon getPropertiesIcon() {
169
	    // catalog-move-down
170
	    // catalog-move-up
171
	    // catalog-server-properties
172
	    return IconThemeHelper.getImageIcon("catalog-server-properties");
173
	}
174
}
0 175

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ShowTreeDialog.java
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 org.gvsig.catalog.gui;
42

  
43
import javax.swing.JDialog;
44

  
45
import org.gvsig.andami.PluginServices;
46
import org.gvsig.andami.ui.mdiManager.IWindow;
47
import org.gvsig.andami.ui.mdiManager.WindowInfo;
48
import org.gvsig.catalog.metadataxml.XMLNode;
49
import org.gvsig.catalog.ui.showtree.ShowTreeDialogPanel;
50

  
51

  
52

  
53
/**
54
 * DOCUMENT ME!
55
 *
56
 * @author jorpiell TODO To change the template for this generated type comment
57
 *         go to Window - Preferences - Java - Code Style - Code Templates
58
 */
59
public class ShowTreeDialog extends ShowTreeDialogPanel implements IWindow {
60
	 private JDialog frame = null;
61
	/**
62
     * DOCUMENT ME!
63
     *
64
     * @param node
65
     */
66
    public ShowTreeDialog(JDialog frame,XMLNode node) {
67
        super(node);
68
        this.frame = frame;
69
        //8 --> Modal window
70
        PluginServices.getMDIManager().getWindowInfo(this).setWindowInfo(new WindowInfo(
71
                8));
72
    }
73

  
74
    /**
75
     * DOCUMENT ME!
76
     */
77
    public void closeButtonActionPerformed() {
78
        closeJDialog();
79
    }
80

  
81
    /**
82
     * DOCUMENT ME!
83
     */
84
    public void closeJDialog() {
85
    	frame.setVisible(false);
86
    }
87

  
88
    /**
89
     * DOCUMENT ME!
90
     *
91
     * @return DOCUMENT ME!
92
     */
93
    public WindowInfo getWindowInfo() {
94
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
95
        m_viewinfo.setTitle(getName());
96

  
97
        return m_viewinfo;
98
    }
99
    public Object getWindowProfile(){
100
		return WindowInfo.DIALOG_PROFILE;
101
	}
102
}
0 103

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ShowResultsDialog.java
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 org.gvsig.catalog.gui;
42

  
43
import java.awt.Frame;
44
import java.util.Collection;
45

  
46
import javax.swing.JDialog;
47
import javax.swing.JOptionPane;
48

  
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.ui.mdiManager.IWindow;
51
import org.gvsig.andami.ui.mdiManager.WindowInfo;
52
import org.gvsig.catalog.CatalogClient;
53
import org.gvsig.catalog.drivers.GetRecordsReply;
54
import org.gvsig.catalog.metadataxml.XMLNode;
55
import org.gvsig.catalog.schemas.Record;
56
import org.gvsig.catalog.schemas.Resource;
57
import org.gvsig.catalog.ui.showresults.ShowResultsDialogPanel;
58
import org.gvsig.catalog.utils.Frames;
59
import org.gvsig.i18n.Messages;
60

  
61

  
62

  
63
/**
64
 * DOCUMENT ME!
65
 *
66
 * @author luisw
67
 */
68
public class ShowResultsDialog extends ShowResultsDialogPanel implements IWindow {
69
    private JDialog frame = null;
70
    /**
71
     * DOCUMENT ME!
72
     *
73
     * @param client
74
     * @param nodes
75
     * @param currentRecord
76
     */
77
    public ShowResultsDialog(JDialog frame,CatalogClient client, GetRecordsReply recordsReply,
78
        int currentRecord) {
79
        super(client, recordsReply, currentRecord);
80
        this.frame = frame;
81
    }
82

  
83
    /**
84
     * DOCUMENT ME!
85
     */
86
    public void descriptionButtonActionPerformed() {
87
    	Record record = recordsReply.getRecordAt(getCurrentNode());
88
    	if (record == null){
89
    		return;
90
    	}
91
    	XMLNode node = record.getNode();
92
    	if (node == null){
93
    		JOptionPane.showMessageDialog(this,Messages.getText("Error_accediendo_a_los_datos"));
94
    	}else{
95
    		
96
    		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
97
    		Frames.centerFrame(panel, 796, 675);
98
    		//panel.setBounds(0, 0, 796, 675);
99
    		panel.setTitle(Messages.getText("metadata_tree"));
100
    		panel.setResizable(false);
101
    		
102
    		ShowTreeDialog dialog = new ShowTreeDialog(panel,node);
103
    		
104
    		panel.getContentPane().add(dialog);
105
    		panel.show();
106
    	}
107
        
108
//        PluginServices.getMDIManager().addView(dialog);
109
    }
110

  
111
    /**
112
     * DOCUMENT ME!
113
     */
114
    public void mapButtonActionPerformed() {
115
        Resource[] resources = controlsPanel.getRecord().getResources();
116
        Collection col = new java.util.ArrayList();
117
        for (int i=0 ; i<resources.length ;i++){
118
            col.add(resources[i]);
119
        }
120
        ChooseResourceDialog dialog = new ChooseResourceDialog(col);
121
        dialog.setBounds(0, 0, 586, 145);
122
        dialog.setName(Messages.getText("Recursos Disponibles"));
123
        dialog.setVisible(true);
124
        PluginServices.getMDIManager().addWindow(dialog);
125
    }
126

  
127
    /**
128
     * DOCUMENT ME!
129
     */
130
    public void closeButtonActionPerformed() {
131
        closeJDialog();
132
    }
133

  
134
    /**
135
     * Cierra el Dialog
136
     */
137
    public void closeJDialog() {
138
        frame.setVisible(false);
139
    }
140

  
141
    /* (non-Javadoc)
142
     * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
143
     */
144
    public WindowInfo getWindowInfo() {
145
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
146
        m_viewinfo.setTitle(getName());
147

  
148
        return m_viewinfo;
149
    }
150
    public Object getWindowProfile(){
151
		return WindowInfo.DIALOG_PROFILE;
152
	}
153
}
0 154

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ServerPropertiesDialog.java
1
package org.gvsig.catalog.gui;
2

  
3
import org.gvsig.andami.PluginServices;
4
import org.gvsig.andami.ui.mdiManager.IWindow;
5
import org.gvsig.andami.ui.mdiManager.WindowInfo;
6
import org.gvsig.catalog.CatalogClient;
7
import org.gvsig.catalog.drivers.profiles.IProfile;
8
import org.gvsig.catalog.ui.serverproperties.ServerPropertiesDialogPanel;
9
import org.gvsig.i18n.Messages;
10
import org.gvsig.utils.swing.jcomboServer.ServerData;
11

  
12

  
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id$
56
 * $Log$
57
 *
58
 */
59
/**
60
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
61
 */
62
public class ServerPropertiesDialog extends ServerPropertiesDialogPanel implements IWindow {
63
	private WindowInfo m_windowinfo = null;
64
	
65
	public ServerPropertiesDialog(ServerData serverData, CatalogClient client, 
66
			IProfile profile, Object parentFrame) {
67
		super(serverData, client, profile, parentFrame);		
68
	}
69

  
70
	/*
71
	 * (non-Javadoc)
72
	 * @see es.gva.cit.catalog.ui.serverproperties.ServerPropertiesDialogPanel#closeButtonActionPerformed()
73
	 */
74
	protected void closeButtonActionPerformed() {        
75
		client.setServerData(updateServerData());
76
		PluginServices.getMDIManager().closeWindow(this);
77
	} 
78
	
79
	/*
80
	 * (non-Javadoc)
81
	 * @see es.gva.cit.catalog.ui.serverproperties.ServerPropertiesDialogPanel#cancelButtonActionPerformed()
82
	 */
83
	protected void cancelButtonActionPerformed() {        
84
		PluginServices.getMDIManager().closeWindow(this);
85
	} 
86

  
87
	
88
	/*
89
	 * (non-Javadoc)
90
	 * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
91
	 */
92
	public WindowInfo getWindowInfo() {
93
		if (m_windowinfo == null){
94
			m_windowinfo = new WindowInfo(WindowInfo.MODALDIALOG);
95
			m_windowinfo.setTitle(Messages.getText("propertiesNameWindow"));
96
			m_windowinfo.setWidth(500);
97
			m_windowinfo.setHeight(280);
98
		}
99
		return m_windowinfo;
100
	}
101
	public Object getWindowProfile(){
102
		return WindowInfo.DIALOG_PROFILE;
103
	}
104

  
105
}
0 106

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/CatalogClientExtension.java
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 org.gvsig.catalog;
42

  
43
import java.io.File;
44
import java.io.FileInputStream;
45
import java.io.FileNotFoundException;
46
import java.io.IOException;
47
import java.util.HashMap;
48
import java.util.Map;
49
import java.util.Properties;
50

  
51
import org.apache.commons.io.IOUtils;
52
import org.gvsig.andami.IconThemeHelper;
53
import org.gvsig.andami.PluginServices;
54
import org.gvsig.andami.PluginsLocator;
55
import org.gvsig.andami.plugins.Extension;
56
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
57
import org.gvsig.catalog.gui.ConnectDialog;
58
import org.gvsig.catalog.loaders.ARCIMSLayerLoader;
59
import org.gvsig.catalog.loaders.LinkLoader;
60
import org.gvsig.catalog.loaders.PostgisLayerLoader;
61
import org.gvsig.catalog.loaders.WCSLayerLoader;
62
import org.gvsig.catalog.loaders.WFSLayerLoader;
63
import org.gvsig.catalog.loaders.WMSLayerLoader;
64
import org.gvsig.catalog.schemas.Resource;
65
import org.gvsig.tools.ToolsLocator;
66
import org.gvsig.tools.dynobject.DynObject;
67
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
68
import org.gvsig.utils.swing.jcomboServer.ServerData;
69
import org.slf4j.Logger;
70
import org.slf4j.LoggerFactory;
71

  
72

  
73

  
74

  
75
/**
76
 * DOCUMENT ME!
77
 *
78
 * @author Luis W. Sevilla
79
 */
80
public class CatalogClientExtension extends Extension {
81
	private static final Logger LOG = LoggerFactory.getLogger(CatalogClientExtension.class);
82
	private static final String CATALOGLAYERS = "CatalogLayers";
83
	private static final String serversPropsFilename = "servers.properties";
84

  
85
	public void initialize() {
86
		ExtensionPointManager extensionPointManager = ToolsLocator
87
		    .getExtensionPointManager();
88
		extensionPointManager.add(CATALOGLAYERS, "List of possible layers that can be loaded from a catalog");
89
		registerIcons();
90
		setPersistence();
91
	}
92

  
93
	private void registerIcons(){
94
        IconThemeHelper.registerIcon("catalog", "catalog-move-down", this);
95
        IconThemeHelper.registerIcon("catalog", "catalog-move-up", this);
96
        IconThemeHelper.registerIcon("catalog", "catalog-server-properties", this);
97
        IconThemeHelper.registerIcon("catalog", "catalog-search", this);
98
	}
99

  
100
	public void postInitialize(){
101
		//Initialazing the layer loaders
102
		CatalogManager catalogManager = CatalogLocator.getCatalogManager();
103
		catalogManager.addLayerLoader(Resource.WMS, WMSLayerLoader.class);
104
		catalogManager.addLayerLoader(Resource.POSTGIS, PostgisLayerLoader.class);
105
		catalogManager.addLayerLoader(Resource.WCS, WCSLayerLoader.class);
106
		catalogManager.addLayerLoader(Resource.WEBSITE, LinkLoader.class);
107
		catalogManager.addLayerLoader(Resource.DOWNLOAD, LinkLoader.class);
108
		catalogManager.addLayerLoader(Resource.WFS, WFSLayerLoader.class);
109
		catalogManager.addLayerLoader(Resource.ARCIMS_IMAGE, ARCIMSLayerLoader.class);
110
		catalogManager.addLayerLoader(Resource.ARCIMS_VECTORIAL, ARCIMSLayerLoader.class);
111
	}
112

  
113
	public void execute(String actionCommand) {
114
		actionConnectDialogStart();
115
	}
116

  
117
	/**
118
	 * DOCUMENT ME!
119
	 */
120
	private void actionConnectDialogStart() {
121
		System.out.println("Bot?n Cliente de metadatos pulsado");
122
		ConnectDialog connectDialog = new ConnectDialog();
123
		PluginServices.getMDIManager().addWindow(connectDialog);
124
	}
125

  
126
	/**
127
	 * It restores a server list. If this list does't exist it create  a server
128
	 * list by default.
129
	 */
130
	private void setPersistence() {
131
	    PluginServices plugin=PluginsLocator.getManager().getPlugin(this.getClass());
132
        DynObject preferences = plugin.getPluginProperties();
133
        Map serversMapPersistence = (Map) preferences.getDynValue("servers");
134

  
135
        if (serversMapPersistence == null) {
136
            serversMapPersistence = new HashMap();
137
            preferences.setDynValue("servers", serversMapPersistence);
138
        }
139
        addDefaultServers(serversMapPersistence);
140

  
141
        CatalogManager cm= CatalogLocator.getCatalogManager();
142
        cm.setServersPersistence(serversMapPersistence);
143
	}
144

  
145
	/**
146
	 * Loads servers from a properties file
147
	 * @param serversMapPersistence
148
	 */
149
	private void addDefaultServers(Map serversMapPersistence) {
150
	    PluginServices plugin=PluginsLocator.getManager().getPlugin(this.getClass());
151
        //Lee los servidores del properties y los mezcla con los que hay en la persistencia
152
        Properties prop = new Properties();
153
        File propFile = new File(plugin.getPluginDirectory(), serversPropsFilename);
154
        FileInputStream fis = null;
155
        try {
156
            fis = new FileInputStream(propFile);
157
            prop.load(fis);
158
        } catch (FileNotFoundException e) {
159
            LOG.info("Properties file '" + propFile.getAbsolutePath() + "' not found", e);
160
        } catch (IOException e) {
161
            LOG.info("Error reading properties file '" + propFile.getAbsolutePath() + "'.", e);
162
        } finally {
163
            IOUtils.closeQuietly(fis);
164
        }
165
        for (int i = 0; i < prop.size(); i++) {
166
            String serverKey="server[" + i + "]";
167
            String subtypeKey="subtype[" + i + "]";
168
            if (prop.containsKey(serverKey) && prop.containsKey(subtypeKey)){
169
                Object value = prop.get(serverKey);
170
                String host=value.toString();
171
                if (!serversMapPersistence.containsKey(host)){
172
                    Object subType=prop.get(subtypeKey);
173
                    if (subType!=null){
174
                        ServerData server = new ServerData(host, ServerData.SERVER_TYPE_CATALOG, subType.toString());
175
                        serversMapPersistence.put(host, server);
176
                    }
177
                }
178
            }
179
        }
180
	}
181

  
182
	public boolean isEnabled() {
183
		return true;
184
	}
185

  
186
	public boolean isVisible() {
187
		org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
188
		.getActiveWindow();
189

  
190
		if (f == null) {
191
			return false;
192
		}
193

  
194
		return (f instanceof AbstractViewPanel);
195
	}
196
}
0 197

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.218/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/loaders/WMSLayerLoader.java
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 org.gvsig.catalog.loaders;
42

  
43

  
44
import java.util.HashMap;
45
import java.util.Map;
46

  
47
import org.gvsig.andami.PluginServices;
48
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
49
import org.gvsig.catalog.schemas.Resource;
50
import org.gvsig.fmap.dal.DataStoreParameters;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
53
import org.gvsig.i18n.Messages;
54

  
55

  
56
/**
57
 * This class is used to load a WMS layer in gvSIG
58
 * 
59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61
public class WMSLayerLoader extends GvSigLayerLoader{
62
    private static final String FIELD_NAME = "name";
63
    private static final String FIELD_SRSSTR = "srsstr";
64
    private static final String FIELD_FORMAT = "format";
65
    private static final String FIELD_TRANSPARENCY = "transparency";
66
    private static final String FIELD_LAYERQUERY = "layer_query";
67
    private static final String FIELD_URI = "uri";
68
    private static final String FIELD_ONLINERESOURC = "onlineresources";
69
    private static final String FIELD_DELETECACHE     = "deletecache";
70
    
71
    public WMSLayerLoader(Resource resource) {
72
        super(resource);		
73
    }	
74

  
75
    protected boolean hasSpecificLayer() {        
76
        return true;
77
    }
78

  
79
    protected String getLayerName() {      
80
        return getResource().getName();
81
    }    
82

  
83
    protected DataStoreParameters createDataStoreParameters()
84
        throws InitializeException, ProviderNotRegisteredException {
85
        DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("Wms Store");        
86
        dataStoreParameters.setDynValue(FIELD_URI, getResource().getLinkage());
87
        dataStoreParameters.setDynValue(FIELD_FORMAT, "image/png");
88
        dataStoreParameters.setDynValue(FIELD_LAYERQUERY, getResource().getName());
89
        AbstractViewPanel activeView = 
90
            (AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
91
        dataStoreParameters.setDynValue(FIELD_SRSSTR, activeView.getProjection().getAbrev());
92
        dataStoreParameters.setDynValue(FIELD_TRANSPARENCY, Boolean.TRUE);
93
        dataStoreParameters.setDynValue(FIELD_NAME, getLayerName());
94
        dataStoreParameters.setDynValue(FIELD_ONLINERESOURC, createOnlineResources());
95
        dataStoreParameters.setDynValue(FIELD_DELETECACHE, new Boolean(true));
96
        return dataStoreParameters;
97
    }   
98
    
99
    protected Map createOnlineResources() {
100
        Map args = new HashMap();
101
        args.put("GepMap", getResource().getLinkage());      
102
        return args;
103
    }
104
   
105
    protected String extensionPointName() {
106
        return "OGC:WMS";
107
    }
108

  
109
    protected String getErrorMessage() {
110
        return Messages.getText("wmsError") + ".\n" +
111
        Messages.getText("server") + ": " + 
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff