// created: 29.12.00
// modified:

import javax.swing.*;
import java.awt.*;

class FunctionPanel extends JPanel
 {

 CountFunctionChanger textChanger;
 CountFunctionChanger imagesChanger;
 CountFunctionChanger tablesChanger;
 CountFunctionChanger linksChanger;
 CountChoiceFunctionChanger downloadsChanger;
 ExistFunctionChanger framesChanger; 
 ChoiceFunctionChanger extensionChanger;

 FunctionPanel()
  {

  // instantiate the components
  textChanger = new CountFunctionChanger();
  imagesChanger = new CountFunctionChanger();
  tablesChanger = new CountFunctionChanger();
  linksChanger = new CountFunctionChanger();
  downloadsChanger = new CountChoiceFunctionChanger();
  framesChanger = new ExistFunctionChanger();  
  extensionChanger = new ChoiceFunctionChanger();

  // set preferred sizes
  setPreferredSize(new Dimension(310,290));
  /*textChanger.setPreferredSize(new Dimension(310,20));
  imagesChanger.setPreferredSize(new Dimension(310,20));
  tablesChanger.setPreferredSize(new Dimension(310,20));
  linksChanger.setPreferredSize(new Dimension(310,20));
  downloadsChanger.setPreferredSize(new Dimension(310,40));
  framesChanger.setPreferredSize(new Dimension(310,20));
  extensionChanger.setPreferredSize(new Dimension(310,20));*/

  // set up this panel
  setBorder(BorderFactory.createTitledBorder("functions"));
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));

  // add components
  add(textChanger);
  add(imagesChanger);
  add(tablesChanger);
  add(linksChanger);
  add(downloadsChanger);
  add(framesChanger); 
  add(extensionChanger);
  }

 public void setEnabled(boolean bool)
  {
  super.setEnabled(bool);
  textChanger.setEnabled(bool);
  imagesChanger.setEnabled(bool);
  tablesChanger.setEnabled(bool);
  linksChanger.setEnabled(bool);
  downloadsChanger.setEnabled(bool);
  framesChanger.setEnabled(bool);
  extensionChanger.setEnabled(bool);
  }

 ValueFunction [] getFunctions()
  {
  ValueFunction [] funcs = new ValueFunction[7];
  funcs[0] = textChanger.getFunction();
  funcs[1] = imagesChanger.getFunction();
  funcs[2] = tablesChanger.getFunction();
  funcs[3] = linksChanger.getFunction();
  funcs[4] = downloadsChanger.getFunction();
  funcs[5] = framesChanger.getFunction();
  funcs[6] = extensionChanger.getFunction();
  return funcs;
  }

 }