Revision 15807

View differences:

trunk/extensions/extCatalogAndGazetteer/src/es/gva/cit/gvsig/catalog/CatalogClientAboutExtension.java
3 3
import com.iver.andami.PluginServices;
4 4
import com.iver.andami.plugins.Extension;
5 5
import com.iver.cit.gvsig.About;
6
import com.iver.cit.gvsig.fmap.MapControl;
6 7
import com.iver.cit.gvsig.gui.panels.FPanelAbout;
7 8

  
9
import es.gva.cit.catalog.CatalogAP;
10

  
8 11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9 12
 *
10 13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
......
81 84
		java.net.URL aboutURL = this.getClass().getResource("/about.htm");
82 85
		panelAbout.addAboutUrl(PluginServices.getText(this, "Catalog"),
83 86
				aboutURL);
87
		//Register the icons
88
		PluginServices.getIconTheme().registerDefault(
89
				"catalog-search",
90
				getClass().getClassLoader().getResource("images/SearchButton.png")
91
				); 
84 92

  
85 93
	}
86 94

  
trunk/extensions/extCatalogAndGazetteer/src/es/gva/cit/gvsig/gazetteer/GazetteerModule.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 es.gva.cit.gvsig.gazetteer;
42

  
43
import java.util.Calendar;
44
import java.util.Date;
45
import java.util.GregorianCalendar;
46

  
47
import com.iver.andami.PluginServices;
48
import com.iver.andami.persistence.serverData.ServerDataPersistence;
49
import com.iver.andami.plugins.Extension;
50
import com.iver.cit.gvsig.project.documents.view.gui.View;
51
import com.iver.utiles.swing.jcomboServer.ServerData;
52

  
53
import es.gva.cit.gvsig.gazetteer.gui.ConnectDialog;
54

  
55

  
56
/**
57
 * @author Jorge Piera Llodra (piera_jor@gva.es)
58
 */
59
public class GazetteerModule extends Extension{
60

  
61
    public static void main(String[] args) {
62
    }
63

  
64
    /* (non-Javadoc)
65
     * @see com.iver.andami.plugins.Extension#inicializar()
66
     */
67
    public void initialize() {
68
        System.out.println("A?ado GazetteerModule");
69
        
70
        
71
        
72
    }
73

  
74
    /* (non-Javadoc)
75
     * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
76
     */
77
    public void execute(String actionCommand) {
78
//    	JToolBar toolBar = (JToolBar)PluginServices.getMainFrame().getComponentByName("Catalogo");
79
//    	System.out.println("gjkmgbghb");
80
//    		for (int i=0 ; i<toolBar.getComponentCount() ; i++){
81
//    			System.out.println(((JButton)toolBar.getComponentAtIndex(i)).getName());
82
//    		}    		
83
    		actionConnectDialogStart();
84
    }
85
    
86
    /**
87
     * 
88
     *
89
     */
90
    private void actionConnectDialogStart() {
91
		System.out.println("Bot?n de Gazeteer pulsado");
92
		restoreServerList();
93
		ConnectDialog connectDialog = new ConnectDialog();
94
		PluginServices.getMDIManager().addWindow(connectDialog);
95
	}
96
    
97
    private void restoreServerList() {
98
    	ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_GAZETTEER);
99
        
100
        ServerData[] servers = persistence.getArrayOfServerData();
101
        
102
        boolean found = false;
103
        for (int i=0 ; i<servers.length ; i++){
104
            if (servers[i].getServiceType().equals(ServerData.SERVER_TYPE_GAZETTEER)){
105
                found = true;
106
            }
107
        }       
108
        
109
        if (!found){
110
            if (servers.length == 0){
111
                servers = getDefaultServers();
112
            }else{
113
                ServerData[] newServers = new ServerData[servers.length + getDefaultServers().length ];
114
                System.arraycopy(servers, 0, newServers, 0, servers.length);
115
                System.arraycopy(getDefaultServers(), 0, newServers, servers.length, getDefaultServers().length);
116
                servers = newServers;
117
            }
118
            persistence.setArrayOfServerData(servers);
119
        }
120
         
121
        for (int i = 0; i < servers.length; i++) {
122
            if (servers[i].getServiceType().equals(ServerData.SERVER_TYPE_GAZETTEER)){
123
                ConnectDialog.addServer(servers[i]);
124
            }
125
        }
126
	}		
127

  
128
	/**
129
	 * It creates a server list by default
130
	 * @return
131
	 */
132
	private ServerData[] getDefaultServers(){
133
	    ServerData[] servers = new ServerData[3];
134
	    Calendar cal = new GregorianCalendar();
135
        Date date = cal.getTime();
136
	    
137
	    servers[0] = new ServerData("http://middleware.alexandria.ucsb.edu:8080/gaz/adlgaz/dispatch",date,date,ServerData.SERVER_TYPE_GAZETTEER,ServerData.SERVER_SUBTYPE_GAZETTEER_ADL);
138
        servers[1] = new ServerData("http://demo.deegree.org:8080/gazetteer/wfs-g",date,date,ServerData.SERVER_TYPE_GAZETTEER,ServerData.SERVER_SUBTYPE_GAZETTEER_WFSG);
139
        servers[2] = new ServerData("http://193.144.250.29/webservices/services/IDEC_GeoServeisPort",date,date,ServerData.SERVER_TYPE_GAZETTEER,ServerData.SERVER_SUBTYPE_GAZETTEER_IDEC);
140
               
141
        return servers;    
142
    }
143

  
144
    /* (non-Javadoc)
145
     * @see com.iver.andami.plugins.Extension#isEnabled()
146
     */
147
    public boolean isEnabled() {
148
        return true;
149
    }
150

  
151
    /* (non-Javadoc)
152
     * @see com.iver.andami.plugins.Extension#isVisible()
153
     */
154
    public boolean isVisible() {
155
        com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
156
		.getActiveWindow();
157
		        
158
		if (f == null) {
159
			return false;
160
		}
161
		
162
		if (f instanceof View){
163
			if (((View)f).getMapControl().getViewPort().getAdjustedExtent() != null){
164
				return true;
165
			}
166
		}
167
		
168
		return false;
169
    }
170
}
trunk/extensions/extCatalogAndGazetteer/src/es/gva/cit/gvsig/gazetteer/DeleteSearchesModule.java
1
package es.gva.cit.gvsig.gazetteer;
2

  
3
import java.util.Hashtable;
4

  
5
import com.iver.andami.PluginServices;
6
import com.iver.andami.plugins.Extension;
7
import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
8
import com.iver.cit.gvsig.project.documents.view.gui.View;
9

  
10

  
11
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib��ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id$
54
 * $Log$
55
 * Revision 1.9  2006-10-02 08:29:06  jorpiell
56
 * Modificados los cambios del Branch 10 al head
57
 *
58
 * Revision 1.7.2.1  2006/09/20 12:01:47  jorpiell
59
 * Se ha cambiado la versi�n de la jzkit, se ha incorporado la funcionalidad de cargar arcims
60
 *
61
 * Revision 1.8  2006/09/20 11:23:50  jorpiell
62
 * Se ha cambiado la versi�n de la librer�a jzkit de la 1 a la 2.0. Adem�s se ha modificado lo del document
63
 *
64
 * Revision 1.7  2006/08/29 07:56:34  cesar
65
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
66
 *
67
 * Revision 1.6  2006/08/29 07:13:58  cesar
68
 * Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
69
 *
70
 * Revision 1.5  2006/07/24 10:10:06  jorpiell
71
 * Se ha a�adido una hashtable de vistas activas para asociar la goma de borrar con la vista activa
72
 *
73
 * Revision 1.4  2006/06/19 11:19:35  jorpiell
74
 * Cambiadas las comprobaciones de una clase con == por instanceof.
75
 *
76
 * Revision 1.3  2006/05/02 15:53:59  jorpiell
77
 * Se ha cambiado la interfaz Extension por dos clases: una interfaz (IExtension) y una clase abstract(Extension). A partir de ahora todas las extensiones deben heredar de Extension
78
 *
79
 * Revision 1.2  2006/03/10 12:40:20  jorpiell
80
 * Ahora la goma de borrar los resultados del gazetteer ya aparece y desaparece en lugar de habilitarse/deshabilitarse
81
 *
82
 * Revision 1.1  2006/03/10 11:59:31  jorpiell
83
 * Se habilita la gomita para borrar los resultados de la busqueda del gazetteer en funcion de si hay o no resultados para borrar.
84
 *
85
 *
86
 */
87
/**
88
 * @autor Jorge Piera Llodr� (piera_jor@gva.es)
89
 */
90
public class DeleteSearchesModule extends Extension{
91
	private static Hashtable views = new Hashtable();
92
	
93
	/*
94
	 * (non-Javadoc)
95
	 * @see com.iver.andami.plugins.Extension#inicializar()
96
	 */
97
	public void initialize() {
98
		// TODO Auto-generated method stub
99
	}
100

  
101
	/*
102
	 * (non-Javadoc)
103
	 * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
104
	 */
105
	public void execute(String actionCommand) {
106
		deteleAllFeatures();		
107
	}
108

  
109
	/*
110
	 * (non-Javadoc)
111
	 * @see com.iver.andami.plugins.Extension#isEnabled()
112
	 */
113
	public boolean isEnabled() {
114
		return true;
115
	}
116

  
117
	/*
118
	 * (non-Javadoc)
119
	 * @see com.iver.andami.plugins.Extension#isVisible()
120
	 */
121
	public boolean isVisible() {
122
		com.iver.andami.ui.mdiManager.IWindow activeView = PluginServices.getMDIManager()
123
		.getActiveWindow();
124
		
125
		if (activeView == null) {
126
			return false;
127
		}
128
		
129
		if (activeView instanceof View){
130
			Boolean bool = (Boolean)views.get(activeView);
131
			if (bool == null){
132
				return false;
133
			}else{
134
				return bool.booleanValue();
135
			}
136
		}else{
137
			return false;
138
		}
139
	
140
	
141
	}
142

  
143
	/**
144
	 * Delete all the current view searches
145
	 *
146
	 */
147
	public static void deteleAllFeatures(){
148
		View activeView = 
149
			(View) PluginServices.getMDIManager().getActiveWindow();
150
		GraphicLayer lyr = activeView.getMapControl().getMapContext().getGraphicsLayer();
151
		lyr.clearAllGraphics();
152
		activeView.getMapControl().getViewPort().setExtent(activeView.getMapControl().getViewPort().getExtent());
153
		views.put(activeView,new Boolean(false));
154
	}
155
	
156
	/**
157
	 * Sets the extension enabled
158
	 *
159
	 */
160
	public static void setVisible(){
161
		View activeView = 
162
			(View) PluginServices.getMDIManager().getActiveWindow();
163
		views.put(activeView,new Boolean(true));
164
	}
165

  
166
}

Also available in: Unified diff