package gui;

import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.BorderFactory;
import java.util.HashMap;
import java.awt.Dimension;
import java.util.ArrayList;

import controller.Instruction;

public class AktiveRulePanel extends javax.swing.JPanel
{
    private HashMap brick_images_;
    private JLabel message_;
    private static final int CONDITION_HEIGHT = 80;
    private static final int CONDITION_WIDTH = 230;
    private TUGLabyrinth labyrinth_;
    private Dimension start_dimension_;
    private RulePanel aktive_rule_;
    private RuleTreePanel aktive_rule_tree_panel_;
    //private int id_;
    //private Instruction rule_;
    
    public AktiveRulePanel(HashMap brick_images, TUGLabyrinth labyrinth) 
    {
        setLayout(null);
        labyrinth_=labyrinth;
        this.setBackground(Color.GREEN);
        brick_images_ = brick_images;
        setBorder(BorderFactory.createTitledBorder("nächste aktive Regel")); 
        start_dimension_ = this.getSize();   
        aktive_rule_tree_panel_= new RuleTreePanel(brick_images_, labyrinth_, new Dimension(230, 80));
        this.add(aktive_rule_tree_panel_);
    }
       
    public void drawAktiveRule()
    {
        //this.removeAll();
        //    aktive_rule_.setBounds(15,26 , CONDITION_WIDTH,
        //            CONDITION_HEIGHT);
        //    this.add(aktive_rule_);
        //    aktive_rule_.repaint();
        //this.repaint();
    }
    
    public void removeAktiveRule()
    {
        //this.removeAll();
        //aktive_rule_=null;
        //this.repaint();
    }
   
   // public int getRuleId()
   // {
   //  return id_;
   // }
    
   
//     public Instruction getInstruction()
//     {
//       if(new_rule_!=null)
//       {
//         rule_=new Instruction(new_rule_.getInstruction());
//         return rule_;
//       }
//       else 
//         return null;
//     }
     public void setRuleList(ArrayList rule_list) 
     {
        aktive_rule_tree_panel_.setRuleList(rule_list);
    }   
}
