package com.explodingpixels.macwidgets;

import com.explodingpixels.macwidgets.ComponentBottomBar;
import com.explodingpixels.macwidgets.MacWidgetFactory;
import com.explodingpixels.widgets.PopupButton;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.awt.BorderLayout;
import java.util.Arrays;
import java.util.List;

public class DComponentBottomBarTest {
	private JFrame frame;
	@Before
	public void setUp() throws Exception {

	}
	@Test
	public void doTest() throws Exception {

        List<String> list = Arrays.asList("Some Item One",
                "Some Item Two", "Some Item Three", "Some Item Four");
        PopupButton<String> popupButton =
                new PopupButton<String>(list.get(0), list);

        List<String> list2 = Arrays.asList("Custom...", "400%", "200%", "100%",
                "75%", "50%", "25%");
        PopupButton<String> placard2 =
                new PopupButton<String>(list2.get(3), list2);

        JComboBox comboBox = new JComboBox(list2.toArray());

        JButton gradientButton = new JButton("Add");
        gradientButton.putClientProperty("JButton.buttonType", "gradient");

//        JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
        ComponentBottomBar componentBottomBar = MacWidgetFactory.createComponentStatusBar();

        componentBottomBar.addComponentToLeftWithBorder(popupButton.getComponent());
        componentBottomBar.addComponentToLeftWithBorder(placard2.getComponent());
//        componentBottomBar.addComponentToLeftWithBorder(gradientButton);
//        componentBottomBar.addComponentToRight((JComponent) Box.createHorizontalStrut(14));
//        componentBottomBar.addComponentToCenterWithBorder(comboBox);

        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(componentBottomBar.getComponent(), BorderLayout.SOUTH);
        frame.setSize(640, 480);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);

	}
	
	@After
	public void tearDown() throws Exception {
		frame.dispose();
	}	

}