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(turntableButton); 089 hTop3Left.add(traverserButton); 090 hTop3Left.add(trackSegmentPropertiesPanel); 091 092 hTop3Panel.add(hTop3Left); 093 hTop3Panel.add(Box.createHorizontalGlue()); 094 095 //Row 3 : Center Components 096 JPanel hTop3Center = new JPanel(centerRowLayout); 097 hTop3Center.add(blockLabel); 098 hTop3Center.add(blockIDComboBox); 099 hTop3Center.add(highlightBlockCheckBox); 100 101 JPanel hTop3CenterA = new JPanel(centerRowLayout); 102 hTop3CenterA.add(blockSensorLabel); 103 hTop3CenterA.add(blockSensorComboBox); 104 hTop3CenterA.setBorder(new EmptyBorder(0, 20, 0, 0)); 105 hTop3Center.add(hTop3CenterA); 106 107 hTop3Panel.add(hTop3Center); 108 hTop3Panel.add(Box.createHorizontalGlue()); 109 110 if (toolBarIsWide) { 111 //row 3 : Right Components 112 JPanel hTop3Right = new JPanel(rightRowLayout); 113 hTop3Right.add(zoomPanel); 114 hTop3Right.add(locationPanel); 115 hTop3Panel.add(hTop3Right); 116 } 117 outerBorderPanel.add(hTop3Panel); 118 119 //Row 4 120 JPanel hTop4Panel = new JPanel(); 121 hTop4Panel.setLayout(new BoxLayout(hTop4Panel, BoxLayout.LINE_AXIS)); 122 123 //Row 4 : Left Components 124 JPanel hTop4Left = new JPanel(leftRowLayout); 125 hTop4Left.add(new JLabel(Bundle.getMessage("MakeLabel", Bundle.getMessage("Nodes")))); 126 hTop4Left.add(endBumperButton); 127 hTop4Left.add(anchorButton); 128 hTop4Left.add(edgeButton); 129 hTop4Panel.add(hTop4Left); 130 hTop4Panel.add(Box.createHorizontalGlue()); 131 132 if (!toolBarIsWide) { 133 //Row 4 : Right Components 134 JPanel hTop4Right = new JPanel(rightRowLayout); 135 hTop4Right.add(zoomPanel); 136 hTop4Right.add(locationPanel); 137 hTop4Panel.add(hTop4Right); 138 } 139 add(hTop4Panel); 140 141 //Row 5 Components (wide 4-center) 142 labelsLabel = new JLabel(Bundle.getMessage("MakeLabel", Bundle.getMessage("Labels"))); 143 if (toolBarIsWide) { 144 JPanel hTop4Center = new JPanel(centerRowLayout); 145 hTop4Center.add(labelsLabel); 146 hTop4Center.add(textLabelButton); 147 hTop4Center.add(textLabelTextField); 148 hTop4Center.add(memoryButton); 149 hTop4Center.add(textMemoryComboBox); 150 hTop4Center.add(globalVariableButton); 151 hTop4Center.add(textGlobalVariableComboBox); 152 hTop4Center.add(blockContentsButton); 153 hTop4Center.add(blockContentsComboBox); 154 hTop4Panel.add(hTop4Center); 155 hTop4Panel.add(Box.createHorizontalGlue()); 156 add(hTop4Panel); 157 } else { 158 add(hTop4Panel); 159 160 JPanel hTop5Left = new JPanel(leftRowLayout); 161 hTop5Left.add(labelsLabel); 162 hTop5Left.add(textLabelButton); 163 hTop5Left.add(textLabelTextField); 164 hTop5Left.add(memoryButton); 165 hTop5Left.add(textMemoryComboBox); 166 hTop5Left.add(globalVariableButton); 167 hTop5Left.add(textGlobalVariableComboBox); 168 hTop5Left.add(blockContentsButton); 169 hTop5Left.add(blockContentsComboBox); 170 hTop5Left.add(Box.createHorizontalGlue()); 171 add(hTop5Left); 172 } 173 174 //Row 6 175 JPanel hTop6Panel = new JPanel(); 176 hTop6Panel.setLayout(new BoxLayout(hTop6Panel, BoxLayout.LINE_AXIS)); 177 178 //Row 6 : Left Components 179 //JPanel hTop6Left = new JPanel(centerRowLayout); 180 JPanel hTop6Left = new JPanel(leftRowLayout); 181 hTop6Left.add(multiSensorButton); 182 hTop6Left.add(changeIconsButton); 183 hTop6Left.add(sensorButton); 184 hTop6Left.add(sensorComboBox); 185 hTop6Left.add(turnoutButton); 186 hTop6Left.add(turnoutComboBox); 187 hTop6Left.add(signalMastButton); 188 hTop6Left.add(signalMastComboBox); 189 hTop6Left.add(signalButton); 190 hTop6Left.add(signalHeadComboBox); 191 hTop6Left.add(new JLabel(" ")); 192 hTop6Left.add(iconLabelButton); 193 hTop6Left.add(logixngButton); 194 hTop6Left.add(audioButton); 195 hTop6Left.add(textAudioComboBox); 196 hTop6Left.add(shapeButton); 197 198 hTop6Panel.add(hTop6Left); 199 add(hTop6Panel); 200 } //layoutComponents 201 202 //initialize logging 203 //private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LayoutEditorHorizontalToolBarPanel.class); 204}