source: tmcsimulator/trunk/src/tmcsim/client/cadclientgui/screens/LicensePlateInformation.java @ 3

Revision 3, 9.2 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files - cadclientgui

Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package tmcsim.client.cadclientgui.screens;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.ActionListener;
9
10import tmcsim.client.cadclientgui.data.CADData;
11
12/**
13 * CURRENTLY NOT IN USE.
14 * @author Stuart
15 */
16public class LicensePlateInformation extends javax.swing.JDialog {
17
18    private CADData cadData;
19   
20    int incidentId;
21   
22    /**
23     * Creates new form licensePlateInformation
24     */
25    public LicensePlateInformation(java.awt.Frame parent, boolean modal, int incidentId,CADData cadData) {
26        super(parent, modal);
27        this.cadData = cadData;
28        this.incidentId = incidentId;
29        initComponents();
30    }
31
32    /**
33     * This method is called from within the constructor to initialize the form.
34     * WARNING: Do NOT modify this code. The content of this method is always
35     * regenerated by the Form Editor.
36     */
37    @SuppressWarnings("unchecked")
38    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
39    private void initComponents() {
40
41        plateNumberLabel = new javax.swing.JLabel();
42        plateNumberField = new javax.swing.JTextField(5);
43        stateLabel = new javax.swing.JLabel();
44        stateField = new javax.swing.JTextField(5);
45        yearField = new javax.swing.JTextField();
46        yearLabel = new javax.swing.JLabel();
47        typeLabel = new javax.swing.JLabel();
48        typeCombo = new javax.swing.JComboBox();
49        okButton = new javax.swing.JButton();
50        nextButton = new javax.swing.JButton();
51        cancelButton = new javax.swing.JButton();
52       
53        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
54
55        plateNumberLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
56        plateNumberLabel.setText("Plate Number:");
57
58        stateLabel.setText("State:");
59
60        yearLabel.setText("Year:");
61
62        typeLabel.setText("Type:");
63
64        typeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
65
66        okButton.setText("OK");
67        okButton.addActionListener(new ActionListener(){
68            public void actionPerformed(ActionEvent arg0) {
69                cadData.getIncident(incidentId).getIncidentVehicle().addVehicleInformation(plateNumberField.getText(),
70                                stateField.getText(),
71                                (String)(typeCombo.getSelectedItem()),
72                                yearField.getText()
73                        );
74                //ScreenManager.refreshIncidentViewerLicenseTable(incidentId);
75                dispose();
76            }
77        });
78
79
80        nextButton.setText("Next");
81        nextButton.addActionListener(new ActionListener(){
82            public void actionPerformed(ActionEvent arg0) {
83                cadData.getIncident(incidentId).getIncidentVehicle().addVehicleInformation(plateNumberField.getText(),
84                                stateField.getText(),
85                                (String)(typeCombo.getSelectedItem()),
86                                yearField.getText()
87                        );
88                //ScreenManager.refreshIncidentViewerLicenseTable(incidentId);
89                refreshInformation(incidentId);
90            }
91        });
92
93        cancelButton.setText("Cancel");
94        cancelButton.addActionListener(new ActionListener(){
95            public void actionPerformed(ActionEvent arg0) {
96                dispose();
97            }
98        });
99        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
100        getContentPane().setLayout(layout);
101        layout.setHorizontalGroup(
102            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
103            .addGroup(layout.createSequentialGroup()
104                .addContainerGap()
105                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
106                    .addGroup(layout.createSequentialGroup()
107                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
108                            .addComponent(stateLabel)
109                            .addComponent(plateNumberLabel))
110                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
111                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
112                            .addGroup(layout.createSequentialGroup()
113                                .addComponent(stateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
114                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
115                                .addComponent(typeLabel))
116                            .addGroup(layout.createSequentialGroup()
117                                .addComponent(plateNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
118                                .addGap(18, 18, 18)
119                                .addComponent(yearLabel)))
120                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
121                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122                            .addComponent(typeCombo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
123                            .addGroup(layout.createSequentialGroup()
124                                .addComponent(yearField, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
125                                .addGap(0, 0, Short.MAX_VALUE))))
126                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
127                        .addGap(0, 0, Short.MAX_VALUE)
128                        .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
129                        .addGap(0, 0, 0)
130                        .addComponent(nextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
131                        .addGap(0, 0, 0)
132                        .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
133                .addContainerGap())
134        );
135        layout.setVerticalGroup(
136            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
138                .addContainerGap()
139                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
140                    .addComponent(plateNumberLabel)
141                    .addComponent(plateNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
142                    .addComponent(yearLabel)
143                    .addComponent(yearField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
144                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
145                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
146                    .addComponent(stateLabel)
147                    .addComponent(stateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
148                    .addComponent(typeLabel)
149                    .addComponent(typeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
150                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
151                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
152                    .addComponent(cancelButton)
153                    .addComponent(nextButton)
154                    .addComponent(okButton))
155                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
156        );
157
158        pack();
159        setVisible(true);
160    }// </editor-fold>//GEN-END:initComponents
161
162    public void refreshInformation(int incidentId){
163        this.incidentId = incidentId;
164        plateNumberField.setText("");
165        stateField.setText("");
166        yearField.setText("");
167    }
168   
169    public void open(int incidentId){
170        refreshInformation(incidentId);
171        setVisible(true);
172    }
173   
174    public void close(){
175        setVisible(false);
176    }
177   
178    // Variables declaration - do not modify//GEN-BEGIN:variables
179    private javax.swing.JButton cancelButton;
180    private javax.swing.JButton nextButton;
181    private javax.swing.JButton okButton;
182    private javax.swing.JTextField plateNumberField;
183    private javax.swing.JLabel plateNumberLabel;
184    private javax.swing.JTextField stateField;
185    private javax.swing.JLabel stateLabel;
186    private javax.swing.JComboBox typeCombo;
187    private javax.swing.JLabel typeLabel;
188    private javax.swing.JTextField yearField;
189    private javax.swing.JLabel yearLabel;
190    // End of variables declaration//GEN-END:variables
191}
Note: See TracBrowser for help on using the repository browser.