/*******************************************************************************
 * GenRGenS v.1.0, Generation of Random Genomic Sequences                      *
 * Copyright (C) 2001  Alain Denise/Yann Ponty                                 *
 *                                                                             *
 * This program is free software; you can redistribute it and/or               *
 * modify it under the terms of the GNU General Public License                 *
 * as published by the Free Software Foundation; either version 2              *
 * of the License, or (at your option) any later version.                      *
 *                                                                             *
 * This program is distributed in the hope that it will be useful,             *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
 * GNU General Public License for more details.                                *
 *                                                                             *
 * You should have received a copy of the GNU General Public License           *
 * along with this program; if not, write to the Free Software                 *
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *
 *******************************************************************************/

package GenRGenS.Applet;

/**
 * Title:        <p>
 * Description:  <p>
 * Copyright:    Copyright (c) <p>
 * Company:      <p>
 * @author
 * @version 1.0
 */

import java.awt.*;
import GenRGenS.IU.*;
import GenRGenS.*;
import GenRGenS.utility.callbacks.*;

public class AWTGenerationSpecificOptionsPanel extends Panel
{
  TextArea textArea1 = new TextArea();
  Panel help = new Panel();
  Panel panel4 = new Panel();
  BorderLayout borderLayout2 = new BorderLayout();
  Label label1 = new Label();
  FlowLayout flowLayout1 = new FlowLayout();
  BorderLayout borderLayout1 = new BorderLayout();
  Panel panel2 = new Panel();
  Button button1 = new Button();
  Panel panel3 = new Panel();
  CardLayout cardLayout1 = new CardLayout();
  Panel options = new Panel();
  GridLayout gridLayout1 = new GridLayout();




  public void OnValidate()
  {
  }

  public void beforeVisible(GeneratorConfigFile f)
  {
    label1.setText(f.getLitteralName()+" Options :");

    Option[] opts = f.getOptions();
    for(int i =0;i<opts.length;i++)
    {
      Option o = opts[i];
      o.getOptionName();
      // On traitera dans les prochaines versions des parametrages plus riches (String, entiers etc ...)
      //if(o.getCallback().getTypename() == Callback.TYPE_BOOLEAN)
      {
        Panel p = new Panel();
        Checkbox c = new Checkbox(o.getOptionName());
        Button b = new Button("?");
        p.add(c);
        p.add(b);
        options.add(p);
      }
    }
  }


  public AWTGenerationSpecificOptionsPanel()
  {
    try
    {
      jbInit();
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }

  private void jbInit() throws Exception
  {
    textArea1.setText("help");
    this.setLayout(borderLayout2);
    help.setLayout(borderLayout1);
    panel4.setLayout(flowLayout1);
    label1.setFont(new java.awt.Font("DialogInput", 1, 12));
    label1.setText("Options :");
    button1.setLabel("Back");
    panel3.setLayout(cardLayout1);
    options.setLayout(gridLayout1);
    gridLayout1.setColumns(1);
    gridLayout1.setRows(0);
    this.add(panel4, BorderLayout.NORTH);
    panel4.add(label1, null);
    this.add(panel3, BorderLayout.CENTER);
    panel3.add(options, "Options");
    panel3.add(help, "help");
    help.add(textArea1, BorderLayout.CENTER);
    help.add(panel2, BorderLayout.SOUTH);
    panel2.add(button1, null);
  }

}