package Common.Visual.Controls;
public class ExpandCollapseButton extends MenuBarButton {
    protected String description;
    protected ECButtonPosition position;
    public ExpandCollapseButton(String description_in, ECButtonPosition position_in) {
        description = description_in;
        position = position_in;
        Switch(true);
    }
    public void Switch(boolean flag) {
        String prefix = "?";
        String icon_name = "Help";
        if (flag) {
            prefix = "Развернуть";
            switch (position) {
                case Up:
                    icon_name = "ExpandDown";
                    break;
                case Down:
                    icon_name = "CollapseUp";
                    break;
                case Left:
                    icon_name = "SilwerArrowLeft";
                    break;
                case Right:
                    icon_name = "SilwerArrowRight";
                    break;
            }
        } else {
            prefix = "Свернуть";
            switch (position) {
                case Up:
                    icon_name = "CollapseUp";
                    break;
                case Down:
                    icon_name = "ExpandDown";
                    break;
                case Left:
                    icon_name = "SilwerArrowRight";
                    break;
                case Right:
                    icon_name = "SilwerArrowLeft";
                    break;
            }
        }
        setToolTipText(prefix + " " + description);
        setIcon("/Common/icons/" + icon_name + ".png");
        revalidate();
        repaint();
    }
}
