001package jmri.jmrit.display.layoutEditor;
002
003import javax.annotation.Nonnull;
004import javax.swing.*;
005import javax.swing.border.*;
006
007/**
008 * This is the horizontal toolbar panel
009 *
010 * @author George Warner Copyright: (c) 2019
011 */
012public class LayoutEditorHorizontalToolBarPanel extends LayoutEditorToolBarPanel {
013
014    /**
015     * constructor for LayoutEditorHorizontalToolBarPanel
016     *
017     * @param layoutEditor the layout editor that this is for
018     */
019    public LayoutEditorHorizontalToolBarPanel(@Nonnull LayoutEditor layoutEditor) {
020        super(layoutEditor);
021    }   //constructor
022
023    /**
024     * {@inheritDoc}
025     */
026    @Override
027    protected void layoutComponents() {
028        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
029
030        JPanel outerBorderPanel = this;
031        JPanel innerBorderPanel = this;
032
033        //Row 1
034        JPanel hTop1Panel = new JPanel();
035        hTop1Panel.setLayout(new BoxLayout(hTop1Panel, BoxLayout.LINE_AXIS));
036
037        //Row 1 : Left Components
038        JPanel hTop1Left = new JPanel(leftRowLayout);
039        turnoutLabel = new JLabel(Bundle.getMessage("MakeLabel", Bundle.getMessage("BeanNameTurnout")));
040        hTop1Left.add(turnoutLabel);
041        hTop1Left.add(turnoutRHButton);
042        hTop1Left.add(turnoutLHButton);
043        hTop1Left.add(turnoutWYEButton);
044        hTop1Left.add(doubleXoverButton);
045        hTop1Left.add(rhXoverButton);
046        hTop1Left.add(lhXoverButton);
047        hTop1Left.add(layoutSingleSlipButton);
048        hTop1Left.add(layoutDoubleSlipButton);
049        hTop1Panel.add(hTop1Left);
050
051        if (toolBarIsWide) {
052            hTop1Panel.add(Box.createHorizontalGlue());
053
054            JPanel hTop1Right = new JPanel(rightRowLayout);
055            hTop1Right.add(turnoutNamePanel);
056            hTop1Right.add(extraTurnoutPanel);
057            hTop1Right.add(rotationPanel);
058            hTop1Panel.add(hTop1Right);
059        }
060        innerBorderPanel.add(hTop1Panel);
061
062        //row 2
063        if (!toolBarIsWide) {
064            JPanel hTop2Panel = new JPanel();
065            hTop2Panel.setLayout(new BoxLayout(hTop2Panel, BoxLayout.LINE_AXIS));
066
067            //Row 2 : Left Components
068            JPanel hTop2Center = new JPanel(centerRowLayout);
069            hTop2Center.add(turnoutNamePanel);
070            hTop2Center.add(extraTurnoutPanel);
071            hTop2Center.add(rotationPanel);
072            hTop2Panel.add(hTop2Center);
073
074            innerBorderPanel.add(hTop2Panel);
075        }
076
077        //Row 3 (2 wide)
078        JPanel hTop3Panel = new JPanel();
079        hTop3Panel.setLayout(new BoxLayout(hTop3Panel, BoxLayout.LINE_AXIS));
080
081        //Row 3 : Left Components
082        JPanel hTop3Left = new JPanel(leftRowLayout);
083        trackLabel = new JLabel(Bundle.getMessage("MakeLabel", Bundle.getMessage("Track")));
084
085        hTop3Left.add(trackLabel);
086        hTop3Left.add(levelXingButton);
087        hTop3Left.add(trackButton);
088        hTop3Left.add(trackSegmentPropertiesPanel);
089
090        hTop3Panel.add(hTop3Left);
091        hTop3Panel.add(Box.createHorizontalGlue());
092
093        //Row 3 : Center Components
094        JPanel hTop3Center = new JPanel(centerRowLayout);
095        hTop3Center.add(blockLabel);
096        hTop3Center.add(blockIDComboBox);
097        hTop3Center.add(highlightBlockCheckBox);
098
099        JPanel hTop3CenterA = new JPanel(centerRowLayout);
100        hTop3CenterA.add(blockSensorLabel);
101        hTop3CenterA.add(blockSensorComboBox);
102        hTop3CenterA.setBorder(new EmptyBorder(0, 20, 0, 0));
103        hTop3Center.add(hTop3CenterA);
104
105        hTop3Panel.add(hTop3Center);
106        hTop3Panel.add(Box.createHorizontalGlue());
107
108        if (toolBarIsWide) {
109            //row 3 : Right Components
110            JPanel hTop3Right = new JPanel(rightRowLayout);
111            hTop3Right.add(zoomPanel);
112            hTop3Right.add(locationPanel);
113            hTop3Panel.add(hTop3Right);
114        }
115        outerBorderPanel.add(hTop3Panel);
116
117        //Row 4
118        JPanel hTop4Panel = new JPanel();
119        hTop4Panel.setLayout(new BoxLayout(hTop4Panel, BoxLayout.LINE_AXIS));
120
121        //Row 4 : Left Components
122        JPanel hTop4Left = new JPanel(leftRowLayout);
123        hTop4Left.add(new JLabel(Bundle.getMessage("MakeLabel", Bundle.getMessage("Nodes"))));
124        hTop4Left.add(endBumperButton);
125        hTop4Left.add(anchorButton);
126        hTop4Left.add(edgeButton);
127        hTop4Panel.add(hTop4Left);
128        hTop4Panel.add(Box.createHorizontalGlue());
129
130        if (!toolBarIsWide) {
131            //Row 4 : Right Components
132            JPanel hTop4Right = new JPanel(rightRowLayout);
133            hTop4Right.add(zoomPanel);
134            hTop4Right.add(locationPanel);
135            hTop4Panel.add(hTop4Right);
136        }
137        add(hTop4Panel);
138
139        //Row 5 Components (wide 4-center)
140        labelsLabel = new JLabel(Bundle.getMessage("MakeLabel", Bundle.getMessage("Labels")));
141        if (toolBarIsWide) {
142            JPanel hTop4Center = new JPanel(centerRowLayout);
143            hTop4Center.add(labelsLabel);
144            hTop4Center.add(textLabelButton);
145            hTop4Center.add(textLabelTextField);
146            hTop4Center.add(memoryButton);
147            hTop4Center.add(textMemoryComboBox);
148            hTop4Center.add(globalVariableButton);
149            hTop4Center.add(textGlobalVariableComboBox);
150            hTop4Center.add(blockContentsButton);
151            hTop4Center.add(blockContentsComboBox);
152            hTop4Panel.add(hTop4Center);
153            hTop4Panel.add(Box.createHorizontalGlue());
154            add(hTop4Panel);
155        } else {
156            add(hTop4Panel);
157
158            JPanel hTop5Left = new JPanel(leftRowLayout);
159            hTop5Left.add(labelsLabel);
160            hTop5Left.add(textLabelButton);
161            hTop5Left.add(textLabelTextField);
162            hTop5Left.add(memoryButton);
163            hTop5Left.add(textMemoryComboBox);
164            hTop5Left.add(globalVariableButton);
165            hTop5Left.add(textGlobalVariableComboBox);
166            hTop5Left.add(blockContentsButton);
167            hTop5Left.add(blockContentsComboBox);
168            hTop5Left.add(Box.createHorizontalGlue());
169            add(hTop5Left);
170        }
171
172        //Row 6
173        JPanel hTop6Panel = new JPanel();
174        hTop6Panel.setLayout(new BoxLayout(hTop6Panel, BoxLayout.LINE_AXIS));
175
176        //Row 6 : Left Components
177        //JPanel hTop6Left = new JPanel(centerRowLayout);
178        JPanel hTop6Left = new JPanel(leftRowLayout);
179        hTop6Left.add(multiSensorButton);
180        hTop6Left.add(changeIconsButton);
181        hTop6Left.add(sensorButton);
182        hTop6Left.add(sensorComboBox);
183        hTop6Left.add(signalMastButton);
184        hTop6Left.add(signalMastComboBox);
185        hTop6Left.add(signalButton);
186        hTop6Left.add(signalHeadComboBox);
187        hTop6Left.add(new JLabel(" "));
188        hTop6Left.add(iconLabelButton);
189        hTop6Left.add(logixngButton);
190        hTop6Left.add(audioButton);
191        hTop6Left.add(textAudioComboBox);
192        hTop6Left.add(shapeButton);
193
194        hTop6Panel.add(hTop6Left);
195        add(hTop6Panel);
196    }   //layoutComponents
197
198    //initialize logging
199    //private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LayoutEditorHorizontalToolBarPanel.class);
200}