/*
 * To change panel template, choose Tools | Templates
 * and open the template in the editor.
 */

package menu;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.border.Border.*;
import DrawTop.*;

public class DrawMenu {
    int debug=0;
    
    public  JPanel createHomeTabPanel(){
        JPanel tabPanel=new JPanel();
        tabPanel.setName("HomeTabPanel");
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        tabPanel.setLayout(flowLayout);
        
        JPanel pageGroup = this.createPageGroup();
        tabPanel.add(pageGroup);

        JPanel fileGroup=this.createFileGroup();
        tabPanel.add(fileGroup);
        
        
        JPanel acceleratorGroup=this.createAcceleratorsGroup();
        tabPanel.add(acceleratorGroup);
        return tabPanel;
    }
    
    public JPanel createShapeTabPanel(){
        JPanel tabPanel=new JPanel();
        tabPanel.setName("ShapeTabPanel");
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        tabPanel.setLayout(flowLayout);

        JPanel pageGroup=this.createPageGroup();
        tabPanel.add(pageGroup);
        
        JPanel editGroup=this.createEditGroup();
        tabPanel.add(editGroup);
        
        JPanel shapeGroup=this.createShapeGroup();
        tabPanel.add(shapeGroup);
        
        JPanel shapeStyleGroup=this.createShapeStyleGroup();
        tabPanel.add(shapeStyleGroup);
        
        JPanel shapeLayoutGroup=this.createShapeLayoutGroup();
        tabPanel.add(shapeLayoutGroup);
        
        return tabPanel;
    }
    
    public JPanel createHelpTabPanel(){
        JPanel tabPanel=new JPanel();
        tabPanel.setName("HelpTabPanel");
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        tabPanel.setLayout(flowLayout);
        JPanel debugTestGroup=this.createDebugTestGroup();
        tabPanel.add(debugTestGroup);
        return tabPanel;
    }
    
    public  JPanel createFileGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);
        Component component;
        int width=45;
        component=ButtonOfToggle.createButton("new", width, "file new", null);
        panel.add(component);
        component=ButtonOfToggle.createButton("open", width, "file open", null);
        panel.add(component);
        component=ButtonOfToggle.createButton("save", width, "file save", null);
        panel.add(component);
        component=ButtonOfToggle.createButton("saveAs", width+6, "file saveAs", null);
        panel.add(component);
        component=ButtonOfPulldownMenu.createPageButton(40);
        panel.add(component);
        component=ButtonOfToggle.createButton("page layout", true, "", "page layout");
        panel.add(component);
        component=ButtonOfToggle.createButton("print", 40, "print", null);
        panel.add(component);
        component=ButtonOfToggle.createButton("exit", width,"exit", null);
        panel.add(component);
        return panel;
    }
    
    public JPanel createPageGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);

        Component component;
        component=ButtonOfToggle.createButton("previous page", false, "previousPage32T.png", "previous page");
        panel.add(component);
        component=ButtonOfToggle.createButton("next page", false, "nextPage32T.png", "next page");
        panel.add(component);
        component=ButtonOfToggle.createButton("insert new page", false, "insertNewPage32T.png", "insert new page");
        panel.add(component);
        component=ButtonOfToggle.createButton("delete page", false, "deletePage32T.png", "delete page");
        panel.add(component);
        component=ButtonOfToggle.createButton("zoom", true, "", "zoom");
        panel.add(component);
        return panel;
    }
    
    public  JPanel createAcceleratorsGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        panel.setLayout(flowLayout);
        Component component;
        component=ButtonOfAccelerators.createEditAccelerators("accelerators");
        panel.add(component);
        return panel;
    }
    
    public JPanel createEditGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);

        Component component;
        component=ButtonOfToggle.createButton("undo", "undoEnabled32T.png", "undoDisenabled32T.png", "undo");
        component.setEnabled(false);
        panel.add(component);
        component=ButtonOfToggle.createButton("redo","redoEnabled32T.png", "redoDisenabled32T.png","redo");
        component.setEnabled(false);
        panel.add(component);
        
        int width=32;
        component=ButtonOfPulldownMenu.createEditButton(width);
        panel.add(component);
        String[] accelarators={"typed \b", "DELETE"};
        component=ButtonOfToggle.createButton("del", width, "del", accelarators);
        panel.add(component);

        return panel;
    }
    
    public JPanel createShapeGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);

        Component component;
        component=ButtonOfToggle.createButton("text box", false, "text_box32T.png", 
                "create text box");
        panel.add(component);
        component=ButtonOfToggle.createButton("rectangle", false, "rectangle32T.png", 
                "create rectangle");
        panel.add(component);
        component=ButtonOfToggle.createButton("round rectangle", false, "round_rectangle32T.png", 
                "create round_rectangle");
        panel.add(component);
        component=ButtonOfToggle.createButton("ellipse", false, "ellipse32T.png", "create ellipse");
        panel.add(component);

        component=ButtonOfToggle.createButton("line", false, "line32T.png", "create line");
        panel.add(component);

        component=ButtonOfToggle.createButton("arrow", false, "arrow32T.png", "create arrow");
        panel.add(component);

        component=ButtonOfToggle.createButton("double arrow", false, "double_arrow32T.png", 
                "create double arrow");
        panel.add(component);

        component=ButtonOfToggle.createButton("polyline", false, "polyline32T.png", 
                "create polyline/polygon");
        panel.add(component);

        component=ButtonOfToggle.createButton("cubic_curve", false, "cubicCurve32T.png", 
                "create cubic curve");
        panel.add(component);

        component=ButtonOfPulldownMenu.createAuxShapeButton(32);
        panel.add(component);

        component=ButtonOfToggle.createButton("lib", 32, "shape/component library", null);
        panel.add(component);
        
        component=ButtonOfPulldownMenu.createShapeUtilButton(32);
        panel.add(component);
       
        component=ButtonOfPulldownMenu.createSettingButton(44);
        panel.add(component);

        return panel;
    }
    
    public JPanel createShapeStyleGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);
        
        Component component;

        int width=35;
        component=ButtonOfFontMenu.createFontMenuButton("font", width, "Font style");
        panel.add(component);
        
        component=ButtonOfPulldownMenu.createTextAlignButton();
        panel.add(component);

        component=ButtonOfPulldownMenu.createFillColorChooserButton(true);
        panel.add(component);
        
        component=ButtonOfPulldownMenu.createLineColorChooserButton(true);
        panel.add(component);
        
        component=ButtonOfPulldownMenu.createLineWidthButton(true);
        panel.add(component);
        
        component=ButtonOfPulldownMenu.createLineStrokeButton(true);
        panel.add(component);
        
        component=ButtonOfPulldownMenu.createArrowStyleButton(true);
        panel.add(component);
        return panel;
    }
    
    public JPanel createShapeLayoutGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);

        Component component;
        
        component=ButtonOfPulldownMenu.createZorderButton(true);
        panel.add(component);

        component=ButtonOfPulldownMenu.createAlignButton(true);
        panel.add(component);
        
        component=ButtonOfToggle.createButton("group", false, "group32T.png", "group");
        panel.add(component);
        component=ButtonOfToggle.createButton("ungroup", false, "ungroup32T.png", "ungroup");
        panel.add(component);

        return panel;
    }
    
    public JPanel createFontStyleGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        //JPanel fontPanel=new JPanel();
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);

        Component component;
        component=ComboBox.createFontFamilyComboBox("font family");
        panel.add(component);
        component=ComboBox.createFontSizeComboBox("font size");
        panel.add(component);

        component=ButtonOfToggle.createButton("bold", false, "font_bold32T.png", "Bold");
        panel.add(component);
        component=ButtonOfToggle.createButton("italic", false, "font_italic32T.png", "Italic");
        panel.add(component);
        component=ButtonOfToggle.createButton("underline", false, "font_underline32T.png", 
                "Underline");
        panel.add(component);
        component=ButtonOfToggle.createButton("subscript", false, "subscript32T.png", 
                "subscript");
        panel.add(component);
        component=ButtonOfToggle.createButton("superscript", false, "superscript32T.png", 
                "superscript");
        panel.add(component);
        component=ButtonOfColorChooser.createColorChooserButton("font color", false, 
                "font_color32T.png", "font color");
        panel.add(component);

        return panel;
    }
    
    public JPanel createDebugTestGroup(){
        JPanel panel=new JPanel();
        FlowLayout flowLayout=new FlowLayout(FlowLayout.LEADING, 0, 0);
        Border paneEdge = BorderFactory.createLineBorder(Color.black);
        Border raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
        panel.setLayout(flowLayout);
        panel.setBorder(paneEdge);
        panel.setBorder(raisedetched);
        panel.setFont(MenuConstants.MenuFont);
        
        Component component=null;
        component=ButtonOfDebug.createDebugButton(40);
        panel.add(component);
		component=ButtonOfTest.createTestButton(40);
        //component=ButtonOfPulldownMenu.createTestButton(40);
        panel.add(component);
        
        return panel;
    }
}
