Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gui.wizards.chartchooser.CCWzrdSecCard.java

Here you can find all the information about the file org.dgpf.gui.wizards.chartchooser.CCWzrdSecCard.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    : 14.08.2006 22:24:13
 * Original Filename: org.dgpf.gui.wizards.chartchooser.DGPFCCWZrdSecCard.java
 * Version          : 1.0
 * Last modification: 14.08.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.wizards.chartchooser;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Vector;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionListener;

import org.dgpf.gui.charts.descriptors.PortDescriptorBase;
import org.dgpf.gui.components.CheckBox;
import org.dgpf.gui.components.DGPFList;
import org.dgpf.gui.components.DGPFTitledBorder;
import org.dgpf.gui.components.Spinner;
import org.dgpf.gui.components.TextField;
import org.dgpf.gui.utils.LanguageSwitcher;
import org.dgpf.gui.utils.Layout;
import org.dgpf.gui.utils.TimePattern;
import org.sfc.collections.Collections;


/**
 * The abstract class for the second card of the chart chooser wizard
 * 
 * @author Alexander Podlich
 */

public abstract class CCWzrdSecCard extends JPanel implements
    ListSelectionListener, ActionListener
  {

  /**
   * The list for drawable items.
   */

  private DGPFList                   m_list;

  /**
   * The list for drawable properties on the y achsis of the chart.
   */

  private DGPFList                   m_yList;

  /**
   * The list for drawable items on the x achsis of the chart.
   */

  private DGPFList                   m_xList;

  /**
   * The value panel.
   */

  private JPanel                     m_valuePanel;

  /**
   * The option panel.
   */

  private JPanel                     m_optionPanel;

  /**
   * The textfield for the chart name.
   */

  private TextField              m_nameTextField;

  /**
   * The time format label.
   */

  private JLabel                     m_timeFormatLabel;

  /**
   * The combo box for changing the time x format values.
   */

  private JComboBox                  m_tComboBox;

  /**
   * The orientation combo box.
   */

  private JComboBox                  m_oComboBox;

  /**
   * The legend check box.
   */

  private CheckBox               m_lCheckBox;

  /**
   * The boundary check box.
   */

  private CheckBox               m_bCheckBox;

  /**
   * The chart line check box.
   */

  private CheckBox               m_clCheckBox;

  /**
   * The shape check box.
   */

  private CheckBox               m_sCheckBox;

  /**
   * The spinner.
   */

  private Spinner                m_spinner;

  /**
   * The vector of DGPFPortDescriptos as values in a chart.
   */

  private Vector<PortDescriptorBase> m_values;

  /**
   * The name of the chart.
   */

  private String                     m_chartName;

  /**
   * The rotation check box.
   */

  private CheckBox               m_rCheckBox;

  /**
   * Constructor
   * 
   * @param p_values
   *          The vector of DGPFPortDescriptos as values in a chart.
   * @param p_chartName
   *          The name of the chart.
   */

  public CCWzrdSecCard(Vector<PortDescriptorBase> p_values,
      String p_chartName)
    {

    super(new BorderLayout());
    this.setBorder(new EmptyBorder(10, 0, 10, 0));

    this.m_values = p_values;
    this.m_chartName = p_chartName;
    this.m_valuePanel = new JPanel(new GridBagLayout());
    this.m_optionPanel = new JPanel(new GridBagLayout());
    this.m_optionPanel.setBorder(new DGPFTitledBorder(LanguageSwitcher
        .getString("cc2_options"), TitledBorder.LEFT));

    }

  /**
   * Creates one singleselection list.
   */

  public void createList()
    {
    this.m_list = new DGPFList(this.m_values,
        ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    this.m_valuePanel.setBorder(new DGPFTitledBorder(LanguageSwitcher
        .getString("cc2_dataset"), TitledBorder.LEFT));
    Layout.set_constraints(this.m_valuePanel,
        new JScrollPane(this.m_list), 1.0, 1.0, GridBagConstraints.BOTH,
        GridBagConstraints.LINE_START, GridBagConstraints.REMAINDER,
        new Insets(3, 3, 3, 3));
    }

  /**
   * Creates two lists. One X and one Y list. The X list is a single
   * selection list, the Y list a multiple selection list.
   */

  public void createXYLists()
    {
    this.m_xList = new DGPFList(this.m_values,
        ListSelectionModel.SINGLE_SELECTION, this);
    this.m_yList = new DGPFList(this.m_values,
        ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    JPanel l_xPanel = new JPanel(new GridBagLayout());
    l_xPanel.setBorder(new DGPFTitledBorder(LanguageSwitcher
        .getString("cc2_x_achsis"), TitledBorder.LEFT));
    Layout.set_constraints(l_xPanel, new JScrollPane(this.m_xList), 1.0,
        1.0, GridBagConstraints.BOTH, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));

    JPanel l_yPanel = new JPanel(new GridBagLayout());
    l_yPanel.setBorder(new DGPFTitledBorder(LanguageSwitcher
        .getString("cc2_y_achsis"), TitledBorder.LEFT));
    Layout.set_constraints(l_yPanel, new JScrollPane(this.m_yList), 1.0,
        1.0, GridBagConstraints.BOTH, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    this.m_valuePanel = new JPanel(new GridBagLayout());
    Layout.set_constraints(this.m_valuePanel, l_xPanel, 1.0, 1.0,
        GridBagConstraints.BOTH, GridBagConstraints.NORTH,
        GridBagConstraints.REMAINDER, new Insets(0, 0, 0, 0));
    Layout.set_constraints(this.m_valuePanel, l_yPanel, 1.0, 1.0,
        GridBagConstraints.BOTH, GridBagConstraints.SOUTH,
        GridBagConstraints.REMAINDER, new Insets(0, 0, 0, 0));
    }

  /**
   * Creates a name field.
   */

  public void createNameField()
    {
    JLabel l_nameLabel = new JLabel(LanguageSwitcher
        .getString("cc2_name_info"));
    Layout.set_constraints(this.m_optionPanel, l_nameLabel, 1.0, 1.0,
        GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));

    this.m_nameTextField = new TextField(this.m_chartName, true);
    Layout.set_constraints(this.m_optionPanel, this.m_nameTextField, 1.0,
        1.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    }

  /**
   * Creates gui objects to select a time format.
   */

  public void ceateTimeFormat()
    {
    this.m_timeFormatLabel = new JLabel(LanguageSwitcher
        .getString("cc2_time_info"));
    this.m_timeFormatLabel.setEnabled(false);
    Layout.set_constraints(this.m_optionPanel, this.m_timeFormatLabel,
        1.0, 1.0, GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));

    Vector<TimePattern> l_timePtrnVec = new Vector<TimePattern>();
    l_timePtrnVec.add(new TimePattern("hh:mm:ss"));
    l_timePtrnVec.add(new TimePattern("ss"));
    l_timePtrnVec.add(new TimePattern("mm:ss"));
    l_timePtrnVec.add(new TimePattern("hh:mm"));
    l_timePtrnVec.add(new TimePattern("hh:mm a"));
    l_timePtrnVec.add(new TimePattern("K:mm a, z"));
    l_timePtrnVec.add(new TimePattern("MMM yyyy"));
    l_timePtrnVec.add(new TimePattern("MMM yyyy, hh:mm a"));
    l_timePtrnVec.add(new TimePattern("yyyy.MMMMM.dd GGG hh:mm a"));
    l_timePtrnVec.add(new TimePattern("EEE, d MMM yyyy HH:mm:ss"));
    l_timePtrnVec.add(new TimePattern("dd.MM.yyyy HH:mm:ss a"));
    l_timePtrnVec.add(new TimePattern("java"));

    this.m_tComboBox = new JComboBox(l_timePtrnVec);
    this.m_tComboBox.setEnabled(false);
    Layout.set_constraints(this.m_optionPanel, this.m_tComboBox, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    }

  /**
   * Creates the legend check box.
   */

  public void createLegendCheckbox()
    {
    this.m_lCheckBox = new CheckBox(LanguageSwitcher
        .getString("cc2_legend"), "lCheckBox", true);
    this.m_lCheckBox.setSelected(true);
    Layout.set_constraints(this.m_optionPanel, this.m_lCheckBox, 1.0, 1.0,
        GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));
    }

  /**
   * Creates the boundary check box.
   */

  public void createBoundaryCheckBox()
    {
    this.m_bCheckBox = new CheckBox(LanguageSwitcher
        .getString("cc2_bounds"), "bCheckBox"this, true);
    this.m_bCheckBox.setSelected(false);
    Layout.set_constraints(this.m_optionPanel, this.m_bCheckBox, 1.0, 1.0,
        GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));

    this.m_spinner = new Spinner(new SpinnerNumberModel(100, 1,
        Integer.MAX_VALUE, 1), true);
    this.m_spinner.setEnabled(false);
    Layout.set_constraints(this.m_optionPanel, this.m_spinner, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    }

  /**
   * Creates the rotation check box.
   */

  public void createRotationCheckBox()
    {
    this.m_rCheckBox = new CheckBox(LanguageSwitcher
        .getString("cc2_rotate"), "rCheckBox", true);
    this.m_rCheckBox.setSelected(true);
    Layout.set_constraints(this.m_optionPanel, this.m_rCheckBox, 1.0, 1.0,
        GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));
    }

  /**
   * Creates the selection of the plot orientation.
   */

  public void createPlotOrientation()
    {
    JLabel l_plotOrientationLabel = new JLabel(LanguageSwitcher
        .getString("cc2_orientation"));
    Layout.set_constraints(this.m_optionPanel, l_plotOrientationLabel,
        1.0, 1.0, GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));

    Vector<String> l_orientationVec = new Vector<String>();
    l_orientationVec
        .add(LanguageSwitcher.getString("cc2_orientation_v"));
    l_orientationVec
        .add(LanguageSwitcher.getString("cc2_orientation_h"));

    this.m_oComboBox = new JComboBox(l_orientationVec);
    Layout.set_constraints(this.m_optionPanel, this.m_oComboBox, 1.0, 1.0,
        GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(3, 3, 3, 3));
    }

  /**
   * Creates the shape check box.
   */

  public void createShapeCheckBox()
    {
    this.m_sCheckBox = new CheckBox(LanguageSwitcher
        .getString("cc2_shape"), "sheckBox", true);
    this.m_sCheckBox.setSelected(false);
    Layout.set_constraints(this.m_optionPanel, this.m_sCheckBox, 1.0, 1.0,
        GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));
    }

  /**
   * Creates the chart line check box.
   */

  public void createChartLineCheckBox()
    {
    this.m_clCheckBox = new CheckBox(LanguageSwitcher
        .getString("cc2_line"), "clCheckBox", true);
    this.m_clCheckBox.setSelected(true);
    Layout.set_constraints(getOptionPanel(), this.m_clCheckBox, 1.0,
        1.0, GridBagConstraints.NONE, GridBagConstraints.LINE_START,
        GridBagConstraints.REMAINDER, new Insets(10, 3, 3, 3));
    }

  /**
   * Finalize the gui objects of the chart chooser wizard second card.
   */

  public void finalizeCCWzrdSecCard()
    {
    JPanel l_optionContainer = new JPanel(new GridBagLayout());
    Layout.set_constraints(l_optionContainer, this.m_optionPanel, 1.0,
        1.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH,
        GridBagConstraints.REMAINDER, new Insets(0, 0, 0, 0));

    add(this.m_valuePanel, BorderLayout.WEST);
    add(l_optionContainer, BorderLayout.CENTER);
    }

  /**
   * @return The chart name.
   */

  public String getChartName()
    {
    return this.m_nameTextField.getText();
    }

  /**
   * @return The selection status of the show legend checkbox.
   */

  public boolean showChartLegend()
    {
    return this.m_lCheckBox.isSelected();
    }

  /**
   * @return The selection status of the rotate checkbox.
   */

  public boolean rotateChart()
    {
    return this.m_rCheckBox.isSelected();
    }

  /**
   * @return The port descriptor as x value.
   */

  public PortDescriptorBase getXValue()
    {
    return (PortDescriptorBase) this.m_xList.getSelectedValue();
    }

  /**
   * @return The list of port descriptors as y value.
   */

  public List<PortDescriptorBase> getyValues()
    {
    List<PortDescriptorBase> l_retValues = Collections
        .create_list(this.m_yList.getSelectedValues().length);
    for(Object l_o : this.m_yList.getSelectedValues())
      {
      l_retValues.add((PortDescriptorBase) l_o);
      }
    return l_retValues;
    }

  /**
   * @return The list of port descriptors as values.
   */

  public List<PortDescriptorBase> getValues()
    {
    List<PortDescriptorBase> l_retValues = Collections.create_list(this.m_list
        .getSelectedValues().length);
    for(Object l_o : this.m_list.getSelectedValues())
      {
      l_retValues.add((PortDescriptorBase) l_o);
      }
    return l_retValues;
    }

  /**
   * @return The time pattern.
   */

  public String getTimePattern()
    {
    return ((TimePattern) (this.m_tComboBox.getSelectedItem())).getKey();
    }

  /**
   * @return The status, if the x achsis should be bounded.
   */

  public boolean xAchsisIsBounded()
    {
    return this.m_bCheckBox.isSelected();
    }

  /**
   * @return The bounded value.
   */

  public int getBoundedValue()
    {
    return this.m_spinner.getIntValue();
    }

  /**
   * @return The status of the shape visibility of the chart.
   */

  public boolean getShapeVisibility()
    {
    return this.m_sCheckBox.isSelected();
    }

  /**
   * @return The status of the line visibility of the chart.
   */

  public boolean getLineVisibility()
    {
    return this.m_clCheckBox.isSelected();
    }

  /**
   * @return The value panel.
   */

  public JPanel getValuePanel()
    {
    return this.m_valuePanel;
    }

  /**
   * @return The option panel.
   */

  public JPanel getOptionPanel()
    {
    return this.m_optionPanel;
    }

  /**
   * @return The Y list.
   */

  public DGPFList getYList()
    {
    return this.m_yList;
    }

  /**
   * @return The X list.
   */

  public DGPFList getXList()
    {
    return this.m_xList;
    }

  /**
   * @return The list.
   */

  public DGPFList getList()
    {
    return this.m_list;
    }

  /**
   * @return The name text field of the chart.
   */

  public TextField getNameTextField()
    {
    return this.m_nameTextField;
    }

  /**
   * @return The time format label.
   */

  public JLabel getTimeFormatLabel()
    {
    return this.m_timeFormatLabel;
    }

  /**
   * @return The time combo box.
   */

  public JComboBox getTimeComboBox()
    {
    return this.m_tComboBox;
    }

  /**
   * @return The orientation combo box.
   */

  public JComboBox getOrientationComboBox()
    {
    return this.m_oComboBox;
    }

  /**
   * @return The plot orientation of the chart
   */

  public org.jfree.chart.plot.PlotOrientation getPlotOrientation()
    {
    if(this.m_oComboBox.getSelectedItem().toString().equals(
        LanguageSwitcher.getString("cc2_orientation_v")))
      {
      return org.jfree.chart.plot.PlotOrientation.VERTICAL;
      }
    else
      if(this.m_oComboBox.getSelectedItem().toString().equals(
          LanguageSwitcher.getString("cc2_orientation_h")))
        {
        return org.jfree.chart.plot.PlotOrientation.HORIZONTAL;
        }
      else
        return null;
    }

  /**
   * @return The legend check box.
   */

  public CheckBox getLCheckBox()
    {
    return this.m_lCheckBox;
    }

  /**
   * @return The spinner.
   */

  public Spinner getSpinner()
    {
    return this.m_spinner;
    }

  /**
   * @return The chart line check box.
   */

  public CheckBox getCLCheckBox()
    {
    return this.m_clCheckBox;
    }

  /**
   * @return The shape check box.
   */

  public CheckBox getSCheckBox()
    {
    return this.m_sCheckBox;
    }

  /**
   * @return The boundary check box.
   */

  public CheckBox getBCheckBox()
    {
    return this.m_bCheckBox;
    }

  }

File Information:

file name:CCWzrdSecCard.java
package:org.dgpf.gui.wizards.chartchooser
qualified name:org.dgpf.gui.wizards.chartchooser.CCWzrdSecCard.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gui/wizards/chartchooser/CCWzrdSecCard.java
size:17.018 KB (17427 B)
uploaded: 2015-07-22 04:10:59 GMT+0000
last update: 2006-10-01 01:39:58 GMT+0000
last access: 2017-11-21 15:27:12 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-21 15:27:12 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo