Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 7

Warning: Cannot modify header information - headers already sent by (output started at /home/project-web/dgpf/htdocs/scripts/datetime.php:7) in /home/project-web/dgpf/htdocs/scripts/init.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/project-web/dgpf/htdocs/scripts/datetime.php:7) in /home/project-web/dgpf/htdocs/scripts/init.php on line 29
Distributed Genetic Programming Framework
Logo
Distributed Genetic Programming Framework
print print


Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

File org.dgpf.gui.controls.BoundedDoublePropertyControl.java

Here you can find all the information about the file org.dgpf.gui.controls.BoundedDoublePropertyControl.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Alexander Podlich
 * 
 * E-Mail           : podlich@student.uni-kassel.de
 * Creation Date    : 04.07.2006 15:32:22
 * Original Filename: org.dgpf.gui.controls.DGPFPropertyControl.java
 * Version          : 1.0
 * Last modification: 04.07.2006
 * Last modified by : Alexander Podlich
 * 
 * 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.controls;

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

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import org.dgpf.gui.InternalFrame;
import org.dgpf.gui.components.Button;
import org.dgpf.gui.components.Spinner;
import org.dgpf.gui.utils.LanguageSwitcher;
import org.dgpf.gui.utils.Layout;
import org.dgpf.search.api.SearchState;
import org.sfc.meta.BoundedDoubleProperty;
import org.sfc.meta.Property;
import org.sfc.meta.PropertyPort;

/**
 * This class creates a control for a bounded double property.
 * 
 * @author Alexander Podlich
 */

public class BoundedDoublePropertyControl implements IControl,
    ActionListener, ChangeListener
  {

  /**
   * The serial version UID.
   */

  private static final long serialVersionUID = 1L;

  /**
   * The control panel for editing the values.
   */

  private JPanel            m_controlPanel;

  /**
   * The label for double values, which cannot be set.
   */

  private JLabel            m_label;

  /**
   * The property.
   */

  private final Property<?> m_property;

  /**
   * The button for submit.
   */

  private Button            m_button;

  /**
   * The spinner for changing the value.
   */

  private Spinner           m_spinner;

  /**
   * The label for displaying the minimal value.
   */

  private JLabel            m_minLabel;

  /**
   * The label for displaying the maximal value.
   */

  private JLabel            m_maxLabel;

  /**
   * The minimal value.
   */

  private double            m_minValue;

  /**
   * The maximal value.
   */

  private double            m_maxValue;

  /**
   * Has wether the value of this property can be written by at least one
   * property port or not. <code>true</code> if this property can be
   * written by at least one property port, <code>false</code> if it is
   * read-only.
   */

  private boolean           m_canSet;

  /**
   * Has wether the value of this property can be read by at least one
   * property port or not. <code>true</code> if this property can be read
   * by at least one property port, <code>false</code> if it cannot be
   * read.
   */

  private boolean           m_canGet;

  /**
   * Is <code>true</code>, if it is possible to make an update for this
   * bounded double property. <code>False</code> if not.
   */

  private boolean           m_updateAble;

  /**
   * The parent <code>DGPFInternalFrame</code>.
   */

  private InternalFrame     m_parent;

  /**
   * The default constructor.
   * 
   * @param p_parent
   *          is the parent frame.
   * @param p_port
   *          The property port.
   */

  public BoundedDoublePropertyControl(InternalFrame p_parent,
      PropertyPort p_port)
    {
    this.m_parent = p_parent;
    this.m_canSet = p_port.get_property().can_set();
    this.m_canGet = p_port.get_property().can_get();
    setUpdateAble(true);
    this.m_property = p_port.get_property();

    if(this.m_canSet && this.m_canGet)
      {
      this.m_minValue = ((BoundedDoubleProperty) p_port.get_property())
          .get_min();
      this.m_maxValue = ((BoundedDoubleProperty) p_port.get_property())
          .get_max();

      DGPFMouseListener l_mListener = new DGPFMouseListener(this);

      this.m_controlPanel = new JPanel(new GridBagLayout());

      this.m_spinner = new Spinner(new SpinnerNumberModel(this.m_minValue,
          this.m_minValue, this.m_maxValue, 0.01), this, l_mListener, true);
      Layout.set_constraints(this.m_controlPanel, this.m_spinner, 1.0,
          1.0, GridBagConstraints.NONE, GridBagConstraints.LINE_END,
          GridBagConstraints.RELATIVE, new Insets(3, 3, 3, 3));

      this.m_button = new Button(LanguageSwitcher.getString("btn_change"),
          "btn"this, true);
      Layout.set_constraints(this.m_controlPanel, this.m_button, 1.0, 1.0,
          GridBagConstraints.NONE, GridBagConstraints.LINE_START,
          GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));

      this.m_minLabel = new JLabel(LanguageSwitcher.getString("minValue")
          + " " + String.valueOf(this.m_minValue));
      this.m_minLabel.setHorizontalAlignment(SwingConstants.CENTER);
      Layout.set_constraints(this.m_controlPanel, this.m_minLabel, 1.0,
          1.0, GridBagConstraints.HORIZONTAL,
          GridBagConstraints.LINE_START, GridBagConstraints.REMAINDER,
          new Insets(3, 3, 3, 3));

      this.m_maxLabel = new JLabel(LanguageSwitcher.getString("maxValue")
          + " " + String.valueOf(this.m_maxValue));
      this.m_maxLabel.setHorizontalAlignment(SwingConstants.CENTER);
      Layout.set_constraints(this.m_controlPanel, this.m_maxLabel, 1.0,
          1.0, GridBagConstraints.HORIZONTAL,
          GridBagConstraints.LINE_START, GridBagConstraints.REMAINDER,
          new Insets(3, 3, 3, 3));

      }
    else
      if(this.m_canGet)
        {
        this.m_label = new JLabel();
        }
    }

  /**
   * This method makes an update of the gui element.
   * 
   * @param p_pPort
   *          The property port.
   * @param p_searchState
   *          The search state.
   * @param p_index
   *          The array index if this property is an array property, or
   *          <code>-1<code> if the property is no array property.
   */

  public void update(PropertyPort p_pPort,
      final SearchState<?> p_searchState, int p_index)
    {
    if(this.m_updateAble)
      {
      Object l_object = ((p_index >= 0) ? p_pPort.get(p_searchState,
          p_index) : p_pPort.get(p_searchState));

      if(this.m_canSet && this.m_canGet)
        {
        this.m_spinner.setValue(Double.valueOf(l_object.toString()));
        }
      else
        if(this.m_canGet)
          {
          this.m_label.setText((l_object != null) ? l_object.toString()
              : "null");
          }
      }

    }

  /**
   * This method returns the internal JComponent.
   * 
   * @return The JComponent.
   */

  public JComponent get()
    {
    if(this.m_canSet && this.m_canGet)
      {
      return this.m_controlPanel;
      }
    else
      if(this.m_canGet)
        {
        return this.m_label;
        }
    return null;
    }

  /**
   * Invoked when an action occurs.
   * 
   * @param p_event
   *          The ActionEvent.
   */

  public void actionPerformed(ActionEvent p_event)
    {
    String l_cmd = p_event.getActionCommand();
    if(l_cmd.equals("btn"))
      {
      this.m_parent.setProperty(this.m_property, this.m_spinner
          .getDoubleValue());
      setUpdateAble(true);
      }
    }

  /**
   * @param p_event
   *          The change event for the spinner.
   */

  public void stateChanged(ChangeEvent p_event)
    {
    if(p_event.getSource().equals(this.m_spinner))
      {
      setUpdateAble(false);
      }
    }

  /**
   * <code>True</code>, if this bounded double property can be updated.
   * <code>False</code>, if this bounded double property cannot be
   * updated.
   * 
   * @param p_updateAble
   *          The boolean value for this control.
   */

  public void setUpdateAble(boolean p_updateAble)
    {
    this.m_updateAble = p_updateAble;
    }

  }

File Information:

file name:BoundedDoublePropertyControl.java
package:org.dgpf.gui.controls
qualified name:org.dgpf.gui.controls.BoundedDoublePropertyControl.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gui/controls/BoundedDoublePropertyControl.java
size:8.289 KB (8488 B)
uploaded: 2018-01-07 12:03:35 GMT+0000
last update: 2006-09-24 23:47:04 GMT+0000
last access: 2018-01-07 12:03:35 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
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16
last modified at 2018-01-07 12:03:34 GMT+0000
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 19

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 19
served at 2018-02-19 02:04:10 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo