Statistics
| Revision:

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

History | View | Annotate | Download (3.71 KB)

1 2966 jorpiell
/* 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 3180 jorpiell
import java.awt.Frame;
45
46
import javax.swing.JDialog;
47
48 4713 cesar
import org.gvsig.i18n.Messages;
49
50 2966 jorpiell
import com.iver.andami.PluginServices;
51 4302 jorpiell
import com.iver.andami.persistence.serverData.ServerDataPersistence;
52 6877 cesar
import com.iver.andami.ui.mdiManager.IWindow;
53 2966 jorpiell
import com.iver.andami.ui.mdiManager.ViewInfo;
54 4302 jorpiell
import com.iver.utiles.swing.jcomboServer.ServerData;
55 2966 jorpiell
56 3180 jorpiell
import es.gva.cit.catalogClient.utils.Frames;
57 3224 jorpiell
import es.gva.cit.gazetteer.ui.serverConnect.ServerConnectDialogPanel;
58 2966 jorpiell
59
/**
60
 * @author Jorge Piera Llodra (piera_jor@gva.es)
61
 */
62
public class ConnectDialog extends ServerConnectDialogPanel
63 6877 cesar
implements IWindow {
64 2966 jorpiell
65
    /**
66
     * Building the dialog Window
67
     */
68
    public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) {
69 4713 cesar
                super(null);
70 3613 jorpiell
                init();
71 2966 jorpiell
        }
72
73
    /**
74
     * Establishing window properties
75
     *
76
     */
77
    private void init() {
78 4346 jorpiell
                this.setBounds(0, 0, 610, 263);
79 2966 jorpiell
                setName("connectDialog");
80
    }
81
82 3227 jorpiell
    public static void addServer(ServerData server) {
83
        ServerConnectDialogPanel.addTreeMapServer(server);
84 2966 jorpiell
    }
85
86
    public void searchButtonActionPerformed() {
87 3227 jorpiell
        addCurrentHost();
88 2966 jorpiell
        closeJDialog();
89 3180 jorpiell
90
        JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
91 4346 jorpiell
            Frames.searchDialogPosition(panel,525,118);
92 4713 cesar
            panel.setTitle(Messages.getText( "gazetteer_search") + " ["+ getCurrentServer()+"]");
93 3180 jorpiell
            panel.setResizable(false);
94
95 4336 jorpiell
        SearchDialog dialog = new SearchDialog(client,panel,this);
96 3180 jorpiell
97
        panel.getContentPane().add(dialog);
98
            panel.show();
99 2966 jorpiell
        }
100
101 3227 jorpiell
    /**
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 3477 jorpiell
         private void addCurrentHost(){
108 3399 jorpiell
              String host = client.getSURL();
109 4302 jorpiell
              ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_GAZETTEER);
110 3399 jorpiell
111 3477 jorpiell
                  persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_GAZETTEER, client.getProtocol()));
112 3399 jorpiell
                  persistence.setPersistent();
113
         }
114 3613 jorpiell
       /**
115
         *
116
         *
117
         */
118
        public void closeButtonActionPerformed() {
119
           closeJDialog();
120
        }
121
122 2966 jorpiell
        /**
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 4713 cesar
                m_viewinfo.setTitle(Messages.getText( "gazetteer_connect"));
136 2966 jorpiell
        return m_viewinfo;
137
        }
138
139
}