001package jmri.jmrit.display.layoutEditor; 002 003import java.awt.BorderLayout; 004import java.awt.Color; 005import java.awt.Dimension; 006import java.awt.FlowLayout; 007import javax.annotation.Nonnull; 008import javax.swing.*; 009import javax.swing.border.*; 010 011/** 012 * This is the vertical toolbar panel 013 * 014 * @author George Warner Copyright: (c) 2019 015 */ 016public class LayoutEditorVerticalToolBarPanel extends LayoutEditorToolBarPanel { 017 018 /** 019 * constructor for LayoutEditorVerticalToolBarPanel 020 * 021 * @param layoutEditor the layout editor that this is for 022 */ 023 public LayoutEditorVerticalToolBarPanel(@Nonnull LayoutEditor layoutEditor) { 024 super(layoutEditor); 025 } //constructor 026 027 /** 028 * {@inheritDoc} 029 */ 030 @Override 031 protected void layoutComponents() { 032 setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); 033 034 Border blacklineBorder = BorderFactory.createLineBorder(Color.black); 035 036 JPanel outerBorderPanel = new JPanel(); 037 outerBorderPanel.setLayout(new BoxLayout(outerBorderPanel, BoxLayout.PAGE_AXIS)); 038 TitledBorder outerTitleBorder = BorderFactory.createTitledBorder(blacklineBorder, Bundle.getMessage("Track")); 039 outerTitleBorder.setTitleJustification(TitledBorder.CENTER); 040 outerTitleBorder.setTitlePosition(TitledBorder.BOTTOM); 041 outerBorderPanel.setBorder(outerTitleBorder); 042 043 JPanel innerBorderPanel = new JPanel(); 044 innerBorderPanel.setLayout(new BoxLayout(innerBorderPanel, BoxLayout.PAGE_AXIS)); 045 TitledBorder beanNameTitleBorder = BorderFactory.createTitledBorder(blacklineBorder, Bundle.getMessage("BeanNameTurnouts")); 046 beanNameTitleBorder.setTitleJustification(TitledBorder.CENTER); 047 beanNameTitleBorder.setTitlePosition(TitledBorder.BOTTOM); 048 innerBorderPanel.setBorder(beanNameTitleBorder); 049 050 FlowLayout verticalContentLayout = new FlowLayout(FlowLayout.LEFT, 5, 2); //5 pixel gap between items, 2 vertical gap 051 052 turnoutLabel = new JLabel(String.format("-- %s --", Bundle.getMessage("BeanNameTurnout"))); 053 054 JPanel vTop1Panel = new JPanel(verticalContentLayout); 055 vTop1Panel.add(turnoutLHButton); 056 vTop1Panel.add(turnoutRHButton); 057 vTop1Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop1Panel.getPreferredSize().height)); 058 innerBorderPanel.add(vTop1Panel); 059 060 JPanel vTop2Panel = new JPanel(verticalContentLayout); 061 vTop2Panel.add(turnoutWYEButton); 062 vTop2Panel.add(doubleXoverButton); 063 vTop2Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop2Panel.getPreferredSize().height * 2)); 064 innerBorderPanel.add(vTop2Panel); 065 066 JPanel vTop3Panel = new JPanel(verticalContentLayout); 067 vTop3Panel.add(lhXoverButton); 068 vTop3Panel.add(rhXoverButton); 069 vTop3Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop3Panel.getPreferredSize().height)); 070 innerBorderPanel.add(vTop3Panel); 071 072 JPanel vTop4Panel = new JPanel(verticalContentLayout); 073 vTop4Panel.add(layoutSingleSlipButton); 074 vTop4Panel.add(layoutDoubleSlipButton); 075 vTop4Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop4Panel.getPreferredSize().height)); 076 innerBorderPanel.add(vTop4Panel); 077 078 JPanel vTop5Panel = new JPanel(verticalContentLayout); 079 vTop5Panel.add(turnoutNamePanel); 080 vTop5Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop5Panel.getPreferredSize().height)); 081 innerBorderPanel.add(vTop5Panel); 082 083 JPanel vTop6Panel = new JPanel(verticalContentLayout); 084 vTop6Panel.add(extraTurnoutPanel); 085 vTop6Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop6Panel.getPreferredSize().height)); 086 innerBorderPanel.add(vTop6Panel); 087 088 JPanel vTop7Panel = new JPanel(verticalContentLayout); 089 vTop7Panel.add(rotationPanel); 090 vTop7Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop7Panel.getPreferredSize().height)); 091 innerBorderPanel.add(vTop7Panel); 092 093 innerBorderPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, innerBorderPanel.getPreferredSize().height)); 094 outerBorderPanel.add(innerBorderPanel); 095 096 trackLabel = new JLabel(String.format("-- %s --", Bundle.getMessage("Track"))); 097 098 JPanel vTop8Panel = new JPanel(verticalContentLayout); 099 vTop8Panel.add(levelXingButton); 100 vTop8Panel.add(trackButton); 101 vTop8Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop8Panel.getPreferredSize().height)); 102 outerBorderPanel.add(vTop8Panel); 103 104 //this would be vTop9Panel 105 trackSegmentPropertiesPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 106 trackSegmentPropertiesPanel.getPreferredSize().height)); 107 outerBorderPanel.add(trackSegmentPropertiesPanel); 108 109 JPanel vTop10Panel = new JPanel(verticalContentLayout); 110 vTop10Panel.add(blockLabel); 111 vTop10Panel.add(blockIDComboBox); 112 vTop10Panel.add(highlightBlockCheckBox); 113 vTop10Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop10Panel.getPreferredSize().height)); 114 outerBorderPanel.add(vTop10Panel); 115 116 JPanel vTop11Panel = new JPanel(verticalContentLayout); 117 vTop11Panel.add(blockSensorLabel); 118 vTop11Panel.add(blockSensorComboBox); 119 vTop11Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop11Panel.getPreferredSize().height)); 120 vTop11Panel.setBorder(new EmptyBorder(0, 10, 0, 0)); 121 122 outerBorderPanel.add(vTop11Panel); 123 add(outerBorderPanel); 124 125 JPanel nodesBorderPanel = new JPanel(); 126 nodesBorderPanel.setLayout(new BoxLayout(nodesBorderPanel, BoxLayout.PAGE_AXIS)); 127 TitledBorder nodesTitleBorder = BorderFactory.createTitledBorder(blacklineBorder, Bundle.getMessage("Nodes")); 128 nodesTitleBorder.setTitleJustification(TitledBorder.CENTER); 129 nodesTitleBorder.setTitlePosition(TitledBorder.BOTTOM); 130 nodesBorderPanel.setBorder(nodesTitleBorder); 131 132 JPanel vTop12Panel = new JPanel(verticalContentLayout); 133 vTop12Panel.add(endBumperButton); 134 vTop12Panel.add(anchorButton); 135 vTop12Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop12Panel.getPreferredSize().height)); 136 nodesBorderPanel.add(vTop12Panel); 137 138 JPanel vTop13Panel = new JPanel(verticalContentLayout); 139 vTop13Panel.add(edgeButton); 140 vTop13Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop13Panel.getPreferredSize().height)); 141 nodesBorderPanel.add(vTop13Panel); 142 143 add(nodesBorderPanel); 144 145 labelsLabel = new JLabel(String.format("-- %s --", Bundle.getMessage("Labels"))); 146 147 JPanel labelsBorderPanel = new JPanel(); 148 labelsBorderPanel.setLayout(new BoxLayout(labelsBorderPanel, BoxLayout.PAGE_AXIS)); 149 TitledBorder innerTitleBorder = BorderFactory.createTitledBorder(blacklineBorder, Bundle.getMessage("Labels")); 150 innerTitleBorder.setTitleJustification(TitledBorder.CENTER); 151 innerTitleBorder.setTitlePosition(TitledBorder.BOTTOM); 152 labelsBorderPanel.setBorder(innerTitleBorder); 153 154 JPanel vTop14Panel = new JPanel(verticalContentLayout); 155 vTop14Panel.add(textLabelButton); 156 vTop14Panel.add(textLabelTextField); 157 vTop14Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop14Panel.getPreferredSize().height)); 158 labelsBorderPanel.add(vTop14Panel); 159 160 JPanel vTop15Panel = new JPanel(verticalContentLayout); 161 vTop15Panel.add(memoryButton); 162 vTop15Panel.add(textMemoryComboBox); 163 vTop15Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop15Panel.getPreferredSize().height)); 164 labelsBorderPanel.add(vTop15Panel); 165 166 JPanel vTop17Panel = new JPanel(verticalContentLayout); 167 vTop17Panel.add(globalVariableButton); 168 vTop17Panel.add(textGlobalVariableComboBox); 169 vTop17Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop17Panel.getPreferredSize().height)); 170 labelsBorderPanel.add(vTop17Panel); 171 172 JPanel vTop16Panel = new JPanel(verticalContentLayout); 173 vTop16Panel.add(blockContentsButton); 174 vTop16Panel.add(blockContentsComboBox); 175 vTop16Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop16Panel.getPreferredSize().height)); 176 labelsBorderPanel.add(vTop16Panel); 177 178 add(labelsBorderPanel); 179 180 JPanel iconsBorderPanel = new JPanel(); 181 iconsBorderPanel.setLayout(new BoxLayout(iconsBorderPanel, BoxLayout.PAGE_AXIS)); 182 TitledBorder iconsTitleBorder = BorderFactory.createTitledBorder(blacklineBorder, Bundle.getMessage("IconsTitle")); 183 iconsTitleBorder.setTitleJustification(TitledBorder.CENTER); 184 iconsTitleBorder.setTitlePosition(TitledBorder.BOTTOM); 185 iconsBorderPanel.setBorder(iconsTitleBorder); 186 187 JPanel vTop18Panel = new JPanel(verticalContentLayout); 188 vTop18Panel.add(multiSensorButton); 189 vTop18Panel.add(changeIconsButton); 190 vTop18Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop18Panel.getPreferredSize().height)); 191 iconsBorderPanel.add(vTop18Panel); 192 193 JPanel vTop20Panel = new JPanel(verticalContentLayout); 194 vTop20Panel.add(sensorButton); 195 vTop20Panel.add(sensorComboBox); 196 vTop20Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop20Panel.getPreferredSize().height)); 197 iconsBorderPanel.add(vTop20Panel); 198 199 JPanel vTop19Panel = new JPanel(verticalContentLayout); 200 vTop19Panel.add(signalMastButton); 201 vTop19Panel.add(signalMastComboBox); 202 vTop19Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop19Panel.getPreferredSize().height)); 203 iconsBorderPanel.add(vTop19Panel); 204 205 JPanel vTop21Panel = new JPanel(verticalContentLayout); 206 vTop21Panel.add(signalButton); 207 vTop21Panel.add(signalHeadComboBox); 208 vTop21Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop21Panel.getPreferredSize().height)); 209 iconsBorderPanel.add(vTop21Panel); 210 211 JPanel vTop22Panel = new JPanel(verticalContentLayout); 212 vTop22Panel.add(iconLabelButton); 213 vTop22Panel.add(logixngButton); 214 vTop22Panel.add(shapeButton); 215 vTop22Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop22Panel.getPreferredSize().height)); 216 iconsBorderPanel.add(vTop22Panel); 217 218 JPanel vTop23Panel = new JPanel(verticalContentLayout); 219 vTop23Panel.add(audioButton); 220 vTop23Panel.add(textAudioComboBox); 221 vTop23Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, vTop23Panel.getPreferredSize().height)); 222 iconsBorderPanel.add(vTop23Panel); 223 224 add(iconsBorderPanel); 225 add(Box.createVerticalGlue()); 226 227 JPanel bottomPanel = new JPanel(); 228 zoomPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, zoomPanel.getPreferredSize().height)); 229 locationPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, locationPanel.getPreferredSize().height)); 230 bottomPanel.add(zoomPanel); 231 bottomPanel.add(locationPanel); 232 bottomPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, bottomPanel.getPreferredSize().height)); 233 add(bottomPanel, BorderLayout.SOUTH); 234 } //layoutComponents 235 236 //initialize logging 237 //private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LayoutEditorVerticalToolBarPanel.class); 238}