Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / ConnectDialog.java @ 3613

History | View | Annotate | Download (4 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 com.iver.andami.PluginServices;
48
import com.iver.andami.ui.mdiManager.View;
49
import com.iver.andami.ui.mdiManager.ViewInfo;
50

    
51
import es.gva.cit.catalogClient.ui.serverConnect.ServerConnectDialogPanel;
52
import es.gva.cit.catalogClient.utils.Frames;
53
import es.gva.cit.catalogClient.utils.comboServer.ServerData;
54
import es.gva.cit.gvsig.catalogClient.persistence.AndamiPersistence;
55
import es.gva.cit.gvsig.catalogClient.translation.AndamiTranslation;
56

    
57

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

    
72
    /**
73
     * Inicializa el Dialog
74
     */
75
    private void init() {
76
        this.setBounds(0, 0, 630, 260);
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, 120);
98
        panel.setTitle(PluginServices.getText(this, "catalog_search") + " [" +
99
            getCurrentServer() + "]");
100
        panel.setResizable(false);
101

    
102
        SearchDialog dialog = new SearchDialog(panel,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
        AndamiPersistence persistence = new AndamiPersistence(this,ServerData.SERVER_TYPE_CATALOG);
116
        
117
        persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol()));
118
        persistence.setPersistent();
119
    }
120
    /**
121
     * 
122
     *
123
     */
124
    public void closeButtonActionPerformed() {   
125
       closeJDialog();
126
    }
127

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

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

    
143
        return m_viewinfo;
144
    }
145
}