Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gui.controls.TimePropertyControl.java

Here you can find all the information about the file org.dgpf.gui.controls.TimePropertyControl.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    : 10.07.2006 09:36:30
 * Original Filename: org.dgpf.gui.controls.DGPFTimePropertyControl.java
 * Version          : 1.0
 * Last modification: 10.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 javax.swing.JComponent;
import javax.swing.JLabel;

import org.dgpf.search.api.SearchState;
import org.sfc.meta.PropertyPort;
import org.sfc.meta.TimeProperty;
import org.sfc.text.Text;

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

public class TimePropertyControl extends JLabel implements IControl
  {

  /**
   * The serial version UID.
   */

  private static final long serialVersionUID = 1L;

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

  private boolean           m_updateAble;

  /**
   * The default constructor.
   */

  public TimePropertyControl()
    {
    super();
    setUpdateAble(true);
    }

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

  public JComponent get()
    {
    return this;
    }

  /**
   * 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, 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));
      boolean l_isRelative = ((TimeProperty) p_pPort.get_property())
          .is_relative();
      long l_time = Long.valueOf(l_object.toString()).longValue();
      setText(Text.time_to_string(l_time, l_isRelative));
      }

    }

  /**
   * <code>True</code>, if this time property can be updated.
   * <code>False</code>, if this time 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:TimePropertyControl.java
package:org.dgpf.gui.controls
qualified name:org.dgpf.gui.controls.TimePropertyControl.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gui/controls/TimePropertyControl.java
size:3.144 KB (3220 B)
uploaded: 2015-07-22 04:10:58 GMT+0000
last update: 2006-09-24 23:47:04 GMT+0000
last access: 2017-11-18 23:06:54 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-18 23:06:54 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo