Statistics
| Revision:

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

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

    
43
import java.awt.Frame;
44

    
45
import javax.swing.JDialog;
46

    
47
import org.gvsig.i18n.Messages;
48

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

    
55
import es.gva.cit.catalogClient.ui.serverConnect.ServerConnectDialogPanel;
56
import es.gva.cit.catalogClient.utils.Frames;
57

    
58
/**
59
 * Inicia la consulta de cat?logo de metadatos
60
 *
61
 * @author luisw
62
 */
63
public class ConnectDialog extends ServerConnectDialogPanel implements IWindow {
64
    /**
65
     * Constructor de la ventana de dialogo.
66
     */
67
    public ConnectDialog() {
68
        super(null);
69
        init();
70
    }
71

    
72
    /**
73
     * Inicializa el Dialog
74
     */
75
    private void init() {
76
        this.setBounds(0, 0, 597, 238);
77
        setName("connectDialog");
78
    }
79

    
80
    /**
81
     * Add a server
82
     *
83
     * @param server
84
     */
85
    public static void addServer(ServerData server) {
86
        ServerConnectDialogPanel.addTreeMapServer(server);
87
    }
88

    
89
    /**
90
     * Search Button action
91
     */
92
    public void searchButtonActionPerformed() {
93
        addCurrentHost();
94
        closeJDialog();
95

    
96
        JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
97
        Frames.searchDialogPosition(panel, 525, 118);
98
        panel.setTitle(Messages.getText("catalog_search") + " [" +
99
            getCurrentServer() + "]");
100
        panel.setResizable(false);
101

    
102
        SearchDialog dialog = new SearchDialog(panel,this,getClient());
103
        dialog.setCurrentServer(getCurrentServer());
104

    
105
        panel.getContentPane().add(dialog);
106
        panel.show();
107
    }
108

    
109
    /**
110
     * Save the current host (if is neccessary) in a file using the andami
111
     * persistence
112
     */
113
    private void addCurrentHost() {
114
        String host = getClient().getSURL();
115
        ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_CATALOG);
116
        persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol(),controlsPanel.getDatabase()));
117
        persistence.setPersistent();
118
    }
119
    /**
120
     * 
121
     *
122
     */
123
    public void closeButtonActionPerformed() {   
124
       closeJDialog();
125
    }
126

    
127
    /**
128
     * Close the dialog
129
     */
130
    public void closeJDialog() {
131
        setVisible(false);
132
        PluginServices.getMDIManager().closeView(ConnectDialog.this);
133
    }
134

    
135
    /* (non-Javadoc)
136
     * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
137
     */
138
    public ViewInfo getViewInfo() {
139
        ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
140
        m_viewinfo.setTitle(Messages.getText("metadata_catalog"));
141

    
142
        return m_viewinfo;
143
    }
144
}