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