Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gui.dialogs.ConnectToHostDialog.java

Here you can find all the information about the file org.dgpf.gui.dialogs.ConnectToHostDialog.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Mirko Dietrich
 * 
 * E-Mail           : mirkodietrich@hrz.uni-kassel.de
 * Creation Date    : Jul 23, 2006 9:25:29 AM
 * Original Filename: org.dgpf.gui.DGPFConnectToHostFrame.java
 * Version          : 1.0
 * Last modification: Jul 23, 2006
 * Last modified by : Mirko Dietrich
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */


package org.dgpf.gui.dialogs;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.awt.event.ActionEvent;

import javax.swing.JLabel;

import org.dgpf.gui.Frame;
import org.dgpf.gui.components.TextField;
import org.dgpf.gui.utils.LanguageSwitcher;
import org.dgpf.gui.utils.Layout;
import org.dgpf.gui.utils.Host;
import org.dgpf.search.control.protocol.NetworkCommunicationPeer;

/**
 * Dialog box for connecting to a single host running a daemon.
 * 
 * @author Mirko Dietrich
 */

public class ConnectToHostDialog extends DialogBase
  {

  /**
   * Label for host text field.
   */

  private JLabel            m_host_label;

  /**
   * The host text field.
   */

  private TextField         m_host_tf;

  /**
   * Label for port text field.
   */

  private JLabel            m_port_label;

  /**
   * The port text field.
   */

  private TextField         m_port_tf;

  /**
   * serialVersionUID.
   */

  private static final long serialVersionUID = -8513858476569836339L;

  /**
   * Reacts on button clicks.
   * 
   * @param p_event
   *          to be handled.
   */

  public void actionPerformed(ActionEvent p_event)
    {
    String l_cmd = p_event.getActionCommand();
    if(l_cmd.equals("ok"))
      {
      this.m_parent.createInternalFrame(new Host(this.m_host_tf.getText(),
          Integer.parseInt(this.m_port_tf.getText()), ""));
      this.dispose();
      return;
      }
    if(l_cmd.equals("cancel"))
      {
      this.dispose();
      return;
      }
    }

  /**
   * Default constructor.
   * 
   * @param p_parent
   *          DGPF main window.
   * @throws HeadlessException
   *           Thrown when code that is dependent on a keyboard, display,
   *           or mouse is called in an environment that does not support a
   *           keyboard, display, or mouse.
   */

  public ConnectToHostDialog(Frame p_parent) throws HeadlessException
    {
    super(p_parent, LanguageSwitcher.getString("chostd_caption"),
        LanguageSwitcher.getString("chostd_info"),
        DialogBase.OK_CANCEL_BTN, true, new GridBagLayout());
    /* Host label */
    this.m_host_label = new JLabel(LanguageSwitcher
        .getString("chostd_host_label"));
    Layout.set_constraints(this.getCenter(), this.m_host_label, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    /* Host input text field */
    this.m_host_tf = new TextField("localhost", true);
    Layout.set_constraints(this.getCenter(), this.m_host_tf, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    /* Port label */
    this.m_port_label = new JLabel(LanguageSwitcher
        .getString("chostd_port_label"));
    Layout.set_constraints(this.getCenter(), this.m_port_label, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    /* Port input text field */
    this.m_port_tf = new TextField(new Integer(
        NetworkCommunicationPeer.DEFAULT_PORT).toString(), true);
    Layout.set_constraints(this.getCenter(), this.m_port_tf, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    finish();
    }
  }

File Information:

file name:ConnectToHostDialog.java
package:org.dgpf.gui.dialogs
qualified name:org.dgpf.gui.dialogs.ConnectToHostDialog.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gui/dialogs/ConnectToHostDialog.java
size:4.465 KB (4573 B)
uploaded: 2015-07-22 04:10:58 GMT+0000
last update: 2006-09-24 23:47:04 GMT+0000
last access: 2017-11-19 02:57:11 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2017-11-19 02:57:11 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo