001: //==============================================================================
002: //=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
003: //=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
004: //=== and United Nations Environment Programme (UNEP)
005: //===
006: //=== This program is free software; you can redistribute it and/or modify
007: //=== it under the terms of the GNU General Public License as published by
008: //=== the Free Software Foundation; either version 2 of the License, or (at
009: //=== your option) any later version.
010: //===
011: //=== This program is distributed in the hope that it will be useful, but
012: //=== WITHOUT ANY WARRANTY; without even the implied warranty of
013: //=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: //=== General Public License for more details.
015: //===
016: //=== You should have received a copy of the GNU General Public License
017: //=== along with this program; if not, write to the Free Software
018: //=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
019: //===
020: //=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
021: //=== Rome - Italy. email: geonetwork@osgeo.org
022: //==============================================================================
023:
024: package org.fao.gast.gui.dialogs;
025:
026: import java.awt.BorderLayout;
027: import java.awt.Frame;
028: import java.awt.event.ActionEvent;
029: import java.awt.event.ActionListener;
030: import javax.swing.JButton;
031: import javax.swing.JPanel;
032: import org.dlib.gui.FlexLayout;
033: import org.dlib.gui.TDialog;
034: import org.fao.gast.app.Configuration;
035:
036: //==============================================================================
037:
038: public class ConfigDialog extends TDialog {
039: //---------------------------------------------------------------------------
040: //---
041: //--- Constructor
042: //---
043: //---------------------------------------------------------------------------
044:
045: public ConfigDialog(Frame owner) {
046: super (owner, "Configuration", true);
047:
048: JPanel p = new JPanel();
049:
050: FlexLayout fl = new FlexLayout(1, 2);
051: fl.setColProp(0, FlexLayout.EXPAND);
052: fl.setRowProp(0, FlexLayout.EXPAND);
053: p.setLayout(fl);
054:
055: p.add("0,0,x,x", panConfig);
056: p.add("0,1,c", btnOk);
057:
058: getContentPane().add(p, BorderLayout.CENTER);
059:
060: btnOk.addActionListener(new ActionListener() {
061: public void actionPerformed(ActionEvent e) {
062: setVisible(false);
063: }
064: });
065: }
066:
067: //---------------------------------------------------------------------------
068: //---
069: //--- API methods
070: //---
071: //---------------------------------------------------------------------------
072:
073: public Configuration getConfig() {
074: return config;
075: }
076:
077: //---------------------------------------------------------------------------
078: //---
079: //--- Configuration interface
080: //---
081: //---------------------------------------------------------------------------
082:
083: private Configuration config = new Configuration() {
084: public String getHost() {
085: return panConfig.getHost();
086: }
087:
088: public int getPort() {
089: return panConfig.getPort();
090: }
091:
092: public String getServlet() {
093: return panConfig.getServlet();
094: }
095:
096: public String getUsername() {
097: return panConfig.getUsername();
098: }
099:
100: public String getPassword() {
101: return panConfig.getPassword();
102: }
103:
104: public boolean useAccount() {
105: return panConfig.useAccount();
106: }
107: };
108:
109: //---------------------------------------------------------------------------
110: //---
111: //--- Variables
112: //---
113: //---------------------------------------------------------------------------
114:
115: private ConfigPanel panConfig = new ConfigPanel();
116: private JButton btnOk = new JButton("Ok");
117: }
118:
119: //==============================================================================
|