Statistics
| Revision:

root / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / gui / ConnectDialog.java @ 6877

History | View | Annotate | Download (3.71 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.ViewInfo;
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

    
65
    /**
66
     * Building the dialog Window
67
     */
68
    public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) {
69
                super(null);
70
                init();           
71
        }
72
      
73
    /**
74
     * Establishing window properties
75
     *
76
     */
77
    private void init() {
78
                this.setBounds(0, 0, 610, 263);
79
                setName("connectDialog");
80
    }
81
   
82
    public static void addServer(ServerData server) {
83
        ServerConnectDialogPanel.addTreeMapServer(server);
84
    }
85
    
86
    public void searchButtonActionPerformed() {
87
        addCurrentHost();
88
        closeJDialog();
89
                
90
        JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
91
            Frames.searchDialogPosition(panel,525,118);
92
            panel.setTitle(Messages.getText( "gazetteer_search") + " ["+ getCurrentServer()+"]");
93
            panel.setResizable(false);
94
            
95
        SearchDialog dialog = new SearchDialog(client,panel,this);
96
                
97
        panel.getContentPane().add(dialog);
98
            panel.show(); 
99
        }
100
    
101
    /**
102
         * Save the current host (if is neccessary) in a file using the andami
103
         * persistence
104
         * @param host
105
         * Host to save
106
         */
107
         private void addCurrentHost(){
108
              String host = client.getSURL();
109
              ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_GAZETTEER);
110
                        
111
                  persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_GAZETTEER, client.getProtocol()));
112
                  persistence.setPersistent();
113
         }
114
       /**
115
         * 
116
         *
117
         */
118
        public void closeButtonActionPerformed() {   
119
           closeJDialog();
120
        }
121

    
122
        /**
123
         * Cierra el Dialog
124
         */
125
        public void closeJDialog() {
126
                setVisible(false);
127
                PluginServices.getMDIManager().closeView(ConnectDialog.this);
128
        }
129
        
130
        /* (non-Javadoc)
131
         * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
132
         */
133
        public ViewInfo getViewInfo() {
134
                ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
135
                m_viewinfo.setTitle(Messages.getText( "gazetteer_connect"));
136
        return m_viewinfo;
137
        }
138

    
139
}