Statistics
| Revision:

svn-gvsig-desktop / branches / CatalogYNomenclator_v1_1_0_1005 / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / gui / ConnectDialog.java @ 12754

History | View | Annotate | Download (3.98 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.gazetteer.gui;
42

    
43

    
44
import java.awt.Frame;
45

    
46
import javax.swing.JDialog;
47

    
48
import org.gvsig.i18n.Messages;
49

    
50
import com.iver.andami.PluginServices;
51
import com.iver.andami.persistence.serverData.ServerDataPersistence;
52
import com.iver.andami.ui.mdiManager.IWindow;
53
import com.iver.andami.ui.mdiManager.WindowInfo;
54
import com.iver.utiles.swing.jcomboServer.ServerData;
55

    
56
import es.gva.cit.catalogClient.utils.Frames;
57
import es.gva.cit.gazetteer.ui.serverconnect.ServerConnectDialogPanel;
58

    
59
/**
60
 * @author Jorge Piera Llodra (piera_jor@gva.es)
61
 */
62
public class ConnectDialog extends ServerConnectDialogPanel
63
implements IWindow {
64
        public WindowInfo m_windowInfo = null;
65

    
66
        /**
67
         * Building the dialog Window
68
         */
69
        public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) {
70
                super(null);
71
                init();           
72
        }
73

    
74
        /**
75
         * Establishing window properties
76
         *
77
         */
78
        private void init() {
79
                this.setBounds(0, 0, 610, 263);
80
                setName("connectDialog");
81
        }
82

    
83
        public static void addServer(ServerData server) {
84
                ServerConnectDialogPanel.addTreeMapServer(server);
85
        }
86

    
87
        /*
88
         * (non-Javadoc)
89
         * @see es.gva.cit.gazetteer.ui.serverconnect.ServerConnectDialogPanel#searchButtonActionPerformed()
90
         */
91
        protected void searchButtonActionPerformed() {
92
                addCurrentHost();
93
                closeJDialog();               
94

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

    
106
        /**
107
         * Save the current host (if is neccessary) in a file using the andami
108
         * persistence
109
         * @param host
110
         * Host to save
111
         */
112
        private void addCurrentHost(){
113
                String host = client.getSUri();
114
                ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_GAZETTEER);
115
                persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_GAZETTEER, client.getProtocol()));
116
                persistence.setPersistent();
117
        }
118

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

    
127
        /**
128
         * Cierra el Dialog
129
         */
130
        public void closeJDialog() {
131
                PluginServices.getMDIManager().closeWindow(ConnectDialog.this);
132
        }
133

    
134
        /* (non-Javadoc)
135
         * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
136
         */
137
        public WindowInfo getWindowInfo() {
138
                if (m_windowInfo == null){
139
                        m_windowInfo=new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MODALDIALOG);                
140
                        m_windowInfo.setTitle(Messages.getText( "gazetteer_connect"));
141
                        m_windowInfo.setHeight(225);
142
                        m_windowInfo.setWidth(610);
143
                }
144
                return m_windowInfo;
145
        }
146

    
147
}