| 1 | /* |
|---|
| 2 | * To change this license header, choose License Headers in Project Properties. |
|---|
| 3 | * To change this template file, choose Tools | Templates |
|---|
| 4 | * and open the template in the editor. |
|---|
| 5 | */ |
|---|
| 6 | package atmsdriver.trafficeventseditor; |
|---|
| 7 | |
|---|
| 8 | import atmsdriver.model.Highway; |
|---|
| 9 | import atmsdriver.model.LoopDetector; |
|---|
| 10 | import atmsdriver.model.LoopDetector.DOTCOLOR; |
|---|
| 11 | import atmsdriver.model.Station; |
|---|
| 12 | import java.util.ArrayList; |
|---|
| 13 | import java.util.Enumeration; |
|---|
| 14 | import java.util.Observable; |
|---|
| 15 | import java.util.Observer; |
|---|
| 16 | import javax.swing.AbstractButton; |
|---|
| 17 | import javax.swing.AbstractListModel; |
|---|
| 18 | import javax.swing.ButtonGroup; |
|---|
| 19 | import javax.swing.DefaultListSelectionModel; |
|---|
| 20 | import javax.swing.JComboBox; |
|---|
| 21 | import javax.swing.JList; |
|---|
| 22 | import javax.swing.JOptionPane; |
|---|
| 23 | import javax.swing.JTable; |
|---|
| 24 | import javax.swing.JTextField; |
|---|
| 25 | import javax.swing.ListSelectionModel; |
|---|
| 26 | import javax.swing.event.ListSelectionEvent; |
|---|
| 27 | import javax.swing.event.ListSelectionListener; |
|---|
| 28 | import javax.swing.table.AbstractTableModel; |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * |
|---|
| 32 | * @author jtorres |
|---|
| 33 | */ |
|---|
| 34 | public class TrafficEventsEditor extends javax.swing.JFrame implements Observer |
|---|
| 35 | { |
|---|
| 36 | |
|---|
| 37 | TimeFrames timeFrames; |
|---|
| 38 | |
|---|
| 39 | /** |
|---|
| 40 | * Creates new form BatchBuilderGUI |
|---|
| 41 | */ |
|---|
| 42 | public TrafficEventsEditor(TimeFrames timeFrames) |
|---|
| 43 | { |
|---|
| 44 | initComponents(); |
|---|
| 45 | this.timeFrames = timeFrames; |
|---|
| 46 | |
|---|
| 47 | HighwayList.setModel(new HighwaysListModel()); |
|---|
| 48 | HighwayList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|---|
| 49 | HighwayList.addListSelectionListener(new HighwaysListSelectionListener()); |
|---|
| 50 | |
|---|
| 51 | StationTable.setModel(new StationTableModel()); |
|---|
| 52 | StationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|---|
| 53 | StationTable.getSelectionModel().addListSelectionListener( |
|---|
| 54 | new StationTableListSelectionListener()); |
|---|
| 55 | |
|---|
| 56 | TimeFrameList.setModel(new TimeFrameListModel()); |
|---|
| 57 | TimeFrameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|---|
| 58 | TimeFrameList.addListSelectionListener(new TimeFrameListSelectionListener()); |
|---|
| 59 | |
|---|
| 60 | LoopDetectorTable.setModel(new LoopDetectorTableModel()); |
|---|
| 61 | LoopDetectorTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|---|
| 62 | LoopDetectorTable.getSelectionModel().addListSelectionListener( |
|---|
| 63 | new LoopDetectorTableListSelectionListener()); |
|---|
| 64 | |
|---|
| 65 | TrafficLaneEventsTable.setModel(new TrafficLaneEventsTableModel()); |
|---|
| 66 | TrafficLaneEventsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|---|
| 67 | TrafficLaneEventsTable.getSelectionModel().addListSelectionListener( |
|---|
| 68 | new TrafficLaneEventsTableSelectionListener()); |
|---|
| 69 | |
|---|
| 70 | GreenButton.setSelected(true); |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | private class TrafficLaneEventsTableModel extends AbstractTableModel |
|---|
| 74 | { |
|---|
| 75 | String[] columnNames = {"Route", "StationID", "Postmile", "LoopID", "LoopType", |
|---|
| 76 | "LoopDesc", "Color"}; |
|---|
| 77 | int rows; |
|---|
| 78 | int cols; |
|---|
| 79 | String[][] data; |
|---|
| 80 | TimeFrame currFrame; |
|---|
| 81 | public TrafficLaneEventsTableModel() |
|---|
| 82 | { |
|---|
| 83 | currFrame = timeFrames.currentTimeFrame; |
|---|
| 84 | rows = currFrame != null ? currFrame.events.size() : 0; |
|---|
| 85 | cols = columnNames.length; |
|---|
| 86 | data = new String[rows][cols]; |
|---|
| 87 | for(int i = 0; i < rows; i++) |
|---|
| 88 | { |
|---|
| 89 | TrafficLaneEvent currEvent = currFrame.events.get(i); |
|---|
| 90 | data[i][0] = Integer.toString(currEvent.routeNum); |
|---|
| 91 | data[i][1] = Integer.toString(currEvent.station.ldsID); |
|---|
| 92 | data[i][2] = Double.toString(currEvent.station.postmile); |
|---|
| 93 | data[i][3] = Integer.toString(currEvent.loopDetector.loopID); |
|---|
| 94 | data[i][4] = currEvent.loopDetector.loopLocationID; |
|---|
| 95 | data[i][5] = currEvent.loopDetector.loopLocation; |
|---|
| 96 | data[i][6] = currEvent.color.getLetter(); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | @Override |
|---|
| 101 | public String getColumnName(int col) |
|---|
| 102 | { |
|---|
| 103 | return columnNames[col]; |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | @Override |
|---|
| 107 | public int getRowCount() |
|---|
| 108 | { |
|---|
| 109 | return rows; |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | @Override |
|---|
| 113 | public int getColumnCount() |
|---|
| 114 | { |
|---|
| 115 | return cols; |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | @Override |
|---|
| 119 | public Object getValueAt(int rowIndex, int columnIndex) |
|---|
| 120 | { |
|---|
| 121 | return data[rowIndex][columnIndex]; |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | private class LoopDetectorTableModel extends AbstractTableModel |
|---|
| 127 | { |
|---|
| 128 | String[] columnnames = {"Loop_ID", "Loop_Type", "Loop_Desc"}; |
|---|
| 129 | int rows; |
|---|
| 130 | int cols; |
|---|
| 131 | String[][] data; |
|---|
| 132 | Station currStn; |
|---|
| 133 | |
|---|
| 134 | public LoopDetectorTableModel() |
|---|
| 135 | { |
|---|
| 136 | currStn = timeFrames.currentStation; |
|---|
| 137 | rows = currStn != null ? currStn.loops.size() : 0; |
|---|
| 138 | cols = columnnames.length; |
|---|
| 139 | data = new String[rows][cols]; |
|---|
| 140 | for(int i = 0; i < rows; i++) |
|---|
| 141 | { |
|---|
| 142 | data[i][0] = Integer.toString(currStn.loops.get(i).loopID); |
|---|
| 143 | data[i][1] = currStn.loops.get(i).loopLocationID; |
|---|
| 144 | data[i][2] = currStn.loops.get(i).loopLocation; |
|---|
| 145 | } |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | @Override |
|---|
| 149 | public String getColumnName(int col) |
|---|
| 150 | { |
|---|
| 151 | return columnnames[col]; |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | @Override |
|---|
| 155 | public int getRowCount() |
|---|
| 156 | { |
|---|
| 157 | return rows; |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | @Override |
|---|
| 161 | public int getColumnCount() |
|---|
| 162 | { |
|---|
| 163 | return cols; |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | @Override |
|---|
| 167 | public Object getValueAt(int rowIndex, int columnIndex) |
|---|
| 168 | { |
|---|
| 169 | return data[rowIndex][columnIndex]; |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | private class TimeFrameListModel extends AbstractListModel |
|---|
| 175 | { |
|---|
| 176 | ArrayList<TimeFrame> frames; |
|---|
| 177 | |
|---|
| 178 | public TimeFrameListModel() |
|---|
| 179 | { |
|---|
| 180 | frames = (ArrayList<TimeFrame>) timeFrames.frames; |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | @Override |
|---|
| 184 | public int getSize() |
|---|
| 185 | { |
|---|
| 186 | return frames.size(); |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | @Override |
|---|
| 190 | public Object getElementAt(int index) |
|---|
| 191 | { |
|---|
| 192 | return frames.get(index); |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | private class TrafficLaneEventsTableSelectionListener implements ListSelectionListener |
|---|
| 198 | { |
|---|
| 199 | @Override |
|---|
| 200 | public void valueChanged(ListSelectionEvent e) |
|---|
| 201 | { |
|---|
| 202 | if(e.getValueIsAdjusting()) |
|---|
| 203 | return; |
|---|
| 204 | DefaultListSelectionModel mod = (DefaultListSelectionModel) e.getSource(); |
|---|
| 205 | int index = mod.getMaxSelectionIndex(); |
|---|
| 206 | if(index >= 0) |
|---|
| 207 | timeFrames.setCurrentTrafficLaneEvent(index); |
|---|
| 208 | } |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | private class HighwaysListSelectionListener implements ListSelectionListener |
|---|
| 212 | { |
|---|
| 213 | @Override |
|---|
| 214 | public void valueChanged(ListSelectionEvent e) |
|---|
| 215 | { |
|---|
| 216 | if(e.getValueIsAdjusting()) |
|---|
| 217 | return; |
|---|
| 218 | JList source = (JList) e.getSource(); |
|---|
| 219 | timeFrames.setCurrentHighway(source.getSelectedIndex()); |
|---|
| 220 | } |
|---|
| 221 | } |
|---|
| 222 | |
|---|
| 223 | private class TimeFrameListSelectionListener implements ListSelectionListener |
|---|
| 224 | { |
|---|
| 225 | @Override |
|---|
| 226 | public void valueChanged(ListSelectionEvent e) |
|---|
| 227 | { |
|---|
| 228 | if(e.getValueIsAdjusting()) |
|---|
| 229 | return; |
|---|
| 230 | JList source = (JList) e.getSource(); |
|---|
| 231 | int index = source.getSelectedIndex(); |
|---|
| 232 | if(index >= 0) |
|---|
| 233 | { |
|---|
| 234 | timeFrames.setCurrentTimeFrame(index); |
|---|
| 235 | } |
|---|
| 236 | } |
|---|
| 237 | } |
|---|
| 238 | |
|---|
| 239 | private class StationTableListSelectionListener implements ListSelectionListener |
|---|
| 240 | { |
|---|
| 241 | |
|---|
| 242 | @Override |
|---|
| 243 | public void valueChanged(ListSelectionEvent e) |
|---|
| 244 | { |
|---|
| 245 | if(e.getValueIsAdjusting()) |
|---|
| 246 | return; |
|---|
| 247 | DefaultListSelectionModel mod = (DefaultListSelectionModel) e.getSource(); |
|---|
| 248 | int index = mod.getMaxSelectionIndex(); |
|---|
| 249 | if(index >= 0) |
|---|
| 250 | timeFrames.setCurrentStation(index); |
|---|
| 251 | } |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | private class LoopDetectorTableListSelectionListener implements ListSelectionListener |
|---|
| 255 | { |
|---|
| 256 | |
|---|
| 257 | @Override |
|---|
| 258 | public void valueChanged(ListSelectionEvent e) |
|---|
| 259 | { |
|---|
| 260 | if(e.getValueIsAdjusting()) |
|---|
| 261 | return; |
|---|
| 262 | DefaultListSelectionModel mod = (DefaultListSelectionModel) e.getSource(); |
|---|
| 263 | int index = mod.getMaxSelectionIndex(); |
|---|
| 264 | if(index >= 0) |
|---|
| 265 | timeFrames.setCurrentLoopDetector(index); |
|---|
| 266 | } |
|---|
| 267 | |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | private class StationTableModel extends AbstractTableModel |
|---|
| 271 | { |
|---|
| 272 | String[] columnNames = {"lds_id", "postmile", "location"}; |
|---|
| 273 | String[][] data; |
|---|
| 274 | Highway hwy; |
|---|
| 275 | int rows; |
|---|
| 276 | int cols; |
|---|
| 277 | |
|---|
| 278 | public StationTableModel() |
|---|
| 279 | { |
|---|
| 280 | hwy = TrafficEventsEditor.this.timeFrames.currentHighway; |
|---|
| 281 | cols = 3; |
|---|
| 282 | rows = hwy != null ? hwy.stations.size() : 0; |
|---|
| 283 | data = new String[rows][cols]; |
|---|
| 284 | for(int i = 0; i < rows; i++) |
|---|
| 285 | { |
|---|
| 286 | data[i][0] = Integer.toString(hwy.stations.get(i).ldsID); |
|---|
| 287 | data[i][1] = Double.toString(hwy.stations.get(i).postmile); |
|---|
| 288 | data[i][2] = hwy.stations.get(i).location; |
|---|
| 289 | } |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | @Override |
|---|
| 293 | public String getColumnName(int col) |
|---|
| 294 | { |
|---|
| 295 | return columnNames[col]; |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | @Override |
|---|
| 299 | public int getRowCount() |
|---|
| 300 | { |
|---|
| 301 | return rows; |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | @Override |
|---|
| 305 | public int getColumnCount() |
|---|
| 306 | { |
|---|
| 307 | return cols; |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | @Override |
|---|
| 311 | public Object getValueAt(int rowIndex, int columnIndex) |
|---|
| 312 | { |
|---|
| 313 | return data[rowIndex][columnIndex]; |
|---|
| 314 | } |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | private class HighwaysListModel extends AbstractListModel |
|---|
| 318 | { |
|---|
| 319 | |
|---|
| 320 | @Override |
|---|
| 321 | public int getSize() |
|---|
| 322 | { |
|---|
| 323 | return TrafficEventsEditor.this.timeFrames.highways.highways.size(); |
|---|
| 324 | } |
|---|
| 325 | |
|---|
| 326 | @Override |
|---|
| 327 | public Object getElementAt(int index) |
|---|
| 328 | { |
|---|
| 329 | return TrafficEventsEditor.this.timeFrames.highways.highways.get(index); |
|---|
| 330 | } |
|---|
| 331 | } |
|---|
| 332 | |
|---|
| 333 | /** |
|---|
| 334 | * This method is called from within the constructor to initialize the form. |
|---|
| 335 | * WARNING: Do NOT modify this code. The content of this method is always |
|---|
| 336 | * regenerated by the Form Editor. |
|---|
| 337 | */ |
|---|
| 338 | @SuppressWarnings("unchecked") |
|---|
| 339 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
|---|
| 340 | private void initComponents() |
|---|
| 341 | { |
|---|
| 342 | |
|---|
| 343 | colorRadioButtons = new javax.swing.ButtonGroup(); |
|---|
| 344 | jPanel6 = new javax.swing.JPanel(); |
|---|
| 345 | jPanel2 = new javax.swing.JPanel(); |
|---|
| 346 | HighwayScrollPane = new javax.swing.JScrollPane(); |
|---|
| 347 | HighwayList = new javax.swing.JList(); |
|---|
| 348 | jPanel4 = new javax.swing.JPanel(); |
|---|
| 349 | StationScrollPane = new javax.swing.JScrollPane(); |
|---|
| 350 | StationTable = new javax.swing.JTable(); |
|---|
| 351 | jPanel5 = new javax.swing.JPanel(); |
|---|
| 352 | LoopDetectorScrollPane = new javax.swing.JScrollPane(); |
|---|
| 353 | LoopDetectorTable = new javax.swing.JTable(); |
|---|
| 354 | jPanel1 = new javax.swing.JPanel(); |
|---|
| 355 | jPanel9 = new javax.swing.JPanel(); |
|---|
| 356 | jLabel1 = new javax.swing.JLabel(); |
|---|
| 357 | CurrentTimeFrameLabel = new javax.swing.JLabel(); |
|---|
| 358 | CurrentHighwayLabel = new javax.swing.JLabel(); |
|---|
| 359 | jLabel2 = new javax.swing.JLabel(); |
|---|
| 360 | jLabel3 = new javax.swing.JLabel(); |
|---|
| 361 | CurrentStationLabel = new javax.swing.JLabel(); |
|---|
| 362 | CurrentStationPostmileLabel = new javax.swing.JLabel(); |
|---|
| 363 | jLabel4 = new javax.swing.JLabel(); |
|---|
| 364 | jLabel5 = new javax.swing.JLabel(); |
|---|
| 365 | CurrentStationLocationLabel = new javax.swing.JLabel(); |
|---|
| 366 | CurrentLoopDetectorLabel = new javax.swing.JLabel(); |
|---|
| 367 | jLabel6 = new javax.swing.JLabel(); |
|---|
| 368 | jLabel7 = new javax.swing.JLabel(); |
|---|
| 369 | CurrentLoopDetectorTypeLabel = new javax.swing.JLabel(); |
|---|
| 370 | CurrentLoopDetectorDescLabel = new javax.swing.JLabel(); |
|---|
| 371 | jLabel8 = new javax.swing.JLabel(); |
|---|
| 372 | jPanel7 = new javax.swing.JPanel(); |
|---|
| 373 | GreenButton = new javax.swing.JRadioButton(); |
|---|
| 374 | YellowButton = new javax.swing.JRadioButton(); |
|---|
| 375 | RedButton = new javax.swing.JRadioButton(); |
|---|
| 376 | AddNewEventButton = new javax.swing.JButton(); |
|---|
| 377 | DeleteEventButton = new javax.swing.JButton(); |
|---|
| 378 | jPanel11 = new javax.swing.JPanel(); |
|---|
| 379 | jPanel12 = new javax.swing.JPanel(); |
|---|
| 380 | SinglePreviewStationButton = new javax.swing.JButton(); |
|---|
| 381 | SinglePreviewHighwaysButton = new javax.swing.JButton(); |
|---|
| 382 | jPanel13 = new javax.swing.JPanel(); |
|---|
| 383 | CumulativePreviewStationButton = new javax.swing.JButton(); |
|---|
| 384 | CumulativePreviewHighwaysButton = new javax.swing.JButton(); |
|---|
| 385 | jPanel15 = new javax.swing.JPanel(); |
|---|
| 386 | jPanel3 = new javax.swing.JPanel(); |
|---|
| 387 | TimeFrameScrollPane = new javax.swing.JScrollPane(); |
|---|
| 388 | TimeFrameList = new javax.swing.JList(); |
|---|
| 389 | jPanel10 = new javax.swing.JPanel(); |
|---|
| 390 | AddNewTimeFrameButton = new javax.swing.JButton(); |
|---|
| 391 | DeleteTimeFrameButton = new javax.swing.JButton(); |
|---|
| 392 | jPanel8 = new javax.swing.JPanel(); |
|---|
| 393 | jScrollPane1 = new javax.swing.JScrollPane(); |
|---|
| 394 | TrafficLaneEventsTable = new javax.swing.JTable(); |
|---|
| 395 | jPanel14 = new javax.swing.JPanel(); |
|---|
| 396 | jButton1 = new javax.swing.JButton(); |
|---|
| 397 | jButton2 = new javax.swing.JButton(); |
|---|
| 398 | jButton3 = new javax.swing.JButton(); |
|---|
| 399 | |
|---|
| 400 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|---|
| 401 | setTitle("Traffic Events Editor"); |
|---|
| 402 | |
|---|
| 403 | jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Lane Selection Panel")); |
|---|
| 404 | |
|---|
| 405 | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1), "Highway")); |
|---|
| 406 | |
|---|
| 407 | HighwayList.setModel(new javax.swing.AbstractListModel() |
|---|
| 408 | { |
|---|
| 409 | String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; |
|---|
| 410 | public int getSize() { return strings.length; } |
|---|
| 411 | public Object getElementAt(int i) { return strings[i]; } |
|---|
| 412 | }); |
|---|
| 413 | HighwayScrollPane.setViewportView(HighwayList); |
|---|
| 414 | |
|---|
| 415 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); |
|---|
| 416 | jPanel2.setLayout(jPanel2Layout); |
|---|
| 417 | jPanel2Layout.setHorizontalGroup( |
|---|
| 418 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 419 | .addComponent(HighwayScrollPane, javax.swing.GroupLayout.Alignment.TRAILING) |
|---|
| 420 | ); |
|---|
| 421 | jPanel2Layout.setVerticalGroup( |
|---|
| 422 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 423 | .addComponent(HighwayScrollPane) |
|---|
| 424 | ); |
|---|
| 425 | |
|---|
| 426 | jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1), "Station")); |
|---|
| 427 | |
|---|
| 428 | StationTable.setModel(new javax.swing.table.DefaultTableModel( |
|---|
| 429 | new Object [][] |
|---|
| 430 | { |
|---|
| 431 | {null, null, null, null}, |
|---|
| 432 | {null, null, null, null}, |
|---|
| 433 | {null, null, null, null}, |
|---|
| 434 | {null, null, null, null} |
|---|
| 435 | }, |
|---|
| 436 | new String [] |
|---|
| 437 | { |
|---|
| 438 | "Title 1", "Title 2", "Title 3", "Title 4" |
|---|
| 439 | } |
|---|
| 440 | )); |
|---|
| 441 | StationScrollPane.setViewportView(StationTable); |
|---|
| 442 | |
|---|
| 443 | javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); |
|---|
| 444 | jPanel4.setLayout(jPanel4Layout); |
|---|
| 445 | jPanel4Layout.setHorizontalGroup( |
|---|
| 446 | jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 447 | .addComponent(StationScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 546, Short.MAX_VALUE) |
|---|
| 448 | ); |
|---|
| 449 | jPanel4Layout.setVerticalGroup( |
|---|
| 450 | jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 451 | .addComponent(StationScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE) |
|---|
| 452 | ); |
|---|
| 453 | |
|---|
| 454 | jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1), "Loop Detector")); |
|---|
| 455 | |
|---|
| 456 | LoopDetectorTable.setModel(new javax.swing.table.DefaultTableModel( |
|---|
| 457 | new Object [][] |
|---|
| 458 | { |
|---|
| 459 | {null, null, null, null}, |
|---|
| 460 | {null, null, null, null}, |
|---|
| 461 | {null, null, null, null}, |
|---|
| 462 | {null, null, null, null} |
|---|
| 463 | }, |
|---|
| 464 | new String [] |
|---|
| 465 | { |
|---|
| 466 | "Title 1", "Title 2", "Title 3", "Title 4" |
|---|
| 467 | } |
|---|
| 468 | )); |
|---|
| 469 | LoopDetectorScrollPane.setViewportView(LoopDetectorTable); |
|---|
| 470 | |
|---|
| 471 | javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); |
|---|
| 472 | jPanel5.setLayout(jPanel5Layout); |
|---|
| 473 | jPanel5Layout.setHorizontalGroup( |
|---|
| 474 | jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 475 | .addComponent(LoopDetectorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE) |
|---|
| 476 | ); |
|---|
| 477 | jPanel5Layout.setVerticalGroup( |
|---|
| 478 | jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 479 | .addComponent(LoopDetectorScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) |
|---|
| 480 | ); |
|---|
| 481 | |
|---|
| 482 | javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); |
|---|
| 483 | jPanel6.setLayout(jPanel6Layout); |
|---|
| 484 | jPanel6Layout.setHorizontalGroup( |
|---|
| 485 | jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 486 | .addGroup(jPanel6Layout.createSequentialGroup() |
|---|
| 487 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 488 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 489 | .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 490 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 491 | .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) |
|---|
| 492 | ); |
|---|
| 493 | jPanel6Layout.setVerticalGroup( |
|---|
| 494 | jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 495 | .addGroup(jPanel6Layout.createSequentialGroup() |
|---|
| 496 | .addGap(6, 6, 6) |
|---|
| 497 | .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 498 | .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 499 | .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 500 | .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) |
|---|
| 501 | ); |
|---|
| 502 | |
|---|
| 503 | jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Current Selection")); |
|---|
| 504 | jPanel1.setLayout(new java.awt.GridLayout(1, 0)); |
|---|
| 505 | |
|---|
| 506 | jLabel1.setText("TimeFrame:"); |
|---|
| 507 | |
|---|
| 508 | CurrentTimeFrameLabel.setText("null"); |
|---|
| 509 | |
|---|
| 510 | CurrentHighwayLabel.setText("null"); |
|---|
| 511 | |
|---|
| 512 | jLabel2.setText("Highway:"); |
|---|
| 513 | |
|---|
| 514 | jLabel3.setText("Station:"); |
|---|
| 515 | |
|---|
| 516 | CurrentStationLabel.setText("null"); |
|---|
| 517 | |
|---|
| 518 | CurrentStationPostmileLabel.setText("null"); |
|---|
| 519 | |
|---|
| 520 | jLabel4.setText("Postmile:"); |
|---|
| 521 | |
|---|
| 522 | jLabel5.setText("Location:"); |
|---|
| 523 | |
|---|
| 524 | CurrentStationLocationLabel.setText("null"); |
|---|
| 525 | |
|---|
| 526 | CurrentLoopDetectorLabel.setText("null"); |
|---|
| 527 | |
|---|
| 528 | jLabel6.setText("Loop:"); |
|---|
| 529 | |
|---|
| 530 | jLabel7.setText("Type:"); |
|---|
| 531 | |
|---|
| 532 | CurrentLoopDetectorTypeLabel.setText("null"); |
|---|
| 533 | |
|---|
| 534 | CurrentLoopDetectorDescLabel.setText("null"); |
|---|
| 535 | |
|---|
| 536 | jLabel8.setText("Desc:"); |
|---|
| 537 | |
|---|
| 538 | javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); |
|---|
| 539 | jPanel9.setLayout(jPanel9Layout); |
|---|
| 540 | jPanel9Layout.setHorizontalGroup( |
|---|
| 541 | jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 542 | .addGroup(jPanel9Layout.createSequentialGroup() |
|---|
| 543 | .addContainerGap() |
|---|
| 544 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 545 | .addComponent(jLabel1) |
|---|
| 546 | .addComponent(jLabel2) |
|---|
| 547 | .addComponent(jLabel3) |
|---|
| 548 | .addComponent(jLabel6) |
|---|
| 549 | .addGroup(jPanel9Layout.createSequentialGroup() |
|---|
| 550 | .addGap(6, 6, 6) |
|---|
| 551 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 552 | .addComponent(jLabel5) |
|---|
| 553 | .addComponent(jLabel4) |
|---|
| 554 | .addComponent(jLabel7) |
|---|
| 555 | .addComponent(jLabel8)))) |
|---|
| 556 | .addGap(18, 18, 18) |
|---|
| 557 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 558 | .addComponent(CurrentLoopDetectorDescLabel) |
|---|
| 559 | .addComponent(CurrentLoopDetectorTypeLabel) |
|---|
| 560 | .addComponent(CurrentLoopDetectorLabel) |
|---|
| 561 | .addComponent(CurrentStationPostmileLabel) |
|---|
| 562 | .addComponent(CurrentStationLabel) |
|---|
| 563 | .addComponent(CurrentHighwayLabel) |
|---|
| 564 | .addComponent(CurrentTimeFrameLabel) |
|---|
| 565 | .addComponent(CurrentStationLocationLabel)) |
|---|
| 566 | .addContainerGap(239, Short.MAX_VALUE)) |
|---|
| 567 | ); |
|---|
| 568 | jPanel9Layout.setVerticalGroup( |
|---|
| 569 | jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 570 | .addGroup(jPanel9Layout.createSequentialGroup() |
|---|
| 571 | .addContainerGap() |
|---|
| 572 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 573 | .addComponent(jLabel1) |
|---|
| 574 | .addComponent(CurrentTimeFrameLabel)) |
|---|
| 575 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 576 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 577 | .addComponent(jLabel2) |
|---|
| 578 | .addComponent(CurrentHighwayLabel)) |
|---|
| 579 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 580 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 581 | .addComponent(jLabel3) |
|---|
| 582 | .addComponent(CurrentStationLabel)) |
|---|
| 583 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 584 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 585 | .addComponent(jLabel4) |
|---|
| 586 | .addComponent(CurrentStationPostmileLabel)) |
|---|
| 587 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 588 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 589 | .addComponent(jLabel5) |
|---|
| 590 | .addComponent(CurrentStationLocationLabel)) |
|---|
| 591 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 592 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 593 | .addComponent(jLabel6) |
|---|
| 594 | .addComponent(CurrentLoopDetectorLabel)) |
|---|
| 595 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 596 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 597 | .addComponent(jLabel7) |
|---|
| 598 | .addComponent(CurrentLoopDetectorTypeLabel)) |
|---|
| 599 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 600 | .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 601 | .addComponent(jLabel8) |
|---|
| 602 | .addComponent(CurrentLoopDetectorDescLabel)) |
|---|
| 603 | .addContainerGap(31, Short.MAX_VALUE)) |
|---|
| 604 | ); |
|---|
| 605 | |
|---|
| 606 | jPanel1.add(jPanel9); |
|---|
| 607 | |
|---|
| 608 | jPanel7.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); |
|---|
| 609 | |
|---|
| 610 | colorRadioButtons.add(GreenButton); |
|---|
| 611 | GreenButton.setText("Green"); |
|---|
| 612 | |
|---|
| 613 | colorRadioButtons.add(YellowButton); |
|---|
| 614 | YellowButton.setText("Yellow"); |
|---|
| 615 | |
|---|
| 616 | colorRadioButtons.add(RedButton); |
|---|
| 617 | RedButton.setText("Red"); |
|---|
| 618 | |
|---|
| 619 | AddNewEventButton.setText("Add New Event"); |
|---|
| 620 | AddNewEventButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 621 | { |
|---|
| 622 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 623 | { |
|---|
| 624 | AddLaneEventButtonActionPerformed(evt); |
|---|
| 625 | } |
|---|
| 626 | }); |
|---|
| 627 | |
|---|
| 628 | DeleteEventButton.setText("Delete Selected Event"); |
|---|
| 629 | DeleteEventButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 630 | { |
|---|
| 631 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 632 | { |
|---|
| 633 | DeleteEventButtonActonPerformed(evt); |
|---|
| 634 | } |
|---|
| 635 | }); |
|---|
| 636 | |
|---|
| 637 | javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); |
|---|
| 638 | jPanel7.setLayout(jPanel7Layout); |
|---|
| 639 | jPanel7Layout.setHorizontalGroup( |
|---|
| 640 | jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 641 | .addGroup(jPanel7Layout.createSequentialGroup() |
|---|
| 642 | .addContainerGap() |
|---|
| 643 | .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 644 | .addComponent(DeleteEventButton, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) |
|---|
| 645 | .addGroup(jPanel7Layout.createSequentialGroup() |
|---|
| 646 | .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 647 | .addComponent(RedButton) |
|---|
| 648 | .addComponent(YellowButton) |
|---|
| 649 | .addComponent(GreenButton)) |
|---|
| 650 | .addGap(0, 0, Short.MAX_VALUE)) |
|---|
| 651 | .addComponent(AddNewEventButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 652 | .addContainerGap()) |
|---|
| 653 | ); |
|---|
| 654 | jPanel7Layout.setVerticalGroup( |
|---|
| 655 | jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 656 | .addGroup(jPanel7Layout.createSequentialGroup() |
|---|
| 657 | .addContainerGap() |
|---|
| 658 | .addComponent(GreenButton) |
|---|
| 659 | .addGap(12, 12, 12) |
|---|
| 660 | .addComponent(YellowButton) |
|---|
| 661 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
|---|
| 662 | .addComponent(RedButton) |
|---|
| 663 | .addGap(18, 18, 18) |
|---|
| 664 | .addComponent(AddNewEventButton) |
|---|
| 665 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 666 | .addComponent(DeleteEventButton) |
|---|
| 667 | .addContainerGap(22, Short.MAX_VALUE)) |
|---|
| 668 | ); |
|---|
| 669 | |
|---|
| 670 | jPanel1.add(jPanel7); |
|---|
| 671 | |
|---|
| 672 | jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Preview Lane Events on ATMS")); |
|---|
| 673 | jPanel11.setLayout(new java.awt.BorderLayout()); |
|---|
| 674 | |
|---|
| 675 | jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Selected Time Frame Preview")); |
|---|
| 676 | |
|---|
| 677 | SinglePreviewStationButton.setText("Send Selected Station Events"); |
|---|
| 678 | SinglePreviewStationButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 679 | { |
|---|
| 680 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 681 | { |
|---|
| 682 | SinglePreviewStationButtonActionPerformed(evt); |
|---|
| 683 | } |
|---|
| 684 | }); |
|---|
| 685 | |
|---|
| 686 | SinglePreviewHighwaysButton.setText("Send All Events"); |
|---|
| 687 | SinglePreviewHighwaysButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 688 | { |
|---|
| 689 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 690 | { |
|---|
| 691 | SinglePreviewHighwaysButtonActionPerformed(evt); |
|---|
| 692 | } |
|---|
| 693 | }); |
|---|
| 694 | |
|---|
| 695 | javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); |
|---|
| 696 | jPanel12.setLayout(jPanel12Layout); |
|---|
| 697 | jPanel12Layout.setHorizontalGroup( |
|---|
| 698 | jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 699 | .addGroup(jPanel12Layout.createSequentialGroup() |
|---|
| 700 | .addContainerGap() |
|---|
| 701 | .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) |
|---|
| 702 | .addComponent(SinglePreviewHighwaysButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 703 | .addComponent(SinglePreviewStationButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 704 | .addContainerGap(10, Short.MAX_VALUE)) |
|---|
| 705 | ); |
|---|
| 706 | jPanel12Layout.setVerticalGroup( |
|---|
| 707 | jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 708 | .addGroup(jPanel12Layout.createSequentialGroup() |
|---|
| 709 | .addContainerGap() |
|---|
| 710 | .addComponent(SinglePreviewStationButton) |
|---|
| 711 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 712 | .addComponent(SinglePreviewHighwaysButton) |
|---|
| 713 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 714 | ); |
|---|
| 715 | |
|---|
| 716 | jPanel11.add(jPanel12, java.awt.BorderLayout.CENTER); |
|---|
| 717 | |
|---|
| 718 | jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Cumulative Preview")); |
|---|
| 719 | |
|---|
| 720 | CumulativePreviewStationButton.setText("Send Selected Station Events"); |
|---|
| 721 | CumulativePreviewStationButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 722 | { |
|---|
| 723 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 724 | { |
|---|
| 725 | CumulativeStationPreviewButtonActionPerformed(evt); |
|---|
| 726 | } |
|---|
| 727 | }); |
|---|
| 728 | |
|---|
| 729 | CumulativePreviewHighwaysButton.setText("Send All Events"); |
|---|
| 730 | CumulativePreviewHighwaysButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 731 | { |
|---|
| 732 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 733 | { |
|---|
| 734 | CumulativeHighwaysPreviewButtonActionPerformed(evt); |
|---|
| 735 | } |
|---|
| 736 | }); |
|---|
| 737 | |
|---|
| 738 | javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); |
|---|
| 739 | jPanel13.setLayout(jPanel13Layout); |
|---|
| 740 | jPanel13Layout.setHorizontalGroup( |
|---|
| 741 | jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 742 | .addGroup(jPanel13Layout.createSequentialGroup() |
|---|
| 743 | .addContainerGap() |
|---|
| 744 | .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) |
|---|
| 745 | .addComponent(CumulativePreviewHighwaysButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 746 | .addComponent(CumulativePreviewStationButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 747 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 748 | ); |
|---|
| 749 | jPanel13Layout.setVerticalGroup( |
|---|
| 750 | jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 751 | .addGroup(jPanel13Layout.createSequentialGroup() |
|---|
| 752 | .addContainerGap() |
|---|
| 753 | .addComponent(CumulativePreviewStationButton) |
|---|
| 754 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 755 | .addComponent(CumulativePreviewHighwaysButton) |
|---|
| 756 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 757 | ); |
|---|
| 758 | |
|---|
| 759 | jPanel11.add(jPanel13, java.awt.BorderLayout.PAGE_START); |
|---|
| 760 | |
|---|
| 761 | jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Time Frame")); |
|---|
| 762 | |
|---|
| 763 | TimeFrameList.setModel(new javax.swing.AbstractListModel() |
|---|
| 764 | { |
|---|
| 765 | String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; |
|---|
| 766 | public int getSize() { return strings.length; } |
|---|
| 767 | public Object getElementAt(int i) { return strings[i]; } |
|---|
| 768 | }); |
|---|
| 769 | TimeFrameScrollPane.setViewportView(TimeFrameList); |
|---|
| 770 | |
|---|
| 771 | jPanel10.setBorder(javax.swing.BorderFactory.createEtchedBorder()); |
|---|
| 772 | |
|---|
| 773 | AddNewTimeFrameButton.setText("New"); |
|---|
| 774 | AddNewTimeFrameButton.setActionCommand("addTimeFrame"); |
|---|
| 775 | AddNewTimeFrameButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 776 | { |
|---|
| 777 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 778 | { |
|---|
| 779 | addNewTimeFrameButtonClicked(evt); |
|---|
| 780 | } |
|---|
| 781 | }); |
|---|
| 782 | |
|---|
| 783 | DeleteTimeFrameButton.setText("Delete"); |
|---|
| 784 | DeleteTimeFrameButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 785 | { |
|---|
| 786 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 787 | { |
|---|
| 788 | DeleteTimeFrameButtonActionPerformed(evt); |
|---|
| 789 | } |
|---|
| 790 | }); |
|---|
| 791 | |
|---|
| 792 | javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); |
|---|
| 793 | jPanel10.setLayout(jPanel10Layout); |
|---|
| 794 | jPanel10Layout.setHorizontalGroup( |
|---|
| 795 | jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 796 | .addGroup(jPanel10Layout.createSequentialGroup() |
|---|
| 797 | .addContainerGap() |
|---|
| 798 | .addComponent(AddNewTimeFrameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 799 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE) |
|---|
| 800 | .addComponent(DeleteTimeFrameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 801 | .addContainerGap()) |
|---|
| 802 | ); |
|---|
| 803 | jPanel10Layout.setVerticalGroup( |
|---|
| 804 | jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 805 | .addGroup(jPanel10Layout.createSequentialGroup() |
|---|
| 806 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 807 | .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
|---|
| 808 | .addComponent(AddNewTimeFrameButton) |
|---|
| 809 | .addComponent(DeleteTimeFrameButton)) |
|---|
| 810 | .addContainerGap()) |
|---|
| 811 | ); |
|---|
| 812 | |
|---|
| 813 | javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); |
|---|
| 814 | jPanel3.setLayout(jPanel3Layout); |
|---|
| 815 | jPanel3Layout.setHorizontalGroup( |
|---|
| 816 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 817 | .addComponent(TimeFrameScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 818 | .addComponent(jPanel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 819 | ); |
|---|
| 820 | jPanel3Layout.setVerticalGroup( |
|---|
| 821 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 822 | .addGroup(jPanel3Layout.createSequentialGroup() |
|---|
| 823 | .addComponent(TimeFrameScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 824 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 825 | .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 826 | ); |
|---|
| 827 | |
|---|
| 828 | jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Traffic Lane Events")); |
|---|
| 829 | |
|---|
| 830 | TrafficLaneEventsTable.setModel(new javax.swing.table.DefaultTableModel( |
|---|
| 831 | new Object [][] |
|---|
| 832 | { |
|---|
| 833 | {null, null, null, null}, |
|---|
| 834 | {null, null, null, null}, |
|---|
| 835 | {null, null, null, null}, |
|---|
| 836 | {null, null, null, null} |
|---|
| 837 | }, |
|---|
| 838 | new String [] |
|---|
| 839 | { |
|---|
| 840 | "Title 1", "Title 2", "Title 3", "Title 4" |
|---|
| 841 | } |
|---|
| 842 | )); |
|---|
| 843 | jScrollPane1.setViewportView(TrafficLaneEventsTable); |
|---|
| 844 | |
|---|
| 845 | javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); |
|---|
| 846 | jPanel8.setLayout(jPanel8Layout); |
|---|
| 847 | jPanel8Layout.setHorizontalGroup( |
|---|
| 848 | jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 849 | .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING) |
|---|
| 850 | ); |
|---|
| 851 | jPanel8Layout.setVerticalGroup( |
|---|
| 852 | jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 853 | .addGroup(jPanel8Layout.createSequentialGroup() |
|---|
| 854 | .addContainerGap() |
|---|
| 855 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) |
|---|
| 856 | .addContainerGap()) |
|---|
| 857 | ); |
|---|
| 858 | |
|---|
| 859 | javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); |
|---|
| 860 | jPanel15.setLayout(jPanel15Layout); |
|---|
| 861 | jPanel15Layout.setHorizontalGroup( |
|---|
| 862 | jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 863 | .addGroup(jPanel15Layout.createSequentialGroup() |
|---|
| 864 | .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 865 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 866 | .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 867 | .addContainerGap()) |
|---|
| 868 | ); |
|---|
| 869 | jPanel15Layout.setVerticalGroup( |
|---|
| 870 | jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 871 | .addGroup(jPanel15Layout.createSequentialGroup() |
|---|
| 872 | .addContainerGap() |
|---|
| 873 | .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) |
|---|
| 874 | .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 875 | .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 876 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 877 | ); |
|---|
| 878 | |
|---|
| 879 | jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Export/Import Scripts")); |
|---|
| 880 | |
|---|
| 881 | jButton1.setText("Load Script"); |
|---|
| 882 | |
|---|
| 883 | jButton2.setText("Save Script"); |
|---|
| 884 | |
|---|
| 885 | jButton3.setText("Save Script As"); |
|---|
| 886 | |
|---|
| 887 | javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); |
|---|
| 888 | jPanel14.setLayout(jPanel14Layout); |
|---|
| 889 | jPanel14Layout.setHorizontalGroup( |
|---|
| 890 | jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 891 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup() |
|---|
| 892 | .addContainerGap(28, Short.MAX_VALUE) |
|---|
| 893 | .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) |
|---|
| 894 | .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 895 | .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 896 | .addComponent(jButton3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 897 | .addGap(27, 27, 27)) |
|---|
| 898 | ); |
|---|
| 899 | jPanel14Layout.setVerticalGroup( |
|---|
| 900 | jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 901 | .addGroup(jPanel14Layout.createSequentialGroup() |
|---|
| 902 | .addContainerGap() |
|---|
| 903 | .addComponent(jButton1) |
|---|
| 904 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 905 | .addComponent(jButton2) |
|---|
| 906 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 907 | .addComponent(jButton3) |
|---|
| 908 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 909 | ); |
|---|
| 910 | |
|---|
| 911 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); |
|---|
| 912 | getContentPane().setLayout(layout); |
|---|
| 913 | layout.setHorizontalGroup( |
|---|
| 914 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 915 | .addGroup(layout.createSequentialGroup() |
|---|
| 916 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 917 | .addGroup(layout.createSequentialGroup() |
|---|
| 918 | .addGap(12, 12, 12) |
|---|
| 919 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 920 | .addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 921 | .addGroup(layout.createSequentialGroup() |
|---|
| 922 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 730, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 923 | .addGap(18, 18, 18) |
|---|
| 924 | .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 925 | .addGap(18, 18, 18) |
|---|
| 926 | .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) |
|---|
| 927 | .addGroup(layout.createSequentialGroup() |
|---|
| 928 | .addContainerGap() |
|---|
| 929 | .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) |
|---|
| 930 | .addContainerGap()) |
|---|
| 931 | ); |
|---|
| 932 | layout.setVerticalGroup( |
|---|
| 933 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 934 | .addGroup(layout.createSequentialGroup() |
|---|
| 935 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 936 | .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
|---|
| 937 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 938 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|---|
| 939 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) |
|---|
| 940 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|---|
| 941 | .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 942 | .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
|---|
| 943 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|---|
| 944 | .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) |
|---|
| 945 | ); |
|---|
| 946 | |
|---|
| 947 | pack(); |
|---|
| 948 | }// </editor-fold>//GEN-END:initComponents |
|---|
| 949 | |
|---|
| 950 | private void AddLaneEventButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_AddLaneEventButtonActionPerformed |
|---|
| 951 | {//GEN-HEADEREND:event_AddLaneEventButtonActionPerformed |
|---|
| 952 | timeFrames.addEventToTimeFrame(getDotColorFromText( |
|---|
| 953 | getSelectedButtonText(colorRadioButtons))); |
|---|
| 954 | }//GEN-LAST:event_AddLaneEventButtonActionPerformed |
|---|
| 955 | |
|---|
| 956 | private void DeleteTimeFrameButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_DeleteTimeFrameButtonActionPerformed |
|---|
| 957 | {//GEN-HEADEREND:event_DeleteTimeFrameButtonActionPerformed |
|---|
| 958 | timeFrames.deleteTimeFrame(TimeFrameList.getSelectedIndex()); |
|---|
| 959 | }//GEN-LAST:event_DeleteTimeFrameButtonActionPerformed |
|---|
| 960 | |
|---|
| 961 | private String[] getTimeChoices() |
|---|
| 962 | { |
|---|
| 963 | String[] choices = new String[60]; |
|---|
| 964 | for(int i = 0; i < 60; i++) |
|---|
| 965 | { |
|---|
| 966 | choices[i] = String.format("%02d", i); |
|---|
| 967 | } |
|---|
| 968 | return choices; |
|---|
| 969 | } |
|---|
| 970 | |
|---|
| 971 | private void addNewTimeFrameButtonClicked(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addNewTimeFrameButtonClicked |
|---|
| 972 | {//GEN-HEADEREND:event_addNewTimeFrameButtonClicked |
|---|
| 973 | // String name = JOptionPane.showInputDialog(this, "Enter a time frame (HH:MM:SS)"); |
|---|
| 974 | String[] hourChoices = getTimeChoices(); |
|---|
| 975 | String[] minChoices = getTimeChoices(); |
|---|
| 976 | String[] secChoices = {"00", "30"}; |
|---|
| 977 | |
|---|
| 978 | JComboBox hourCombo = new JComboBox(hourChoices); |
|---|
| 979 | JComboBox minCombo = new JComboBox(minChoices); |
|---|
| 980 | JComboBox secCombo = new JComboBox(secChoices); |
|---|
| 981 | |
|---|
| 982 | Object[] message = { |
|---|
| 983 | "Hour:", hourCombo, |
|---|
| 984 | "Minute:", minCombo, |
|---|
| 985 | "Second:", secCombo |
|---|
| 986 | }; |
|---|
| 987 | int option = JOptionPane.showConfirmDialog(this, message, "Enter a time frame:", JOptionPane.OK_CANCEL_OPTION); |
|---|
| 988 | if(option == JOptionPane.OK_OPTION) |
|---|
| 989 | { |
|---|
| 990 | String h = hourCombo.getSelectedItem().toString(); |
|---|
| 991 | String m = minCombo.getSelectedItem().toString(); |
|---|
| 992 | String s = secCombo.getSelectedItem().toString(); |
|---|
| 993 | String cum = h + ":" + m + ":" + s; |
|---|
| 994 | timeFrames.addTimeFrame(cum); |
|---|
| 995 | } |
|---|
| 996 | /*if(name != null) |
|---|
| 997 | { |
|---|
| 998 | timeFrames.addTimeFrame(name); |
|---|
| 999 | }*/ |
|---|
| 1000 | }//GEN-LAST:event_addNewTimeFrameButtonClicked |
|---|
| 1001 | |
|---|
| 1002 | private void DeleteEventButtonActonPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_DeleteEventButtonActonPerformed |
|---|
| 1003 | {//GEN-HEADEREND:event_DeleteEventButtonActonPerformed |
|---|
| 1004 | timeFrames.deleteTrafficLaneEvent(TrafficLaneEventsTable |
|---|
| 1005 | .getSelectionModel().getMaxSelectionIndex()); |
|---|
| 1006 | }//GEN-LAST:event_DeleteEventButtonActonPerformed |
|---|
| 1007 | |
|---|
| 1008 | private void SinglePreviewStationButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_SinglePreviewStationButtonActionPerformed |
|---|
| 1009 | {//GEN-HEADEREND:event_SinglePreviewStationButtonActionPerformed |
|---|
| 1010 | timeFrames.singlePreviewStation(); |
|---|
| 1011 | }//GEN-LAST:event_SinglePreviewStationButtonActionPerformed |
|---|
| 1012 | |
|---|
| 1013 | private void SinglePreviewHighwaysButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_SinglePreviewHighwaysButtonActionPerformed |
|---|
| 1014 | {//GEN-HEADEREND:event_SinglePreviewHighwaysButtonActionPerformed |
|---|
| 1015 | timeFrames.singlePreviewHighways(); |
|---|
| 1016 | }//GEN-LAST:event_SinglePreviewHighwaysButtonActionPerformed |
|---|
| 1017 | |
|---|
| 1018 | private void CumulativeStationPreviewButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_CumulativeStationPreviewButtonActionPerformed |
|---|
| 1019 | {//GEN-HEADEREND:event_CumulativeStationPreviewButtonActionPerformed |
|---|
| 1020 | timeFrames.cumulativePreviewStation(); |
|---|
| 1021 | }//GEN-LAST:event_CumulativeStationPreviewButtonActionPerformed |
|---|
| 1022 | |
|---|
| 1023 | private void CumulativeHighwaysPreviewButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_CumulativeHighwaysPreviewButtonActionPerformed |
|---|
| 1024 | {//GEN-HEADEREND:event_CumulativeHighwaysPreviewButtonActionPerformed |
|---|
| 1025 | timeFrames.cumulativePreviewHighways(); |
|---|
| 1026 | }//GEN-LAST:event_CumulativeHighwaysPreviewButtonActionPerformed |
|---|
| 1027 | |
|---|
| 1028 | private DOTCOLOR getDotColorFromText(String text) |
|---|
| 1029 | { |
|---|
| 1030 | return DOTCOLOR.toDotColor(text); |
|---|
| 1031 | } |
|---|
| 1032 | |
|---|
| 1033 | private String getSelectedButtonText(ButtonGroup buttonGroup) |
|---|
| 1034 | { |
|---|
| 1035 | for(Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();) |
|---|
| 1036 | { |
|---|
| 1037 | AbstractButton button = buttons.nextElement(); |
|---|
| 1038 | if(button.isSelected()) |
|---|
| 1039 | { |
|---|
| 1040 | return button.getText(); |
|---|
| 1041 | } |
|---|
| 1042 | } |
|---|
| 1043 | return null; |
|---|
| 1044 | } |
|---|
| 1045 | |
|---|
| 1046 | /** |
|---|
| 1047 | * @param args the command line arguments |
|---|
| 1048 | */ |
|---|
| 1049 | public static void main(String args[]) |
|---|
| 1050 | { |
|---|
| 1051 | /* Set the Nimbus look and feel */ |
|---|
| 1052 | //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> |
|---|
| 1053 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. |
|---|
| 1054 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html |
|---|
| 1055 | */ |
|---|
| 1056 | try |
|---|
| 1057 | { |
|---|
| 1058 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) |
|---|
| 1059 | { |
|---|
| 1060 | if ("Nimbus".equals(info.getName())) |
|---|
| 1061 | { |
|---|
| 1062 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); |
|---|
| 1063 | break; |
|---|
| 1064 | } |
|---|
| 1065 | } |
|---|
| 1066 | } catch (ClassNotFoundException ex) |
|---|
| 1067 | { |
|---|
| 1068 | java.util.logging.Logger.getLogger(TrafficEventsEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); |
|---|
| 1069 | } catch (InstantiationException ex) |
|---|
| 1070 | { |
|---|
| 1071 | java.util.logging.Logger.getLogger(TrafficEventsEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); |
|---|
| 1072 | } catch (IllegalAccessException ex) |
|---|
| 1073 | { |
|---|
| 1074 | java.util.logging.Logger.getLogger(TrafficEventsEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); |
|---|
| 1075 | } catch (javax.swing.UnsupportedLookAndFeelException ex) |
|---|
| 1076 | { |
|---|
| 1077 | java.util.logging.Logger.getLogger(TrafficEventsEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); |
|---|
| 1078 | } |
|---|
| 1079 | //</editor-fold> |
|---|
| 1080 | //</editor-fold> |
|---|
| 1081 | //</editor-fold> |
|---|
| 1082 | //</editor-fold> |
|---|
| 1083 | |
|---|
| 1084 | TimeFrames timeFrames = new TimeFrames(); |
|---|
| 1085 | final TrafficEventsEditor gui = new TrafficEventsEditor(timeFrames); |
|---|
| 1086 | timeFrames.addObserver(gui); |
|---|
| 1087 | |
|---|
| 1088 | /* Create and display the form */ |
|---|
| 1089 | java.awt.EventQueue.invokeLater(new Runnable() |
|---|
| 1090 | { |
|---|
| 1091 | public void run() |
|---|
| 1092 | { |
|---|
| 1093 | gui.update(null, null); |
|---|
| 1094 | gui.setVisible(true); |
|---|
| 1095 | } |
|---|
| 1096 | }); |
|---|
| 1097 | } |
|---|
| 1098 | |
|---|
| 1099 | // Variables declaration - do not modify//GEN-BEGIN:variables |
|---|
| 1100 | private javax.swing.JButton AddNewEventButton; |
|---|
| 1101 | private javax.swing.JButton AddNewTimeFrameButton; |
|---|
| 1102 | private javax.swing.JButton CumulativePreviewHighwaysButton; |
|---|
| 1103 | private javax.swing.JButton CumulativePreviewStationButton; |
|---|
| 1104 | private javax.swing.JLabel CurrentHighwayLabel; |
|---|
| 1105 | private javax.swing.JLabel CurrentLoopDetectorDescLabel; |
|---|
| 1106 | private javax.swing.JLabel CurrentLoopDetectorLabel; |
|---|
| 1107 | private javax.swing.JLabel CurrentLoopDetectorTypeLabel; |
|---|
| 1108 | private javax.swing.JLabel CurrentStationLabel; |
|---|
| 1109 | private javax.swing.JLabel CurrentStationLocationLabel; |
|---|
| 1110 | private javax.swing.JLabel CurrentStationPostmileLabel; |
|---|
| 1111 | private javax.swing.JLabel CurrentTimeFrameLabel; |
|---|
| 1112 | private javax.swing.JButton DeleteEventButton; |
|---|
| 1113 | private javax.swing.JButton DeleteTimeFrameButton; |
|---|
| 1114 | private javax.swing.JRadioButton GreenButton; |
|---|
| 1115 | private javax.swing.JList HighwayList; |
|---|
| 1116 | private javax.swing.JScrollPane HighwayScrollPane; |
|---|
| 1117 | private javax.swing.JScrollPane LoopDetectorScrollPane; |
|---|
| 1118 | private javax.swing.JTable LoopDetectorTable; |
|---|
| 1119 | private javax.swing.JRadioButton RedButton; |
|---|
| 1120 | private javax.swing.JButton SinglePreviewHighwaysButton; |
|---|
| 1121 | private javax.swing.JButton SinglePreviewStationButton; |
|---|
| 1122 | private javax.swing.JScrollPane StationScrollPane; |
|---|
| 1123 | private javax.swing.JTable StationTable; |
|---|
| 1124 | private javax.swing.JList TimeFrameList; |
|---|
| 1125 | private javax.swing.JScrollPane TimeFrameScrollPane; |
|---|
| 1126 | private javax.swing.JTable TrafficLaneEventsTable; |
|---|
| 1127 | private javax.swing.JRadioButton YellowButton; |
|---|
| 1128 | private javax.swing.ButtonGroup colorRadioButtons; |
|---|
| 1129 | private javax.swing.JButton jButton1; |
|---|
| 1130 | private javax.swing.JButton jButton2; |
|---|
| 1131 | private javax.swing.JButton jButton3; |
|---|
| 1132 | private javax.swing.JLabel jLabel1; |
|---|
| 1133 | private javax.swing.JLabel jLabel2; |
|---|
| 1134 | private javax.swing.JLabel jLabel3; |
|---|
| 1135 | private javax.swing.JLabel jLabel4; |
|---|
| 1136 | private javax.swing.JLabel jLabel5; |
|---|
| 1137 | private javax.swing.JLabel jLabel6; |
|---|
| 1138 | private javax.swing.JLabel jLabel7; |
|---|
| 1139 | private javax.swing.JLabel jLabel8; |
|---|
| 1140 | private javax.swing.JPanel jPanel1; |
|---|
| 1141 | private javax.swing.JPanel jPanel10; |
|---|
| 1142 | private javax.swing.JPanel jPanel11; |
|---|
| 1143 | private javax.swing.JPanel jPanel12; |
|---|
| 1144 | private javax.swing.JPanel jPanel13; |
|---|
| 1145 | private javax.swing.JPanel jPanel14; |
|---|
| 1146 | private javax.swing.JPanel jPanel15; |
|---|
| 1147 | private javax.swing.JPanel jPanel2; |
|---|
| 1148 | private javax.swing.JPanel jPanel3; |
|---|
| 1149 | private javax.swing.JPanel jPanel4; |
|---|
| 1150 | private javax.swing.JPanel jPanel5; |
|---|
| 1151 | private javax.swing.JPanel jPanel6; |
|---|
| 1152 | private javax.swing.JPanel jPanel7; |
|---|
| 1153 | private javax.swing.JPanel jPanel8; |
|---|
| 1154 | private javax.swing.JPanel jPanel9; |
|---|
| 1155 | private javax.swing.JScrollPane jScrollPane1; |
|---|
| 1156 | // End of variables declaration//GEN-END:variables |
|---|
| 1157 | |
|---|
| 1158 | private void updateStatusLabels() |
|---|
| 1159 | { |
|---|
| 1160 | CurrentTimeFrameLabel.setText(timeFrames.currentTimeFrame != null |
|---|
| 1161 | ? timeFrames.currentTimeFrame.toString() |
|---|
| 1162 | : ""); |
|---|
| 1163 | |
|---|
| 1164 | CurrentStationLabel.setText(timeFrames.currentStation != null |
|---|
| 1165 | ? timeFrames.currentStation.toString() |
|---|
| 1166 | : ""); |
|---|
| 1167 | |
|---|
| 1168 | CurrentHighwayLabel.setText(timeFrames.currentHighway != null |
|---|
| 1169 | ? timeFrames.currentHighway.toString() |
|---|
| 1170 | : ""); |
|---|
| 1171 | CurrentStationPostmileLabel.setText(timeFrames.currentStation != null |
|---|
| 1172 | ? Double.toString(timeFrames.currentStation.postmile) |
|---|
| 1173 | : ""); |
|---|
| 1174 | CurrentStationLocationLabel.setText(timeFrames.currentStation != null |
|---|
| 1175 | ? timeFrames.currentStation.location |
|---|
| 1176 | : ""); |
|---|
| 1177 | |
|---|
| 1178 | CurrentLoopDetectorLabel.setText(timeFrames.currentLoopDetector != null |
|---|
| 1179 | ? Integer.toString(timeFrames.currentLoopDetector.loopID) |
|---|
| 1180 | : ""); |
|---|
| 1181 | CurrentLoopDetectorTypeLabel.setText(timeFrames.currentLoopDetector != null |
|---|
| 1182 | ? timeFrames.currentLoopDetector.loopLocationID |
|---|
| 1183 | : ""); |
|---|
| 1184 | CurrentLoopDetectorDescLabel.setText(timeFrames.currentLoopDetector != null |
|---|
| 1185 | ? timeFrames.currentLoopDetector.loopLocation |
|---|
| 1186 | : ""); |
|---|
| 1187 | } |
|---|
| 1188 | |
|---|
| 1189 | private void updateButtonEnabled() |
|---|
| 1190 | { |
|---|
| 1191 | // add event button |
|---|
| 1192 | this.AddNewEventButton.setEnabled( |
|---|
| 1193 | timeFrames.currentTimeFrame != null |
|---|
| 1194 | && timeFrames.currentHighway != null |
|---|
| 1195 | && timeFrames.currentStation != null |
|---|
| 1196 | && timeFrames.currentLoopDetector != null |
|---|
| 1197 | ); |
|---|
| 1198 | |
|---|
| 1199 | // delete event button |
|---|
| 1200 | DeleteEventButton.setEnabled( |
|---|
| 1201 | !TrafficLaneEventsTable.getSelectionModel().isSelectionEmpty()); |
|---|
| 1202 | |
|---|
| 1203 | // delete time frame button |
|---|
| 1204 | DeleteTimeFrameButton.setEnabled(!TimeFrameList.isSelectionEmpty()); |
|---|
| 1205 | |
|---|
| 1206 | // single preview buttons |
|---|
| 1207 | SinglePreviewStationButton.setEnabled( |
|---|
| 1208 | timeFrames.currentStation != null |
|---|
| 1209 | && timeFrames.currentTimeFrame != null |
|---|
| 1210 | ); |
|---|
| 1211 | |
|---|
| 1212 | SinglePreviewHighwaysButton.setEnabled( |
|---|
| 1213 | timeFrames.currentTimeFrame != null |
|---|
| 1214 | ); |
|---|
| 1215 | |
|---|
| 1216 | // cumulative preview buttons |
|---|
| 1217 | CumulativePreviewHighwaysButton.setEnabled( |
|---|
| 1218 | timeFrames.currentTimeFrame != null |
|---|
| 1219 | ); |
|---|
| 1220 | |
|---|
| 1221 | CumulativePreviewStationButton.setEnabled( |
|---|
| 1222 | timeFrames.currentTimeFrame != null |
|---|
| 1223 | && timeFrames.currentStation != null |
|---|
| 1224 | ); |
|---|
| 1225 | } |
|---|
| 1226 | |
|---|
| 1227 | @Override |
|---|
| 1228 | public void update(Observable o, Object arg) |
|---|
| 1229 | { |
|---|
| 1230 | String updateArg = (String) arg; |
|---|
| 1231 | updateStatusLabels(); |
|---|
| 1232 | if(updateArg != null) |
|---|
| 1233 | { |
|---|
| 1234 | if(updateArg.equals("add frame") || updateArg.equals("delete frame")) |
|---|
| 1235 | { |
|---|
| 1236 | TimeFrameList.setModel(new TimeFrameListModel()); |
|---|
| 1237 | TimeFrameList.setSelectedIndex( |
|---|
| 1238 | timeFrames.getCurrentTimeFrameIndex()); |
|---|
| 1239 | TrafficLaneEventsTable.setModel(new TrafficLaneEventsTableModel()); |
|---|
| 1240 | } |
|---|
| 1241 | else if(updateArg.equals("select hwy")) |
|---|
| 1242 | { |
|---|
| 1243 | StationTable.setModel(new StationTableModel()); |
|---|
| 1244 | LoopDetectorTable.setModel(new LoopDetectorTableModel()); |
|---|
| 1245 | } |
|---|
| 1246 | else if(updateArg.equals("select station")) |
|---|
| 1247 | { |
|---|
| 1248 | LoopDetectorTable.setModel(new LoopDetectorTableModel()); |
|---|
| 1249 | } |
|---|
| 1250 | else if(updateArg.equals("select frame")) |
|---|
| 1251 | { |
|---|
| 1252 | TrafficLaneEventsTable.setModel( |
|---|
| 1253 | new TrafficLaneEventsTableModel()); |
|---|
| 1254 | } |
|---|
| 1255 | else if(updateArg.equals("add event") |
|---|
| 1256 | || updateArg.equals("delete event")) |
|---|
| 1257 | { |
|---|
| 1258 | TrafficLaneEventsTable.setModel( |
|---|
| 1259 | new TrafficLaneEventsTableModel()); |
|---|
| 1260 | TrafficLaneEventsTable.getSelectionModel() |
|---|
| 1261 | .setSelectionInterval( |
|---|
| 1262 | timeFrames.getCurrentTrafficEventIndex(), |
|---|
| 1263 | timeFrames.getCurrentTrafficEventIndex()); |
|---|
| 1264 | } |
|---|
| 1265 | } |
|---|
| 1266 | updateButtonEnabled(); |
|---|
| 1267 | } |
|---|
| 1268 | } |
|---|