1 | |
package br.mia.test.view.observers; |
2 | |
|
3 | |
import java.awt.event.ActionEvent; |
4 | |
import java.awt.event.ActionListener; |
5 | |
import java.awt.event.MouseListener; |
6 | |
import java.util.ArrayList; |
7 | |
import java.util.HashMap; |
8 | |
import java.util.List; |
9 | |
|
10 | |
import javax.swing.JCheckBox; |
11 | |
import javax.swing.JComboBox; |
12 | |
import javax.swing.JFrame; |
13 | |
import javax.swing.JInternalFrame; |
14 | |
import javax.swing.JLabel; |
15 | |
import javax.swing.JProgressBar; |
16 | |
import javax.swing.JRadioButton; |
17 | |
import javax.swing.JTable; |
18 | |
import javax.swing.JTextArea; |
19 | |
import javax.swing.JTextField; |
20 | |
import javax.swing.table.AbstractTableModel; |
21 | |
|
22 | |
import org.jgraph.JGraph; |
23 | |
import org.w3c.dom.events.EventTarget; |
24 | |
import org.w3c.dom.events.MouseEvent; |
25 | |
import org.w3c.dom.views.AbstractView; |
26 | |
|
27 | |
import com.toedter.calendar.JDateChooser; |
28 | |
|
29 | |
public class Observer implements ActionListener, MouseEvent, MouseListener { |
30 | |
|
31 | |
private ArrayList<JTextArea> textAreas; |
32 | |
|
33 | |
private ArrayList<Object> objetos; |
34 | |
|
35 | |
private ArrayList<JDateChooser> comboCalendarios; |
36 | |
|
37 | |
private ArrayList<JTextField> textFields; |
38 | |
|
39 | |
private ArrayList<JDateChooser> calendarios; |
40 | |
|
41 | |
private ArrayList<AbstractTableModel> modelos; |
42 | |
|
43 | |
private ArrayList<Observer> observer; |
44 | |
|
45 | |
private ArrayList<JGraph> graph; |
46 | |
|
47 | |
private ArrayList<JCheckBox> jcheckBox; |
48 | |
|
49 | |
private ArrayList<JLabel> labels; |
50 | |
|
51 | |
private ArrayList<JProgressBar> jprogressbar; |
52 | |
|
53 | |
private ArrayList<JComboBox> combos; |
54 | |
|
55 | |
private ArrayList<JFrame> frames; |
56 | |
|
57 | |
private ArrayList<JInternalFrame> internalFrames; |
58 | |
|
59 | |
private ArrayList<HashMap<Object,Object>> mapas; |
60 | |
|
61 | |
@SuppressWarnings("unchecked") |
62 | |
private ArrayList<List> arrayList; |
63 | |
|
64 | |
@SuppressWarnings("unchecked") |
65 | 0 | public ArrayList<List> getArrayList() { |
66 | 0 | return arrayList; |
67 | |
} |
68 | |
|
69 | |
@SuppressWarnings("unchecked") |
70 | 0 | public void setArrayList(ArrayList<List> arrayList) { |
71 | 0 | this.arrayList = arrayList; |
72 | 0 | } |
73 | |
|
74 | 0 | public ArrayList<JFrame> getFrames() { |
75 | 0 | return frames; |
76 | |
} |
77 | |
|
78 | 0 | public void setFrames(ArrayList<JFrame> frames) { |
79 | 0 | this.frames = frames; |
80 | 0 | } |
81 | |
|
82 | 0 | public ArrayList<Observer> getObserver() { |
83 | 0 | return observer; |
84 | |
} |
85 | |
|
86 | 0 | public void setObserver(ArrayList<Observer> observer) { |
87 | 0 | this.observer = observer; |
88 | 0 | } |
89 | |
|
90 | 0 | public ArrayList<AbstractTableModel> getModelos() { |
91 | 0 | return modelos; |
92 | |
} |
93 | |
|
94 | 0 | public void setModelos(ArrayList<AbstractTableModel> modelos) { |
95 | 0 | this.modelos = modelos; |
96 | 0 | } |
97 | |
|
98 | 0 | public ArrayList<JProgressBar> getJprogressbar() { |
99 | 0 | return jprogressbar; |
100 | |
} |
101 | |
|
102 | 0 | public void setJprogressbar(ArrayList<JProgressBar> jprogressbar) { |
103 | 0 | this.jprogressbar = jprogressbar; |
104 | 0 | } |
105 | |
|
106 | 0 | public ArrayList<JLabel> getLabels() { |
107 | 0 | return labels; |
108 | |
} |
109 | |
|
110 | 0 | public void setLabels(ArrayList<JLabel> labels) { |
111 | 0 | this.labels = labels; |
112 | 0 | } |
113 | |
|
114 | 0 | @SuppressWarnings("unchecked") |
115 | 0 | public Observer() { |
116 | 0 | this.tables = new ArrayList<JTable>(); |
117 | 0 | this.textFields = new ArrayList<JTextField>(); |
118 | 0 | this.radioButtons = new ArrayList<JRadioButton>(); |
119 | 0 | this.jcheckBox = new ArrayList<JCheckBox>(); |
120 | 0 | this.combos = new ArrayList<JComboBox>(); |
121 | 0 | this.jprogressbar = new ArrayList<JProgressBar>(); |
122 | 0 | this.labels = new ArrayList<JLabel>(); |
123 | 0 | this.calendarios = new ArrayList<JDateChooser>(); |
124 | 0 | this.modelos = new ArrayList<AbstractTableModel>(); |
125 | 0 | this.observer = new ArrayList<Observer>(); |
126 | 0 | this.frames = new ArrayList<JFrame>(); |
127 | 0 | this.arrayList = new ArrayList(); |
128 | 0 | this.textAreas = new ArrayList<JTextArea>(); |
129 | 0 | this.internalFrames = new ArrayList<JInternalFrame>(); |
130 | 0 | this.graph = new ArrayList<JGraph>(); |
131 | 0 | this.comboCalendarios = new ArrayList<JDateChooser>(); |
132 | 0 | this.objetos = new ArrayList<Object>(); |
133 | 0 | this.mapas = new ArrayList<HashMap<Object,Object>>(); |
134 | 0 | } |
135 | |
|
136 | 0 | public ArrayList<HashMap<Object,Object>> getMapas() { |
137 | 0 | return mapas; |
138 | |
} |
139 | |
|
140 | 0 | public void setMapas(ArrayList<HashMap<Object,Object>> mapas) { |
141 | 0 | this.mapas = mapas; |
142 | 0 | } |
143 | |
|
144 | 0 | public void atualiza() { |
145 | 0 | for (Object objeto : this.getTables()) { |
146 | 0 | JTable tabela = (JTable) objeto; |
147 | 0 | tabela.setVisible(false); |
148 | 0 | tabela.revalidate(); |
149 | 0 | |
150 | 0 | tabela.setVisible(true); |
151 | 0 | tabela.repaint(); |
152 | |
|
153 | |
} |
154 | 0 | |
155 | 0 | for (Object objeto : this.getCombos()) { |
156 | 0 | JComboBox combo = (JComboBox) objeto; |
157 | 0 | combo.setVisible(false); |
158 | 0 | combo.revalidate(); |
159 | 0 | |
160 | 0 | combo.setVisible(true); |
161 | 0 | combo.repaint(); |
162 | |
|
163 | 0 | } |
164 | 0 | } |
165 | |
|
166 | |
private ArrayList<JTable> tables; |
167 | |
|
168 | |
private ArrayList<JRadioButton> radioButtons; |
169 | |
|
170 | 0 | public ArrayList<JTextField> getTextFields() { |
171 | 0 | return textFields; |
172 | |
} |
173 | |
|
174 | 0 | public void setTextFields(ArrayList<JTextField> textFields) { |
175 | 0 | this.textFields = textFields; |
176 | 0 | } |
177 | |
|
178 | |
|
179 | 0 | public ArrayList<JTable> getTables() { |
180 | 0 | return tables; |
181 | |
} |
182 | |
|
183 | 0 | public void setTables(ArrayList<JTable> tables) { |
184 | 0 | this.tables = tables; |
185 | 0 | } |
186 | |
|
187 | 0 | public ArrayList<JRadioButton> getRadioButtons() { |
188 | 0 | return radioButtons; |
189 | |
} |
190 | |
|
191 | 0 | public void setRadioButtons(ArrayList<JRadioButton> radioButtons) { |
192 | 0 | this.radioButtons = radioButtons; |
193 | 0 | } |
194 | |
|
195 | 0 | public ArrayList<JCheckBox> getJcheckBox() { |
196 | 0 | return jcheckBox; |
197 | |
} |
198 | |
|
199 | 0 | public void setJcheckBox(ArrayList<JCheckBox> jcheckBox) { |
200 | 0 | this.jcheckBox = jcheckBox; |
201 | 0 | } |
202 | |
|
203 | 0 | public ArrayList<JComboBox> getCombos() { |
204 | 0 | return combos; |
205 | |
} |
206 | |
|
207 | 0 | public void setCombos(ArrayList<JComboBox> combos) { |
208 | 0 | this.combos = combos; |
209 | 0 | } |
210 | |
|
211 | 0 | public ArrayList<JDateChooser> getCalendarios() { |
212 | 0 | return calendarios; |
213 | |
} |
214 | |
|
215 | 0 | public void setCalendarios(ArrayList<JDateChooser> calendarios) { |
216 | 0 | this.calendarios = calendarios; |
217 | 0 | } |
218 | |
|
219 | |
public void actionPerformed(ActionEvent arg0) { |
220 | |
|
221 | 0 | |
222 | 0 | } |
223 | |
|
224 | |
public int getScreenX() { |
225 | 0 | |
226 | 0 | return 0; |
227 | |
} |
228 | |
|
229 | |
public int getScreenY() { |
230 | 0 | |
231 | 0 | return 0; |
232 | |
} |
233 | |
|
234 | |
public int getClientX() { |
235 | 0 | |
236 | 0 | return 0; |
237 | |
} |
238 | |
|
239 | |
public int getClientY() { |
240 | 0 | |
241 | 0 | return 0; |
242 | |
} |
243 | |
|
244 | |
public boolean getCtrlKey() { |
245 | 0 | |
246 | 0 | return false; |
247 | |
} |
248 | |
|
249 | |
public boolean getShiftKey() { |
250 | 0 | |
251 | 0 | return false; |
252 | |
} |
253 | |
|
254 | |
public boolean getAltKey() { |
255 | 0 | |
256 | 0 | return false; |
257 | |
} |
258 | |
|
259 | |
public boolean getMetaKey() { |
260 | 0 | |
261 | 0 | return false; |
262 | |
} |
263 | |
|
264 | |
public short getButton() { |
265 | 0 | |
266 | 0 | return 0; |
267 | |
} |
268 | |
|
269 | |
public EventTarget getRelatedTarget() { |
270 | 0 | |
271 | 0 | return null; |
272 | |
} |
273 | |
|
274 | |
public void initMouseEvent(String arg0, boolean arg1, boolean arg2, |
275 | |
AbstractView arg3, int arg4, int arg5, int arg6, int arg7, |
276 | |
int arg8, boolean arg9, boolean arg10, boolean arg11, |
277 | |
boolean arg12, short arg13, EventTarget arg14) { |
278 | |
|
279 | 0 | |
280 | 0 | } |
281 | |
|
282 | |
public AbstractView getView() { |
283 | 0 | |
284 | 0 | return null; |
285 | |
} |
286 | |
|
287 | |
public int getDetail() { |
288 | 0 | |
289 | 0 | return 0; |
290 | |
} |
291 | |
|
292 | |
public void initUIEvent(String arg0, boolean arg1, boolean arg2, |
293 | |
AbstractView arg3, int arg4) { |
294 | |
|
295 | 0 | |
296 | 0 | } |
297 | |
|
298 | |
public String getType() { |
299 | 0 | |
300 | 0 | return null; |
301 | |
} |
302 | |
|
303 | |
public EventTarget getTarget() { |
304 | 0 | |
305 | 0 | return null; |
306 | |
} |
307 | |
|
308 | |
public EventTarget getCurrentTarget() { |
309 | 0 | |
310 | 0 | return null; |
311 | |
} |
312 | |
|
313 | |
public short getEventPhase() { |
314 | 0 | |
315 | 0 | return 0; |
316 | |
} |
317 | |
|
318 | |
public boolean getBubbles() { |
319 | 0 | |
320 | 0 | return false; |
321 | |
} |
322 | |
|
323 | |
public boolean getCancelable() { |
324 | 0 | |
325 | 0 | return false; |
326 | |
} |
327 | |
|
328 | |
public long getTimeStamp() { |
329 | 0 | |
330 | 0 | return 0; |
331 | |
} |
332 | |
|
333 | |
public void stopPropagation() { |
334 | |
|
335 | 0 | |
336 | 0 | } |
337 | |
|
338 | |
public void preventDefault() { |
339 | |
|
340 | 0 | |
341 | 0 | } |
342 | |
|
343 | |
public void initEvent(String arg0, boolean arg1, boolean arg2) { |
344 | |
|
345 | 0 | |
346 | 0 | } |
347 | |
|
348 | |
public void mouseClicked(java.awt.event.MouseEvent arg0) { |
349 | |
|
350 | 0 | |
351 | 0 | } |
352 | |
|
353 | |
public void mousePressed(java.awt.event.MouseEvent arg0) { |
354 | |
|
355 | 0 | |
356 | 0 | } |
357 | |
|
358 | |
public void mouseReleased(java.awt.event.MouseEvent arg0) { |
359 | |
|
360 | 0 | |
361 | 0 | } |
362 | |
|
363 | |
public void mouseEntered(java.awt.event.MouseEvent arg0) { |
364 | |
|
365 | 0 | |
366 | 0 | } |
367 | |
|
368 | |
public void mouseExited(java.awt.event.MouseEvent arg0) { |
369 | |
|
370 | 0 | |
371 | 0 | } |
372 | |
|
373 | 0 | public ArrayList<JTextArea> getTextAreas() { |
374 | 0 | return textAreas; |
375 | |
} |
376 | |
|
377 | 0 | public void setTextAreas(ArrayList<JTextArea> textAreas) { |
378 | 0 | this.textAreas = textAreas; |
379 | 0 | } |
380 | |
|
381 | 0 | public ArrayList<JInternalFrame> getInternalFrames() { |
382 | 0 | return internalFrames; |
383 | |
} |
384 | |
|
385 | 0 | public void setInternalFrames(ArrayList<JInternalFrame> internalFrames) { |
386 | 0 | this.internalFrames = internalFrames; |
387 | 0 | } |
388 | |
|
389 | 0 | public ArrayList<JGraph> getGraph() { |
390 | 0 | return graph; |
391 | |
} |
392 | |
|
393 | 0 | public void setGraph(ArrayList<JGraph> graph) { |
394 | 0 | this.graph = graph; |
395 | 0 | } |
396 | |
|
397 | 0 | public ArrayList<JDateChooser> getComboCalendarios() { |
398 | 0 | return comboCalendarios; |
399 | |
} |
400 | |
|
401 | 0 | public void setComboCalendarios(ArrayList<JDateChooser> comboCalendarios) { |
402 | 0 | this.comboCalendarios = comboCalendarios; |
403 | 0 | } |
404 | |
|
405 | 0 | public ArrayList<Object> getObjetos() { |
406 | 0 | return objetos; |
407 | |
} |
408 | |
|
409 | 0 | public void setObjetos(ArrayList<Object> objetos) { |
410 | 0 | this.objetos = objetos; |
411 | 0 | } |
412 | |
|
413 | |
} |