1 | package org.greenstone.gatherer.feedback;
|
---|
2 |
|
---|
3 | import java.io.*;
|
---|
4 | import java.awt.*;
|
---|
5 | import java.awt.image.*;
|
---|
6 | import java.awt.event.*;
|
---|
7 | import javax.swing.*;
|
---|
8 | import javax.swing.border.*;
|
---|
9 | import java.util.*;
|
---|
10 | import java.net.*;
|
---|
11 | import java.rmi.server.*;
|
---|
12 | import javax.imageio.*;
|
---|
13 | import java.util.Locale;
|
---|
14 | import java.util.ResourceBundle;
|
---|
15 | import java.text.MessageFormat;
|
---|
16 | import javax.swing.Timer;
|
---|
17 | import org.greenstone.gatherer.Gatherer;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * This class will show the FeedbackInterface form.
|
---|
21 | * It will allow user to described about the problem better.Here we will also take some more information available
|
---|
22 | * in the system such as the size of the memory available and the screen size.User also could take more screenshot
|
---|
23 | * so they will be able to say the sequence of events that lead up to the problem.
|
---|
24 | * <br>If the user don't want to send this form, then all the information taken from this form will be deleted
|
---|
25 | * and user will be quitted from the Reporting Feedback sequence.
|
---|
26 | *
|
---|
27 | * @author Veronica Liesaputra
|
---|
28 | */
|
---|
29 | public class FeedbackInterface extends JDialog
|
---|
30 | implements ActionListener
|
---|
31 | {
|
---|
32 | /**
|
---|
33 | * This is the button user need to pressed if they want to view the files.
|
---|
34 | * This button will be disabled when the timer is running and finish = false.
|
---|
35 | */
|
---|
36 | private JButton view_button;
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * This button means that the user finished give the information and
|
---|
40 | * want to send it.
|
---|
41 | */
|
---|
42 | public JButton send_button;
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * This button means that the user don't want to send information and
|
---|
46 | * back to normal application.
|
---|
47 | * All the data taken start from user choose to start doing the Feedback sequence
|
---|
48 | * up to this point will be delete.
|
---|
49 | */
|
---|
50 | private JButton notsend_button;
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * This is the text area where user can explain more about the problem.
|
---|
54 | */
|
---|
55 | private JTextArea problem_details;
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * This is the combo box that allow user to specify the poblem type.
|
---|
59 | */
|
---|
60 | private JComboBox problem_type;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * This is the combo box that allow user to specify the urgency of the problem.
|
---|
64 | */
|
---|
65 | private JComboBox problem_urgency;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * This combo box will ask whether or not user want to send the screenshot.
|
---|
69 | */
|
---|
70 | private JComboBox problem_screenshot;
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * This text field allow user to type the smtp address of their email that
|
---|
74 | * they want this application to use to send all the data.
|
---|
75 | * If they don't fill this field then it will set to the same
|
---|
76 | * smtp adress of where the data will be send to.
|
---|
77 | */
|
---|
78 | private JTextField smtp_address;
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * This text field allow user to type the email adress that they want this
|
---|
82 | * application to use to send all the data.
|
---|
83 | * If they don't fill this field then it will set to the same email
|
---|
84 | * adress of where the data will be send to.
|
---|
85 | */
|
---|
86 | private JTextField email_address;
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * This is the name of the window the user lastly used.
|
---|
90 | * This is the name of the window where the user called to start the Feedback
|
---|
91 | * sequence.
|
---|
92 | */
|
---|
93 | private String frameName;
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * This is the unique code generated for each time user start doing the Feedback
|
---|
97 | * sequence.
|
---|
98 | * This code will be used as reference to which feedback that the user send.
|
---|
99 | */
|
---|
100 | private static String code;
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * This is the date when the user start open this FeedbackInterface form.
|
---|
104 | */
|
---|
105 | private Date curr_date;
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * This is the special listener class that record all the action user did in application.
|
---|
109 | */
|
---|
110 | private static ActionRecorderDialog dialog;
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * This variable will hold the resource of the words that is stored in Messages.properties file.
|
---|
114 | * The calling using messages.getString(someString) will caused someString to be translated
|
---|
115 | * into some other string that is hold in that file.usually it will caused it to be translated
|
---|
116 | * to the language that the user use or choose to have as stated in Locale.
|
---|
117 | */
|
---|
118 | private static ResourceBundle messages;
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * This is the screen shot instance that will allow the application to take screen shot of the whole
|
---|
122 | * screen or only the window that the user currently doing their action.
|
---|
123 | */
|
---|
124 | private ScreenShot screen;
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * This is the thread that allows the encoding of the image file to String and the saving of image to
|
---|
128 | * a jpeg file happens concurrently.
|
---|
129 | */
|
---|
130 | private Thread save;
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * This is the hashmap that hold the screen shot and the panel where the screenshot is held.
|
---|
134 | */
|
---|
135 | private HashMap picAndPane;
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * This is the panel that hold all the panels containing the screenshots taken.
|
---|
139 | */
|
---|
140 | private JPanel picture_scroll;
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * This is how many rows of screenshots panel displayed at the moment.
|
---|
144 | */
|
---|
145 | private int row;
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * This is the array list that hold all the screenshots panel displayed.
|
---|
149 | */
|
---|
150 | private ArrayList paneArray;
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * This button will remove the last screenshot panels.
|
---|
154 | */
|
---|
155 | private JButton remove;
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * This is a reference to feedback interface displayed at the moment.
|
---|
159 | */
|
---|
160 | private FeedbackInterface frame;
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * This is the thread to send all the xml files back to the developer.
|
---|
164 | */
|
---|
165 | private Thread sendThread;
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * This is the flag to tell whether or not the sending files finished or not.
|
---|
169 | * It is also flag to tell whether or not the viewing files finished or not.
|
---|
170 | */
|
---|
171 | private static boolean finish;
|
---|
172 |
|
---|
173 | /**
|
---|
174 | * This is the timer to displayed the progress bar to tell user to wait while
|
---|
175 | * we sending the files or while we generate the xml files to be viewed.
|
---|
176 | * If finish = false then wait cursor,progress bar and wait label will be displayed.
|
---|
177 | * If finish = true then default cursor will be displayed.
|
---|
178 | */
|
---|
179 | private Timer timer;
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * Progress bar displayed when user sending or want to view details.
|
---|
183 | */
|
---|
184 | private JProgressBar progressBar;
|
---|
185 |
|
---|
186 | /**
|
---|
187 | * Label displayed to tell user to wait for a while.
|
---|
188 | */
|
---|
189 | private JLabel wait_lbl;
|
---|
190 |
|
---|
191 | /**
|
---|
192 | * This is the background colour for the window.
|
---|
193 | */
|
---|
194 | private Color bckcolor;
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * This is the panel to displayed all descriptions panel.
|
---|
198 | */
|
---|
199 | private JPanel tempPane;
|
---|
200 |
|
---|
201 | /**
|
---|
202 | * This is the thread that will be running when user pressed the preview button.
|
---|
203 | * This thread will show the 6 xml files that are going to be send. It will run concurrently
|
---|
204 | * with the timer, if value of finish = true, this thread will be null-ed.
|
---|
205 | */
|
---|
206 | private Thread prevThread;
|
---|
207 |
|
---|
208 | /**
|
---|
209 | * This is the flag to say whether or not this window should be dispose when timer is stop
|
---|
210 | * and finish = true.
|
---|
211 | * If selected = true then this window should be dispose, otherwise don't dispose it.
|
---|
212 | */
|
---|
213 | private boolean selected = false;
|
---|
214 |
|
---|
215 | /**
|
---|
216 | * This is a blocker to say that user cannot do anything while waiting.
|
---|
217 | */
|
---|
218 | private MouseListener mouse_blocker_listener = new MouseAdapter() {};
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * Will make a dialog window that allows people to write more about the problem that want
|
---|
222 | * to send.
|
---|
223 | * This is the GUI for user to write on Feedback form. It is also setting the up the appropriate
|
---|
224 | * data member with the value passed on to this constructor.
|
---|
225 | * (Precondition: (sh != null) && (dlg != null) && (msg != null))
|
---|
226 | * @param sh an instance of ScreenShot that will allow application to take screenshot.
|
---|
227 | * @param frame_name name of the window where user called Feedback form from.
|
---|
228 | * @param msg holding the resource of the words that is stored in Messages.properties file.
|
---|
229 | * @param dlg holding the special listener.
|
---|
230 | */
|
---|
231 | public FeedbackInterface(ScreenShot sh,String frame_name,
|
---|
232 | ResourceBundle msg,ActionRecorderDialog dlg)
|
---|
233 | {
|
---|
234 | super();
|
---|
235 |
|
---|
236 | frame = this;
|
---|
237 |
|
---|
238 | bckcolor = new Color(176,209,217);
|
---|
239 |
|
---|
240 | picAndPane = new HashMap();
|
---|
241 |
|
---|
242 | messages = msg;
|
---|
243 | frameName = frame_name;
|
---|
244 | dialog = dlg;
|
---|
245 |
|
---|
246 | FeedbackInterface.setDefaultLookAndFeelDecorated(true);
|
---|
247 | setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
---|
248 | setTitle(messages.getString("SendFeedbackForm"));
|
---|
249 |
|
---|
250 | screen = sh;
|
---|
251 | Container container;
|
---|
252 | container = getContentPane();
|
---|
253 | createUI(container);
|
---|
254 | curr_date = new Date();
|
---|
255 |
|
---|
256 | Toolkit kit;
|
---|
257 | kit = Toolkit.getDefaultToolkit();
|
---|
258 | Dimension screenSize;
|
---|
259 | screenSize = kit.getScreenSize();
|
---|
260 | int screenHeight;
|
---|
261 | screenHeight = screenSize.height;
|
---|
262 | int screenWidth;
|
---|
263 | screenWidth = screenSize.width;
|
---|
264 | Dimension size;
|
---|
265 | size = this.getSize();
|
---|
266 | setLocation((screenWidth - size.width - 500) ,
|
---|
267 | (screenHeight - size.height - 700));
|
---|
268 |
|
---|
269 | setBackground(bckcolor);
|
---|
270 | pack();
|
---|
271 | setModal(false);
|
---|
272 | setVisible(true);
|
---|
273 | }
|
---|
274 |
|
---|
275 | /**
|
---|
276 | * This method is setting up the content pane for the Feedback form window.
|
---|
277 | * (Precondition: (window != null))
|
---|
278 | * @param window the content pane of Feedback form window.
|
---|
279 | */
|
---|
280 | public void createUI(Container window)
|
---|
281 | {
|
---|
282 | JPanel container;
|
---|
283 | container = new JPanel();
|
---|
284 | container.setBackground(bckcolor);
|
---|
285 | container.setLayout(new BoxLayout(container,BoxLayout.PAGE_AXIS));
|
---|
286 |
|
---|
287 | String opening_text;
|
---|
288 | opening_text = messages.getString("FeedbackOpeningText");
|
---|
289 | JTextArea textArea;
|
---|
290 | textArea = new JTextArea(opening_text);
|
---|
291 | textArea.setMinimumSize(new Dimension(100,100));
|
---|
292 | textArea.setOpaque(false);
|
---|
293 | textArea.setEditable(false);
|
---|
294 | textArea.setLineWrap(true);
|
---|
295 | textArea.setWrapStyleWord(true);
|
---|
296 | textArea.setBorder(new EmptyBorder(10,10,0,10));
|
---|
297 | textArea.setBackground(bckcolor);
|
---|
298 | container.add(textArea);
|
---|
299 |
|
---|
300 | tempPane = new JPanel();
|
---|
301 | tempPane.setLayout(new BorderLayout());
|
---|
302 | tempPane.setBackground(new Color(176,208,176));
|
---|
303 |
|
---|
304 | paneArray = new ArrayList();
|
---|
305 | picture_scroll = new JPanel();
|
---|
306 | row = 1;
|
---|
307 | picture_scroll.setLayout(new GridLayout(0,1));
|
---|
308 | picture_scroll.setBackground(new Color(176,208,176));
|
---|
309 | tempPane.add(picture_scroll,BorderLayout.PAGE_START);
|
---|
310 |
|
---|
311 | JPanel btnPanel;
|
---|
312 | btnPanel = new JPanel();
|
---|
313 | btnPanel.setBackground(new Color(176,208,176));
|
---|
314 | remove = new JButton("Remove");
|
---|
315 | remove.setActionCommand("Remove");
|
---|
316 | remove.addActionListener(new ActionListener ()
|
---|
317 | {
|
---|
318 | public void actionPerformed(ActionEvent e)
|
---|
319 | {
|
---|
320 | Object obj;
|
---|
321 | JPanel pane;
|
---|
322 |
|
---|
323 | if (paneArray.size() == 0)
|
---|
324 | System.out.println("There is no panel here!");
|
---|
325 | else
|
---|
326 | {
|
---|
327 | pane = (JPanel) paneArray.get((row - 2));
|
---|
328 | obj = picAndPane.get(pane);
|
---|
329 | obj = null;
|
---|
330 | picAndPane.remove(pane);
|
---|
331 | paneArray.remove((row - 2));
|
---|
332 |
|
---|
333 | if (paneArray.size() == 0)
|
---|
334 | remove.setVisible(false);
|
---|
335 |
|
---|
336 | picture_scroll.remove(pane);
|
---|
337 |
|
---|
338 | row--;
|
---|
339 |
|
---|
340 | picture_scroll.setSize(picture_scroll.getPreferredSize());
|
---|
341 | picture_scroll.revalidate();
|
---|
342 | picture_scroll.repaint();
|
---|
343 | tempPane.setSize(tempPane.getPreferredSize());
|
---|
344 | tempPane.revalidate();
|
---|
345 | tempPane.repaint();
|
---|
346 | }
|
---|
347 | }
|
---|
348 | });
|
---|
349 | remove.setToolTipText("Remove last thumbnail");
|
---|
350 | remove.setBackground(new Color(176,208,176));
|
---|
351 | remove.setVisible(false);
|
---|
352 | btnPanel.add(remove);
|
---|
353 | tempPane.add(btnPanel,BorderLayout.PAGE_END);
|
---|
354 |
|
---|
355 | JScrollPane pict_scroll;
|
---|
356 | pict_scroll = new JScrollPane(tempPane);
|
---|
357 | pict_scroll.setBackground(bckcolor);
|
---|
358 | pict_scroll.setPreferredSize(new Dimension(300,300));
|
---|
359 | pict_scroll.setBorder(new EmptyBorder(0,10,10,10));
|
---|
360 | container.add(pict_scroll);
|
---|
361 |
|
---|
362 | JPanel pane;
|
---|
363 | pane = new JPanel();
|
---|
364 | pane.setBackground(bckcolor);
|
---|
365 | pane.setLayout(new GridLayout(0,2));
|
---|
366 | pane.setBorder(new EmptyBorder(10,10,10,10));
|
---|
367 |
|
---|
368 | JLabel txt_type;
|
---|
369 | txt_type = new JLabel(messages.getString("Whatkindofproblemisit") + "? ");
|
---|
370 | txt_type.setBackground(bckcolor);
|
---|
371 | pane.add(txt_type);
|
---|
372 |
|
---|
373 | String [] type = {" ",messages.getString("ContentError"),
|
---|
374 | messages.getString("ImageNotShow"),
|
---|
375 | messages.getString("StrangeBehaviour"),
|
---|
376 | messages.getString("SomethingUnexpectedHappen"),
|
---|
377 | messages.getString("HardToUse"),
|
---|
378 | messages.getString("Other")};
|
---|
379 | problem_type = new JComboBox(type);
|
---|
380 | problem_type.setOpaque(false);
|
---|
381 | problem_type.addActionListener(this);
|
---|
382 | problem_type.setBackground(bckcolor);
|
---|
383 | pane.add(problem_type);
|
---|
384 |
|
---|
385 | JLabel txt_urgent;
|
---|
386 | txt_urgent = new JLabel(messages.getString("Howbadistheproblem")+"? ");
|
---|
387 | txt_urgent.setBackground(bckcolor);
|
---|
388 | pane.add(txt_urgent);
|
---|
389 |
|
---|
390 | String[] urgent = {" ",messages.getString("Critical"),
|
---|
391 | messages.getString("Serious"),
|
---|
392 | messages.getString("Medium"),messages.getString("Minor"),
|
---|
393 | messages.getString("Trivial")};
|
---|
394 | problem_urgency = new JComboBox(urgent);
|
---|
395 | problem_urgency.setOpaque(false);
|
---|
396 | problem_urgency.addActionListener(this);
|
---|
397 | problem_urgency.setBackground(bckcolor);
|
---|
398 | pane.add(problem_urgency);
|
---|
399 |
|
---|
400 | /*JLabel txt_screenshot;
|
---|
401 | txt_screenshot= new JLabel(messages.getString("Doyouwanttosendthescreenshot") + "? ");
|
---|
402 | txt_screenshot.setBackground(new Color(108,168,108));
|
---|
403 | pane.add(txt_screenshot);
|
---|
404 |
|
---|
405 | String[] screenshot = {messages.getString("Yes"),
|
---|
406 | messages.getString("No")};
|
---|
407 | problem_screenshot = new JComboBox(screenshot);
|
---|
408 | problem_screenshot.addActionListener(this);
|
---|
409 | problem_screenshot.setBackground(new Color(108,168,108));
|
---|
410 | pane.add(problem_screenshot);*/
|
---|
411 |
|
---|
412 |
|
---|
413 | /*JLabel txt_smtp;
|
---|
414 | txt_smtp = new JLabel(messages.getString("SMTPaddress") + "? ");
|
---|
415 | txt_smtp.setBackground(new Color(176,208,176));
|
---|
416 | pane.add(txt_smtp);
|
---|
417 |
|
---|
418 | smtp_address = new JTextField();
|
---|
419 | smtp_address.setBackground(new Color(224,240,224));
|
---|
420 | pane.add(smtp_address);*/
|
---|
421 |
|
---|
422 |
|
---|
423 | /*JLabel txt_email;
|
---|
424 | txt_email = new JLabel(messages.getString("Emailaddress") + "? ");
|
---|
425 | txt_email.setBackground(new Color(176,208,176));
|
---|
426 | pane.add(txt_email);
|
---|
427 |
|
---|
428 | email_address = new JTextField();
|
---|
429 | email_address.setBackground(new Color(224,240,224));
|
---|
430 | pane.add(email_address);*/
|
---|
431 |
|
---|
432 | JLabel empty;
|
---|
433 | empty = new JLabel (" ");
|
---|
434 | empty.setBackground(bckcolor);
|
---|
435 | pane.add(empty);
|
---|
436 | JLabel empty2;
|
---|
437 | empty2 = new JLabel (" ");
|
---|
438 | empty2.setBackground(bckcolor);
|
---|
439 | pane.add(empty2);
|
---|
440 | container.add(pane);
|
---|
441 |
|
---|
442 | JPanel panely;
|
---|
443 | panely = new JPanel();
|
---|
444 | panely.setLayout(new GridLayout(0,3));
|
---|
445 | panely.setBackground(bckcolor);
|
---|
446 | panely.setBorder(new EmptyBorder(new Insets(10,10,10,10)));
|
---|
447 |
|
---|
448 | view_button = new JButton("Details . . .");
|
---|
449 | view_button.setActionCommand(messages.getString("Preview"));
|
---|
450 | view_button.addActionListener(this);
|
---|
451 | view_button.setToolTipText(messages.getString("ConformationPreview"));
|
---|
452 | view_button.setBackground(bckcolor);
|
---|
453 | panely.add(view_button);
|
---|
454 |
|
---|
455 | send_button = new JButton(messages.getString("Send"));
|
---|
456 | send_button.setActionCommand(messages.getString("Send"));
|
---|
457 | send_button.addActionListener(this);
|
---|
458 | send_button.setDefaultCapable(true);
|
---|
459 | send_button.setToolTipText(messages.getString("FeedbackSendButton"));
|
---|
460 | send_button.setBackground(bckcolor);
|
---|
461 | panely.add(send_button);
|
---|
462 |
|
---|
463 | notsend_button = new JButton("Cancel");
|
---|
464 | notsend_button.setActionCommand(messages.getString("NotSend"));
|
---|
465 | notsend_button.addActionListener(this);
|
---|
466 | notsend_button.setToolTipText(messages.getString("FeedbackNotSendButton"));
|
---|
467 | notsend_button.setBackground(bckcolor);
|
---|
468 | panely.add(notsend_button);
|
---|
469 | container.add(panely);
|
---|
470 |
|
---|
471 | //Align the left edges of the components.
|
---|
472 | textArea.setAlignmentX(Component.LEFT_ALIGNMENT);
|
---|
473 | pict_scroll.setAlignmentX(Component.LEFT_ALIGNMENT);
|
---|
474 | pane.setAlignmentX(Component.LEFT_ALIGNMENT);
|
---|
475 | panely.setAlignmentX(Component.LEFT_ALIGNMENT);
|
---|
476 |
|
---|
477 | String about;
|
---|
478 | about = messages.getString("FeedbackAboutText");
|
---|
479 | JTextArea about_txt;
|
---|
480 | about_txt = new JTextArea(about);
|
---|
481 | about_txt.setEditable(false);
|
---|
482 | about_txt.setLineWrap(true);
|
---|
483 | about_txt.setWrapStyleWord(true);
|
---|
484 | about_txt.setBackground(bckcolor);
|
---|
485 | about_txt.setBorder(new EmptyBorder(10,10,10,10));
|
---|
486 |
|
---|
487 | String privacy;
|
---|
488 | privacy = messages.getString("FeedbackPrivacyText");
|
---|
489 | JTextArea privacy_txt;
|
---|
490 | privacy_txt = new JTextArea(privacy);
|
---|
491 | privacy_txt.setEditable(false);
|
---|
492 | privacy_txt.setLineWrap(true);
|
---|
493 | privacy_txt.setWrapStyleWord(true);
|
---|
494 | privacy_txt.setBackground(bckcolor);
|
---|
495 | privacy_txt.setBorder(new EmptyBorder(10,10,10,10));
|
---|
496 |
|
---|
497 | JTabbedPane tab;
|
---|
498 | tab = new JTabbedPane();
|
---|
499 | tab.setBackground(bckcolor);
|
---|
500 | tab.addTab(messages.getString("Form"),container);
|
---|
501 | tab.addTab(messages.getString("About"),about_txt);
|
---|
502 | tab.addTab(messages.getString("Privacy"),privacy_txt);
|
---|
503 | tab.setBorder(new EmptyBorder(5,5,5,5));
|
---|
504 |
|
---|
505 | JPanel panelx;
|
---|
506 | panelx = new JPanel();
|
---|
507 | panelx.setLayout(new BoxLayout(panelx,BoxLayout.PAGE_AXIS));
|
---|
508 | panelx.setBackground(bckcolor);
|
---|
509 | panelx.setBorder(new EmptyBorder(new Insets(10,10,10,10)));
|
---|
510 |
|
---|
511 | wait_lbl = new JLabel(messages.getString("Pleasewait"));
|
---|
512 | wait_lbl.setBackground(bckcolor);
|
---|
513 | wait_lbl.setVisible(false);
|
---|
514 | panelx.add(wait_lbl);
|
---|
515 |
|
---|
516 | progressBar = new JProgressBar ();
|
---|
517 | progressBar.setBackground(bckcolor);
|
---|
518 | progressBar.setVisible(false);
|
---|
519 | panelx.add(progressBar);
|
---|
520 |
|
---|
521 | JLabel emp2;
|
---|
522 | emp2 = new JLabel (" ");
|
---|
523 | emp2.setBackground(bckcolor);
|
---|
524 | panelx.add(emp2);
|
---|
525 |
|
---|
526 | wait_lbl.setAlignmentX(Component.CENTER_ALIGNMENT);
|
---|
527 | progressBar.setAlignmentX(Component.CENTER_ALIGNMENT);
|
---|
528 | emp2.setAlignmentX(Component.CENTER_ALIGNMENT);
|
---|
529 |
|
---|
530 | final String p1;
|
---|
531 | final String p2;
|
---|
532 | p1 = "Tab";
|
---|
533 | p2 = "ProgressBar";
|
---|
534 |
|
---|
535 | final JPanel cards;
|
---|
536 | cards = new JPanel(new CardLayout());
|
---|
537 | cards.setBackground(bckcolor);
|
---|
538 | cards.add(tab,p1);
|
---|
539 | cards.add(panelx,p2);
|
---|
540 |
|
---|
541 | window.add(cards);
|
---|
542 |
|
---|
543 |
|
---|
544 | timer = new Timer(1000, new ActionListener()
|
---|
545 | {
|
---|
546 | public void actionPerformed(ActionEvent evt)
|
---|
547 | {
|
---|
548 | if (finish == true)
|
---|
549 | {
|
---|
550 | if (sendThread != null)
|
---|
551 | {
|
---|
552 | sendThread.interrupt();
|
---|
553 | sendThread = null;
|
---|
554 | }
|
---|
555 |
|
---|
556 | if (prevThread != null)
|
---|
557 | {
|
---|
558 | prevThread.interrupt();
|
---|
559 | prevThread = null;
|
---|
560 | }
|
---|
561 |
|
---|
562 | Component glass_pane;
|
---|
563 | glass_pane = frame.getGlassPane();
|
---|
564 |
|
---|
565 | glass_pane.setVisible(false);
|
---|
566 | glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
567 | glass_pane.removeMouseListener(mouse_blocker_listener);
|
---|
568 |
|
---|
569 | wait_lbl.setVisible(false);
|
---|
570 | progressBar.setIndeterminate(false);
|
---|
571 | progressBar.setVisible(false);
|
---|
572 |
|
---|
573 | frame.setTitle(messages.getString("SendFeedbackForm"));
|
---|
574 |
|
---|
575 | CardLayout cl = (CardLayout)(cards.getLayout());
|
---|
576 | cl.show(cards,p1);
|
---|
577 |
|
---|
578 | if (selected == true)
|
---|
579 | frame.dispose();
|
---|
580 |
|
---|
581 | timer.stop();
|
---|
582 | }
|
---|
583 | else
|
---|
584 | {
|
---|
585 | Component glass_pane;
|
---|
586 | glass_pane = frame.getGlassPane();
|
---|
587 |
|
---|
588 | glass_pane.addMouseListener(mouse_blocker_listener);
|
---|
589 | glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
590 | glass_pane.setVisible(true);
|
---|
591 |
|
---|
592 | frame.setTitle("Please wait...");
|
---|
593 |
|
---|
594 | CardLayout cl = (CardLayout)(cards.getLayout());
|
---|
595 | cl.show(cards,p2);
|
---|
596 |
|
---|
597 | wait_lbl.setVisible(true);
|
---|
598 | progressBar.setIndeterminate(true);
|
---|
599 | progressBar.setVisible(true);
|
---|
600 | }
|
---|
601 | }
|
---|
602 | });
|
---|
603 | }
|
---|
604 |
|
---|
605 | /**
|
---|
606 | * This method will set the finish variable values.
|
---|
607 | * When the sending files is finished, the sending application will set the finish value to true.
|
---|
608 | * @param fin whether or not the send files is finished.
|
---|
609 | */
|
---|
610 | public static void setFinish (boolean fin)
|
---|
611 | {
|
---|
612 | finish = fin;
|
---|
613 | }
|
---|
614 |
|
---|
615 | /**
|
---|
616 | * This is the class to represent the whole panel that hold the screenshot and the comments
|
---|
617 | * about the screenshot.
|
---|
618 | */
|
---|
619 | private class ThumbnailPic implements Serializable
|
---|
620 | {
|
---|
621 | /**
|
---|
622 | * This is the panel that hold a thumbnail for a screenshot and a comments text area.
|
---|
623 | */
|
---|
624 | private JPanel picpane;
|
---|
625 |
|
---|
626 | /**
|
---|
627 | * This hold the BufferedImages for the whole screen version of screenshot.
|
---|
628 | */
|
---|
629 | private BufferedImage[] screenimages;
|
---|
630 |
|
---|
631 | /**
|
---|
632 | * This hold the BufferedImages for the window version only.
|
---|
633 | */
|
---|
634 | private BufferedImage[] windowimages;
|
---|
635 |
|
---|
636 | /**
|
---|
637 | * This is the text area where user can enter their comments.
|
---|
638 | */
|
---|
639 | private JTextArea problem_details;
|
---|
640 |
|
---|
641 | /**
|
---|
642 | * This is a flag to tell us which image user wants to send.Its defaults value is false.
|
---|
643 | * If iswindow = true then it means user wants to send the window version only.
|
---|
644 | * If iswindow = false then it means user wants to send the whole screen version.
|
---|
645 | */
|
---|
646 | private boolean iswindow;
|
---|
647 |
|
---|
648 | /**
|
---|
649 | * This is the titles for the panel.
|
---|
650 | * Usually this is the title of the window where user wants to do the screenshot.
|
---|
651 | * If the title is more than 40 characters then we will trim it and add ... at the back of it.
|
---|
652 | */
|
---|
653 | private String titles;
|
---|
654 |
|
---|
655 | /**
|
---|
656 | * This is the width of the image user wants to send.
|
---|
657 | */
|
---|
658 | private String iw;
|
---|
659 |
|
---|
660 | /**
|
---|
661 | * This is the height of the image user wants to send.
|
---|
662 | */
|
---|
663 | private String ih;
|
---|
664 |
|
---|
665 | /**
|
---|
666 | * This is the x-coordinate where the window located inside the whole screen image.
|
---|
667 | */
|
---|
668 | private int xcoord;
|
---|
669 |
|
---|
670 | /**
|
---|
671 | * This is the y-coordinate where the window located inside the whole screen image.
|
---|
672 | */
|
---|
673 | private int ycoord;
|
---|
674 |
|
---|
675 | /**
|
---|
676 | * This is the width of the window inside the whole screen image.
|
---|
677 | */
|
---|
678 | private int width;
|
---|
679 |
|
---|
680 | /**
|
---|
681 | * This is the height of the window inside the whole screen image.
|
---|
682 | */
|
---|
683 | private int height;
|
---|
684 |
|
---|
685 | /**
|
---|
686 | * This is the constructor that will setup the panel that contains
|
---|
687 | * a thumbnail screenshot and a comments text area.
|
---|
688 | * @param image the whole screen screenshot image.
|
---|
689 | * @param text the title for this pane.
|
---|
690 | * @param x the x-coordinate of the window inside the whole screen image.
|
---|
691 | * @param y the y-coordinate of the window inside the whole screen image.
|
---|
692 | * @param w the width of the window inside the whole screen image.
|
---|
693 | * @param h the height of the window inside the whole screen image.
|
---|
694 | */
|
---|
695 | //public ThumbnailPic (BufferedImage screen,byte[] image,String text)
|
---|
696 | public ThumbnailPic (BufferedImage image,String text,int x,int y,int w,int h)
|
---|
697 | {
|
---|
698 | xcoord = x;
|
---|
699 | ycoord = y;
|
---|
700 | width = w;
|
---|
701 | height = h;
|
---|
702 | iswindow = false;
|
---|
703 | titles = text;
|
---|
704 | screenimages = new BufferedImage[3];
|
---|
705 | windowimages = new BufferedImage[3];
|
---|
706 | //screenimages[0] = screen;
|
---|
707 | screenimages[0] = image;
|
---|
708 | screenimages[1] = null;
|
---|
709 | screenimages[2] = null;
|
---|
710 | windowimages[0] = null;
|
---|
711 | windowimages[1] = null;
|
---|
712 | windowimages[2] = null;
|
---|
713 | addPanel(image);
|
---|
714 | }
|
---|
715 |
|
---|
716 | /**
|
---|
717 | * This method will setup the components inside the panel properly.
|
---|
718 | * @param image the whole screen screenshot image.
|
---|
719 | */
|
---|
720 | //public void addPanel (byte[] image)
|
---|
721 | public void addPanel (BufferedImage image)
|
---|
722 | {
|
---|
723 | picpane = new JPanel();
|
---|
724 | picpane.setLayout(new BorderLayout());
|
---|
725 |
|
---|
726 | final JButton picture;
|
---|
727 | picture = new JButton();
|
---|
728 |
|
---|
729 | int w;
|
---|
730 | int h;
|
---|
731 |
|
---|
732 | w = (int) (150/2);
|
---|
733 | h = (int) (150/2);
|
---|
734 |
|
---|
735 | iw = "" + image.getWidth();
|
---|
736 | ih = "" + image.getHeight();
|
---|
737 |
|
---|
738 | ImageIcon thumbnail;
|
---|
739 | thumbnail = new ImageIcon(image.getScaledInstance(w,h,Image.SCALE_SMOOTH));
|
---|
740 |
|
---|
741 | picture.setIcon(thumbnail);
|
---|
742 | picture.setText("Draw . . .");
|
---|
743 | picture.setActionCommand("Scribble");
|
---|
744 | picture.addActionListener(new ActionListener()
|
---|
745 | {
|
---|
746 | public void actionPerformed (ActionEvent e)
|
---|
747 | {
|
---|
748 | frame.addMouseListener(mouse_blocker_listener);
|
---|
749 | frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
750 | SelectPicture select;
|
---|
751 | select = new SelectPicture(screenimages,windowimages,iswindow,problem_details.getText(),messages);
|
---|
752 | frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
753 | frame.removeMouseListener(mouse_blocker_listener);
|
---|
754 | select.setWindowBounds(xcoord,ycoord,width,height);
|
---|
755 |
|
---|
756 | iswindow = select.getIsWindow();
|
---|
757 |
|
---|
758 | screenimages[0] = select.getImage3();
|
---|
759 | screenimages[1] = select.getImage();
|
---|
760 | screenimages[2] = select.getImage2();
|
---|
761 |
|
---|
762 | if (iswindow == true)
|
---|
763 | {
|
---|
764 | windowimages[0] = select.getWindowImage3();
|
---|
765 | windowimages[1] = select.getWindowImage();
|
---|
766 | windowimages[2] = select.getWindowImage2();
|
---|
767 | }
|
---|
768 | else
|
---|
769 | {
|
---|
770 | windowimages[0] = null;
|
---|
771 | windowimages[1] = null;
|
---|
772 | windowimages[2] = null;
|
---|
773 | }
|
---|
774 |
|
---|
775 | problem_details.setText(select.getDetails());
|
---|
776 |
|
---|
777 | int w,h;
|
---|
778 | w = (int) (150/2);
|
---|
779 | h = (int) (150/2);
|
---|
780 |
|
---|
781 | ImageIcon thumbnail;
|
---|
782 |
|
---|
783 | if (iswindow == false)
|
---|
784 | thumbnail = new ImageIcon(screenimages[1].getScaledInstance(w,h,Image.SCALE_SMOOTH));
|
---|
785 | else
|
---|
786 | thumbnail = new ImageIcon(windowimages[1].getScaledInstance(w,h,Image.SCALE_SMOOTH));
|
---|
787 |
|
---|
788 | picture.setIcon(thumbnail);
|
---|
789 |
|
---|
790 | if (select.getSendNow() == true)
|
---|
791 | {
|
---|
792 | ActionEvent evt;
|
---|
793 | evt = new ActionEvent(send_button,ActionEvent.ACTION_PERFORMED,messages.getString("Send"));
|
---|
794 |
|
---|
795 | frame.actionPerformed(evt);
|
---|
796 | }
|
---|
797 | }
|
---|
798 | });
|
---|
799 | picture.setToolTipText("Click if you want to draw on it");
|
---|
800 | picture.setMargin(new Insets(5,5,5,5));
|
---|
801 | picture.setVerticalTextPosition(AbstractButton.BOTTOM);
|
---|
802 | picture.setHorizontalTextPosition(AbstractButton.CENTER);
|
---|
803 | picture.setBackground(new Color(176,208,176));
|
---|
804 | picpane.add(picture,BorderLayout.LINE_START);
|
---|
805 |
|
---|
806 | JPanel txtPane;
|
---|
807 | txtPane = new JPanel(new BorderLayout());
|
---|
808 | txtPane.setBackground(new Color(176,208,176));
|
---|
809 | txtPane.setBorder(new EmptyBorder(5,5,5,5));
|
---|
810 |
|
---|
811 | JLabel lbldesc = new JLabel("Comments :");
|
---|
812 | lbldesc.setBackground(new Color(176,208,176));
|
---|
813 | txtPane.add(lbldesc,BorderLayout.PAGE_START);
|
---|
814 |
|
---|
815 | problem_details = new JTextArea();
|
---|
816 | problem_details.setWrapStyleWord(true);
|
---|
817 | problem_details.setEditable(true);
|
---|
818 | problem_details.setBackground(new Color(224,240,224));
|
---|
819 |
|
---|
820 | JScrollPane scroll;
|
---|
821 | scroll = new JScrollPane(problem_details);
|
---|
822 | scroll.setBackground(new Color(176,208,176));
|
---|
823 | scroll.setPreferredSize(new Dimension(300,150));
|
---|
824 | txtPane.add(scroll,BorderLayout.LINE_START);
|
---|
825 |
|
---|
826 | picpane.setSize(new Dimension(150,150));
|
---|
827 | picpane.add(txtPane,BorderLayout.CENTER);
|
---|
828 | }
|
---|
829 |
|
---|
830 | /**
|
---|
831 | * This method will get the width of the image user wants to send.
|
---|
832 | * @return the width of the image.
|
---|
833 | */
|
---|
834 | public String getWidth()
|
---|
835 | {
|
---|
836 | if (iswindow == false)
|
---|
837 | return "" + screenimages[0].getWidth();
|
---|
838 | else
|
---|
839 | {
|
---|
840 | return "" + windowimages[0].getWidth();
|
---|
841 | }
|
---|
842 | }
|
---|
843 |
|
---|
844 | /**
|
---|
845 | * This method will get the height of the image user wants to send.
|
---|
846 | * @return the height of the image.
|
---|
847 | */
|
---|
848 | public String getHeight()
|
---|
849 | {
|
---|
850 | if (iswindow == false)
|
---|
851 | return "" + screenimages[0].getHeight();
|
---|
852 | else
|
---|
853 | {
|
---|
854 | return "" + windowimages[0].getHeight();
|
---|
855 | }
|
---|
856 | }
|
---|
857 |
|
---|
858 | /**
|
---|
859 | * This method will get the titles of this panel.
|
---|
860 | * @return the panel's title.
|
---|
861 | */
|
---|
862 | public String getTitles()
|
---|
863 | {
|
---|
864 | return titles;
|
---|
865 | }
|
---|
866 |
|
---|
867 | /**
|
---|
868 | * This method will get user comments inside the text area.
|
---|
869 | * @return the user's comments.
|
---|
870 | */
|
---|
871 | public String getProblemDetails ()
|
---|
872 | {
|
---|
873 | String txt;
|
---|
874 | txt = problem_details.getText();
|
---|
875 |
|
---|
876 | if (txt == null)
|
---|
877 | return " ";
|
---|
878 | else
|
---|
879 | return txt;
|
---|
880 | }
|
---|
881 |
|
---|
882 | /**
|
---|
883 | * This method will setting up the text inside the text area.
|
---|
884 | * @param comments the text set to the text area.
|
---|
885 | */
|
---|
886 | public void setComments (String comments)
|
---|
887 | {
|
---|
888 | problem_details.setText(comments);
|
---|
889 | }
|
---|
890 |
|
---|
891 | /**
|
---|
892 | * This method will get the image that user wants to send.
|
---|
893 | * @return image going to be send.
|
---|
894 | */
|
---|
895 | public BufferedImage[] getImages ()
|
---|
896 | {
|
---|
897 | if (iswindow == false)
|
---|
898 | return screenimages;
|
---|
899 | else
|
---|
900 | return windowimages;
|
---|
901 | }
|
---|
902 |
|
---|
903 | /**
|
---|
904 | * This method will get the non-scribble lines image that user wants to send.
|
---|
905 | * @return the string representation of the non-scribble lines image.
|
---|
906 | */
|
---|
907 | public String getScreenImage ()
|
---|
908 | {
|
---|
909 | if (iswindow == false)
|
---|
910 | return convert(screenimages[0]);
|
---|
911 | else
|
---|
912 | return convert(windowimages[1]);
|
---|
913 | }
|
---|
914 |
|
---|
915 | /**
|
---|
916 | * This method will get the scribble lines image that user wants to send.
|
---|
917 | * @return the string representation of the scribble lines image.
|
---|
918 | */
|
---|
919 | public String getScreenAndLineImage ()
|
---|
920 | {
|
---|
921 | if (iswindow == false)
|
---|
922 | {
|
---|
923 | if (screenimages[1]!= null)
|
---|
924 | return convert(screenimages[1]);
|
---|
925 | else
|
---|
926 | return convert(screenimages[0]);
|
---|
927 | }
|
---|
928 | else
|
---|
929 | {
|
---|
930 | if (windowimages[1]!= null)
|
---|
931 | return convert(windowimages[1]);
|
---|
932 | else
|
---|
933 | return convert(windowimages[0]);
|
---|
934 | }
|
---|
935 | }
|
---|
936 |
|
---|
937 | /**
|
---|
938 | * This method will get only scribble lines image that user wants to send.
|
---|
939 | * @return the string representation of the only scribble lines image.
|
---|
940 | */
|
---|
941 | public String getLineForScreenImage ()
|
---|
942 | {
|
---|
943 | if (iswindow == false)
|
---|
944 | {
|
---|
945 | if (screenimages[2] != null)
|
---|
946 | return convert(screenimages[2]);
|
---|
947 | else
|
---|
948 | return "";
|
---|
949 | }
|
---|
950 | else
|
---|
951 | {
|
---|
952 | if (windowimages[2] != null)
|
---|
953 | return convert(windowimages[2]);
|
---|
954 | else
|
---|
955 | return "";
|
---|
956 | }
|
---|
957 | }
|
---|
958 |
|
---|
959 | /**
|
---|
960 | * This method will get the panel that hold a thumbnail and a text area.
|
---|
961 | * @return panel that represent the thumbnail and the text area.
|
---|
962 | */
|
---|
963 | public JPanel getPanel()
|
---|
964 | {
|
---|
965 | return picpane;
|
---|
966 | }
|
---|
967 | }
|
---|
968 |
|
---|
969 | /**
|
---|
970 | * This method will setting up the comments to be displayed inside the latest added panel.
|
---|
971 | * So if the window where user wants to take the screenshot at the moment is a modal window
|
---|
972 | * then it will setting the comments to ask user to close the window before they can enter
|
---|
973 | * their comments there.
|
---|
974 | * @param modal the modality of the window where user wants to take the screenshot.
|
---|
975 | */
|
---|
976 | public void setComment (boolean modal)
|
---|
977 | {
|
---|
978 | if (paneArray.size() == 0)
|
---|
979 | System.out.println("There is no panel here!");
|
---|
980 | else
|
---|
981 | {
|
---|
982 | JPanel pane;
|
---|
983 | pane = (JPanel) paneArray.get((row - 2));
|
---|
984 | ThumbnailPic obj;
|
---|
985 | obj = (ThumbnailPic) picAndPane.get(pane);
|
---|
986 | String text;
|
---|
987 | if (modal == true)
|
---|
988 | text = "Please close '" + obj.getTitles() + "' window \nbefore you can enter comments here.";
|
---|
989 | else
|
---|
990 | text = " ";
|
---|
991 | obj.setComments(text);
|
---|
992 | }
|
---|
993 | }
|
---|
994 |
|
---|
995 | /**
|
---|
996 | * This method will add a panel that contains the thumbnail button and the text area.
|
---|
997 | * @param title the window's title.
|
---|
998 | * @param image the whole screen image.
|
---|
999 | * @param x the window's x-coordinate in the image.
|
---|
1000 | * @param y the window's y-coordinate in the image.
|
---|
1001 | * @param width the window's width in the image.
|
---|
1002 | * @param height the window's height in the image.
|
---|
1003 | */
|
---|
1004 | //public void addScreenPanel (String title,BufferedImage screen,byte[] image)
|
---|
1005 | public void addScreenPanel (String title,BufferedImage image,int x,int y,int width,int height)
|
---|
1006 | {
|
---|
1007 | final JPanel pane;
|
---|
1008 | pane = new JPanel();
|
---|
1009 | pane.setLayout(new BorderLayout());
|
---|
1010 | pane.setBackground(new Color(176,208,176));
|
---|
1011 |
|
---|
1012 | Border loweredetched;
|
---|
1013 | loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
|
---|
1014 |
|
---|
1015 | String ttl;
|
---|
1016 | if (title.length() > 41)
|
---|
1017 | ttl = title.substring(0,40) + " . . . ";
|
---|
1018 | else
|
---|
1019 | ttl = title;
|
---|
1020 |
|
---|
1021 | TitledBorder border;
|
---|
1022 | border = BorderFactory.createTitledBorder(loweredetched, title);
|
---|
1023 | border.setTitleJustification(TitledBorder.LEFT);
|
---|
1024 |
|
---|
1025 | pane.setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(5,5,5,5),border));
|
---|
1026 |
|
---|
1027 | ThumbnailPic pic;
|
---|
1028 | //pic = new ThumbnailPic(screen,image,title);
|
---|
1029 | pic = new ThumbnailPic(image,title,x,y,width,height);
|
---|
1030 | picAndPane.put(pane,pic);
|
---|
1031 | pane.add(pic.getPanel(),BorderLayout.LINE_START);
|
---|
1032 |
|
---|
1033 | remove.setVisible(true);
|
---|
1034 | picture_scroll.add(pane);
|
---|
1035 | paneArray.add(pane);
|
---|
1036 | row++;
|
---|
1037 | picture_scroll.setSize(picture_scroll.getPreferredSize());
|
---|
1038 | picture_scroll.revalidate();
|
---|
1039 | picture_scroll.repaint();
|
---|
1040 | tempPane.setSize(tempPane.getPreferredSize());
|
---|
1041 | tempPane.revalidate();
|
---|
1042 | tempPane.repaint();
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | /**
|
---|
1046 | * This method will generate the unique code that will be used as the
|
---|
1047 | * reference number of the feedback that user are about to send.
|
---|
1048 | * @return the unique code.
|
---|
1049 | */
|
---|
1050 | public String getPrevData ()
|
---|
1051 | {
|
---|
1052 | try
|
---|
1053 | {
|
---|
1054 | UID id = new UID();
|
---|
1055 | code = "" + InetAddress.getLocalHost().hashCode() + id.hashCode();
|
---|
1056 | }
|
---|
1057 | catch (UnknownHostException exp) {}
|
---|
1058 | return code;
|
---|
1059 | }
|
---|
1060 |
|
---|
1061 | /**
|
---|
1062 | * This method allows another class to get the unique code that can be used as
|
---|
1063 | * the reference number of the feedback that user are about to send.
|
---|
1064 | * This method should be called only if
|
---|
1065 | * getPrevData() method already been called before.Otherwise it will return null.
|
---|
1066 | * @return the unique code
|
---|
1067 | */
|
---|
1068 | public static String getCode()
|
---|
1069 | {
|
---|
1070 | return code;
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 | /**
|
---|
1074 | * This method will encode BufferedImage into their String representation using
|
---|
1075 | * Base64 encoder.
|
---|
1076 | * (Precondition: (image != null))
|
---|
1077 | * @param image is the image that we want to encode to String.
|
---|
1078 | */
|
---|
1079 | public String convert (BufferedImage image)
|
---|
1080 | {
|
---|
1081 | String txt;
|
---|
1082 | txt = null;
|
---|
1083 |
|
---|
1084 | try
|
---|
1085 | {
|
---|
1086 | ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
---|
1087 | ImageIO.write(image,"jpg",stream);
|
---|
1088 | byte[] bytes = stream.toByteArray();
|
---|
1089 |
|
---|
1090 | txt = Base64.encodeBytes(bytes);
|
---|
1091 |
|
---|
1092 | }
|
---|
1093 | catch(IOException ex) {}
|
---|
1094 |
|
---|
1095 | return txt;
|
---|
1096 | }
|
---|
1097 |
|
---|
1098 | /**
|
---|
1099 | * This method is to make sure that there is no thread running at the moment.
|
---|
1100 | */
|
---|
1101 | private void ensureEventThread()
|
---|
1102 | {
|
---|
1103 | if(SwingUtilities.isEventDispatchThread())
|
---|
1104 | {
|
---|
1105 | return;
|
---|
1106 | }
|
---|
1107 | throw new RuntimeException(messages.getString("file"));
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | /**
|
---|
1111 | * This method will create all 6 xml files, jarred them into one file, deletes all xml files and
|
---|
1112 | * sending it.
|
---|
1113 | * The xml files for:
|
---|
1114 | * <br> 1.The history & information of all the actions done and windows opened by the application
|
---|
1115 | * after user choose to start the sequence of sending feedback.
|
---|
1116 | * <br> 2.The history of all the commands (actions) done by the user before choosing
|
---|
1117 | * after start the sequence of sending feedback.
|
---|
1118 | * <br> 3.The informations we get from the feedback interface form period.
|
---|
1119 | * <br> will be getting from vector and the temp_feedbackhist.log file.
|
---|
1120 | * (Precondition: (sx != null) && (vector != null) && (err_array != null))
|
---|
1121 | * @param sx the xml parser.
|
---|
1122 | * @param vector the vector that hold the history and information.
|
---|
1123 | * @param err_array the arrays of information we take from the feedback interface period.
|
---|
1124 | * @param imgFile the arrays of information we take from the panels inside feedback interface form.
|
---|
1125 | */
|
---|
1126 | private void sendState (SaveToXML sx,Vector vector,String[] err_array,String[] imgFile)
|
---|
1127 | {
|
---|
1128 | String dirname;
|
---|
1129 | dirname = "xmlfeedback/";
|
---|
1130 |
|
---|
1131 | File dir = new File("xmlfeedback");
|
---|
1132 | if (dir.isDirectory() == false)
|
---|
1133 | dir.mkdir();
|
---|
1134 |
|
---|
1135 | sx.saveFeedback(err_array,imgFile);
|
---|
1136 |
|
---|
1137 | sx.open(dirname + "feedbackcontent" + FeedbackInterface.getCode() + ".xml",
|
---|
1138 | "HISTORY");
|
---|
1139 | SaveToXML sx2;
|
---|
1140 | sx2 = new SaveToXML(messages);
|
---|
1141 | sx2.open(dirname + "feedbackcommand" + FeedbackInterface.getCode() + ".xml",
|
---|
1142 | "COMMANDS");
|
---|
1143 |
|
---|
1144 | for (int i = 0 ; i < vector.size() ; i++)
|
---|
1145 | {
|
---|
1146 | History log;
|
---|
1147 | log = (History) vector.get(i);
|
---|
1148 | log.sendXML(sx);
|
---|
1149 | log.sendXMLComm(sx2);
|
---|
1150 | }
|
---|
1151 |
|
---|
1152 | Vector stack;
|
---|
1153 | stack = getPrev_log();
|
---|
1154 | if (stack != null)
|
---|
1155 | {
|
---|
1156 | for (int i = 0 ; i < stack.size() ; i++)
|
---|
1157 | {
|
---|
1158 | History log;
|
---|
1159 | log = (History) stack.get(i);
|
---|
1160 | log.sendXML(sx);
|
---|
1161 | log.sendXMLComm(sx2);
|
---|
1162 | }
|
---|
1163 | stack.removeAllElements();
|
---|
1164 | System.gc();
|
---|
1165 | stack = null;
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | sx2.close("COMMANDS");
|
---|
1169 | sx.close("HISTORY");
|
---|
1170 |
|
---|
1171 | getHistPrev_log(sx,sx2);
|
---|
1172 |
|
---|
1173 | ZipFile zip;
|
---|
1174 | zip = new ZipFile();
|
---|
1175 | zip.sendZipXMLFile();
|
---|
1176 |
|
---|
1177 | File f;
|
---|
1178 | f = new File (dirname + "feedback" + FeedbackInterface.getCode() + ".xml");
|
---|
1179 | f.delete();
|
---|
1180 | f = new File (dirname + "feedbackcontent" + FeedbackInterface.getCode() + ".xml");
|
---|
1181 | f.delete();
|
---|
1182 | f = new File (dirname + "feedbackcommand" + FeedbackInterface.getCode() + ".xml");
|
---|
1183 | f.delete();
|
---|
1184 | /*f = new File (dirname + "content" + FeedbackInterface.getCode() + ".xml");
|
---|
1185 | f.delete();*/
|
---|
1186 | f = new File (dirname + "command" + FeedbackInterface.getCode() + ".xml");
|
---|
1187 | f.delete();
|
---|
1188 |
|
---|
1189 | String[] args = new String[5];
|
---|
1190 | args[0] = "[email protected]";
|
---|
1191 | args[1] = dirname + "Jar" + FeedbackInterface.getCode() + "File.jar";
|
---|
1192 | args[4] = "lib/parser.jar";
|
---|
1193 | args[2] = err_array[19];
|
---|
1194 | args[3] = err_array[20];
|
---|
1195 | SendHTTP sm = new SendHTTP();
|
---|
1196 | //SendMail sm = new SendMail();
|
---|
1197 | sm.sendMail(args,messages,FeedbackInterface.getCode());
|
---|
1198 | }
|
---|
1199 |
|
---|
1200 | /**
|
---|
1201 | * This method will create the 2 xml files.
|
---|
1202 | * The xml files are:
|
---|
1203 | * <br> 1.The history & information of all the actions done and windows opened by the application
|
---|
1204 | * before user choose to start the sequence of sending feedback.
|
---|
1205 | * <br> 2.The history of all the commands (actions) done by the user before choosing
|
---|
1206 | * to start the sequence of sending feedback.
|
---|
1207 | * <br> The information will be getting from history.log file and the temp_history.log file.
|
---|
1208 | * (Precondition: (sx != null) && (sx2 != null))
|
---|
1209 | * @param sx the xml parser for the history xml file.
|
---|
1210 | * @param sx2 the xml parser for the command xml file.
|
---|
1211 | */
|
---|
1212 | private void getHistPrev_log(SaveToXML sx,SaveToXML sx2)
|
---|
1213 | {
|
---|
1214 | Vector stack = null;
|
---|
1215 | try
|
---|
1216 | {
|
---|
1217 | File f = new File("history.log");
|
---|
1218 | if (f.exists() == true)
|
---|
1219 | {
|
---|
1220 | FileInputStream fis = new FileInputStream(f);
|
---|
1221 | ObjectInputStream ois = new ObjectInputStream(fis);
|
---|
1222 |
|
---|
1223 | stack = (Vector) ois.readObject();
|
---|
1224 |
|
---|
1225 | String dirname;
|
---|
1226 | dirname = "xmlfeedback/";
|
---|
1227 |
|
---|
1228 | /*sx.open(dirname + "content" + FeedbackInterface.getCode() + ".xml",
|
---|
1229 | "HISTORY");*/
|
---|
1230 | sx2.open(dirname + "command" + FeedbackInterface.getCode() + ".xml",
|
---|
1231 | "COMMANDS");
|
---|
1232 |
|
---|
1233 | if (stack != null)
|
---|
1234 | {
|
---|
1235 | for (int i = 0 ; i < stack.size() ; i++)
|
---|
1236 | {
|
---|
1237 | History log;
|
---|
1238 | log = (History) stack.get(i);
|
---|
1239 | //log.sendXML(sx);
|
---|
1240 | log.sendXMLComm(sx2);
|
---|
1241 | }
|
---|
1242 | stack.removeAllElements();
|
---|
1243 | System.gc();
|
---|
1244 | stack = null;
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | stack = (Vector) ois.readObject();
|
---|
1248 |
|
---|
1249 | if (stack != null)
|
---|
1250 | {
|
---|
1251 | for (int i = 0 ; i < stack.size() ; i++)
|
---|
1252 | {
|
---|
1253 | History log;
|
---|
1254 | log = (History) stack.get(i);
|
---|
1255 | //log.sendXML(sx);
|
---|
1256 | log.sendXMLComm(sx2);
|
---|
1257 | }
|
---|
1258 | stack.removeAllElements();
|
---|
1259 | System.gc();
|
---|
1260 | stack = null;
|
---|
1261 | }
|
---|
1262 |
|
---|
1263 | sx2.close("COMMANDS");
|
---|
1264 | //sx.close("HISTORY");
|
---|
1265 |
|
---|
1266 | ois.close();
|
---|
1267 | }
|
---|
1268 | }
|
---|
1269 | catch (IOException exp) {exp.printStackTrace();}
|
---|
1270 | catch (ClassNotFoundException exp2)
|
---|
1271 | {
|
---|
1272 | System.out.println("class exp");}
|
---|
1273 | }
|
---|
1274 |
|
---|
1275 | /**
|
---|
1276 | * This method will get the Vector stored in temp_feedbackhist.log file.
|
---|
1277 | * @return the vector stored in temp_feedbackhist.log file.
|
---|
1278 | */
|
---|
1279 | public Vector getPrev_log()
|
---|
1280 | {
|
---|
1281 | Vector stack = null;
|
---|
1282 | try
|
---|
1283 | {
|
---|
1284 | File f = new File("temp_feedbackhist.log");
|
---|
1285 | if (f.exists() == true)
|
---|
1286 | {
|
---|
1287 | FileInputStream fis = new FileInputStream(f);
|
---|
1288 | ObjectInputStream ois = new ObjectInputStream(fis);
|
---|
1289 | stack = (Vector) ois.readObject();
|
---|
1290 | ois.close();
|
---|
1291 | return stack;
|
---|
1292 | }
|
---|
1293 | else
|
---|
1294 | stack = null;
|
---|
1295 | }
|
---|
1296 | catch (IOException exp) {exp.printStackTrace();}
|
---|
1297 | catch (ClassNotFoundException exp2)
|
---|
1298 | {
|
---|
1299 | System.out.println("class exp");}
|
---|
1300 |
|
---|
1301 | return stack;
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | /**
|
---|
1305 | * This is the thread that will start when user click send button and it will
|
---|
1306 | * make 6 xml files,jarred them together into 1 jar file, deletes the 6 xml files and send it.
|
---|
1307 | * @param vector the vector stored the current actions history.
|
---|
1308 | * @param err_array the array that stored all the information took during feedback interface period.
|
---|
1309 | * @param imgFile the array of that stored all the information from all the panels inside feedback interface form.
|
---|
1310 | */
|
---|
1311 | public void sendMethod (final Vector vector,final String err_array[], final String imgFile[])
|
---|
1312 | {
|
---|
1313 | ensureEventThread();
|
---|
1314 | Runnable sendRun;
|
---|
1315 | sendRun = new Runnable()
|
---|
1316 | {
|
---|
1317 | public void run ()
|
---|
1318 | {
|
---|
1319 | finish = false;
|
---|
1320 | selected = true;
|
---|
1321 | SaveToXML sx;
|
---|
1322 | sx = new SaveToXML(messages);
|
---|
1323 | sendState(sx,vector,err_array,imgFile);
|
---|
1324 | finish = true;
|
---|
1325 | }
|
---|
1326 | };
|
---|
1327 | sendThread = new Thread(sendRun);
|
---|
1328 | sendThread.start();
|
---|
1329 | }
|
---|
1330 |
|
---|
1331 | /**
|
---|
1332 | * This method will called the window that will display the preview of all
|
---|
1333 | * the file going to be send.
|
---|
1334 | * @param vector the vector stored the current actions history.
|
---|
1335 | * @param err_array the array that stored all the information took during feedback interface period.
|
---|
1336 | * @param imgFile the array of that stored all the information from all the panels inside feedback interface form.
|
---|
1337 | */
|
---|
1338 | public void viewMethod (final Vector vector,final String err_array[], final String imgFile[])
|
---|
1339 | {
|
---|
1340 | ensureEventThread();
|
---|
1341 | Runnable prevRun;
|
---|
1342 | prevRun = new Runnable()
|
---|
1343 | {
|
---|
1344 | public void run ()
|
---|
1345 | {
|
---|
1346 | finish = false;
|
---|
1347 | selected = false;
|
---|
1348 | ReportDetails rd;
|
---|
1349 | rd = new ReportDetails(vector,err_array,imgFile,messages,true);
|
---|
1350 | finish = true;
|
---|
1351 | }
|
---|
1352 | };
|
---|
1353 |
|
---|
1354 | prevThread = new Thread(prevRun);
|
---|
1355 | prevThread.start();
|
---|
1356 | }
|
---|
1357 |
|
---|
1358 | /**
|
---|
1359 | * This method will save a BufferedImage to a jpeg file with the specified filename.
|
---|
1360 | * This method is a thread that will caused the thread save to be started and stop
|
---|
1361 | * if the saving process is finished.
|
---|
1362 | * (Precondition: (I != null))
|
---|
1363 | * @param I is the BufferedImage that we want to save.
|
---|
1364 | * @param picScreen name of the jpeg file where we want to store the BufferedImage
|
---|
1365 | */
|
---|
1366 | public void saveGraph(final BufferedImage I,final String picScreen)
|
---|
1367 | {
|
---|
1368 | ensureEventThread();
|
---|
1369 | Runnable saveRun;
|
---|
1370 | saveRun = new Runnable ()
|
---|
1371 | {
|
---|
1372 | public void run()
|
---|
1373 | {
|
---|
1374 | try
|
---|
1375 | {
|
---|
1376 | File file;
|
---|
1377 | file = new File(picScreen);
|
---|
1378 | ImageIO.write(I, "jpg", file);
|
---|
1379 | save = null;
|
---|
1380 | }
|
---|
1381 | catch (Exception ex) {}
|
---|
1382 | }
|
---|
1383 | };
|
---|
1384 |
|
---|
1385 | save = new Thread(saveRun);
|
---|
1386 | save.start();
|
---|
1387 | }
|
---|
1388 |
|
---|
1389 | /**
|
---|
1390 | * This method will get all the informations from the all the panels inside the feedback interface form.
|
---|
1391 | * @return the arrays of information from all the panels.
|
---|
1392 | */
|
---|
1393 | public String[] getimgFile()
|
---|
1394 | {
|
---|
1395 | String[] imgFile;
|
---|
1396 | imgFile = null;
|
---|
1397 |
|
---|
1398 | /*String answer;
|
---|
1399 | answer = (String) problem_screenshot.getSelectedItem();
|
---|
1400 | if(answer == messages.getString("Yes"))
|
---|
1401 | {*/
|
---|
1402 |
|
---|
1403 | if (paneArray.size() > 0)
|
---|
1404 | {
|
---|
1405 | imgFile = new String[(paneArray.size() * 10)];
|
---|
1406 |
|
---|
1407 | int step;
|
---|
1408 | for (step = 0 ; step < (paneArray.size()*10) ; step=step+10)
|
---|
1409 | {
|
---|
1410 | JPanel pane;
|
---|
1411 | ThumbnailPic obj;
|
---|
1412 | pane = (JPanel) paneArray.get((step/10));
|
---|
1413 | obj = (ThumbnailPic) picAndPane.get(pane);
|
---|
1414 |
|
---|
1415 | //obj.setSize();
|
---|
1416 |
|
---|
1417 | String title;
|
---|
1418 | title = obj.getTitles();
|
---|
1419 |
|
---|
1420 | imgFile[step+0] = title;
|
---|
1421 | imgFile[step+1] = obj.getScreenImage();
|
---|
1422 | title = "Window" + pane.hashCode() + "File";
|
---|
1423 | imgFile[step+2] = messages.getString("screen")+title+step+".jpg";
|
---|
1424 | imgFile[step+3] = obj.getScreenAndLineImage();
|
---|
1425 | imgFile[step+4] = messages.getString("ErrorLineAnd")+imgFile[step+2];
|
---|
1426 | imgFile[step+5] = obj.getLineForScreenImage();
|
---|
1427 | imgFile[step+6] = messages.getString("ErrorLineFor")+imgFile[step+2];
|
---|
1428 | imgFile[step+7] = obj.getWidth();
|
---|
1429 | imgFile[step+8] = obj.getHeight();
|
---|
1430 | imgFile[step+9] = obj.getProblemDetails();
|
---|
1431 | }
|
---|
1432 | }
|
---|
1433 |
|
---|
1434 | return imgFile;
|
---|
1435 | }
|
---|
1436 |
|
---|
1437 | /**
|
---|
1438 | * This method will get all the informations taken during feedback interface period, such as os version.
|
---|
1439 | * @return then arrays of informations.
|
---|
1440 | */
|
---|
1441 | public String[] geterr_array()
|
---|
1442 | {
|
---|
1443 | String[] err_array;
|
---|
1444 | err_array = null;
|
---|
1445 |
|
---|
1446 | String os_name;
|
---|
1447 | os_name = System.getProperty("os.name") + " " + System.getProperty("os.version")
|
---|
1448 | + " " + System.getProperty("os.arch");
|
---|
1449 |
|
---|
1450 | Date problem_date;
|
---|
1451 | String err_date,java_info,screen_res;
|
---|
1452 | problem_date = new Date();
|
---|
1453 | err_date = problem_date.toString();
|
---|
1454 | java_info = System.getProperty("java.vendor")+ " " + System.getProperty("java.class.version");
|
---|
1455 | Dimension dim;
|
---|
1456 | dim = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
1457 | screen_res = "" + dim.width + "x" + dim.height;
|
---|
1458 |
|
---|
1459 | try
|
---|
1460 | {
|
---|
1461 | err_array = new String[24];
|
---|
1462 |
|
---|
1463 | err_array[0] = code;
|
---|
1464 | err_array[1] = frameName;
|
---|
1465 | err_array[2] = "";
|
---|
1466 | err_array[3] = (String) problem_type.getSelectedItem();
|
---|
1467 | err_array[4] = (String) problem_urgency.getSelectedItem();
|
---|
1468 | err_array[5] = System.getProperty("user.name");
|
---|
1469 | err_array[6] = System.getProperty("user.home");
|
---|
1470 | err_array[7] = System.getProperty("user.dir");
|
---|
1471 | err_array[8] = curr_date.toString();
|
---|
1472 | err_array[9] = err_date;
|
---|
1473 | err_array[10] = os_name;
|
---|
1474 | err_array[11] = java_info;
|
---|
1475 | err_array[12] = "" + Locale.getDefault();
|
---|
1476 | err_array[13] = Gatherer.PROGRAM_NAME + " " + Gatherer.PROGRAM_VERSION;
|
---|
1477 | err_array[14] = InetAddress.getLocalHost().getHostName();
|
---|
1478 | err_array[15] = InetAddress.getLocalHost().getHostAddress();
|
---|
1479 | err_array[16] = screen_res;
|
---|
1480 | err_array[17] = "";
|
---|
1481 |
|
---|
1482 | /*String test_txt;
|
---|
1483 | test_txt = smtp_address.getText();
|
---|
1484 | if ((test_txt == null)||(test_txt.length() < 5))*/
|
---|
1485 | err_array[19] = "mail.waikato.ac.nz";
|
---|
1486 | /*else
|
---|
1487 | err_array[19] = test_txt;
|
---|
1488 |
|
---|
1489 | test_txt = email_address.getText();
|
---|
1490 | if ((test_txt == null)||(test_txt.length() < 5))*/
|
---|
1491 | err_array[20] = "[email protected]";
|
---|
1492 | //else
|
---|
1493 | //err_array[20] = test_txt;
|
---|
1494 |
|
---|
1495 | Runtime run;
|
---|
1496 | run = Runtime.getRuntime();
|
---|
1497 | err_array[21] = formatFileSize(run.totalMemory());
|
---|
1498 | err_array[22] = formatFileSize(run.maxMemory());
|
---|
1499 | err_array[23] = formatFileSize(run.freeMemory());
|
---|
1500 | }
|
---|
1501 | catch(UnknownHostException exp) {}
|
---|
1502 |
|
---|
1503 | return err_array;
|
---|
1504 | }
|
---|
1505 |
|
---|
1506 | /**
|
---|
1507 | * This method will format the file size given into more elegant form,e.g. 2KB
|
---|
1508 | * @param length the file size.
|
---|
1509 | * @return the more elegant string representations of the file size.
|
---|
1510 | */
|
---|
1511 | public String formatFileSize(long length)
|
---|
1512 | {
|
---|
1513 | String BYTE_SUFFIX;
|
---|
1514 | BYTE_SUFFIX = " B";
|
---|
1515 | long GIGABYTE;
|
---|
1516 | GIGABYTE = 1024000000l;
|
---|
1517 | String GIGABYTE_SUFFIX;
|
---|
1518 | GIGABYTE_SUFFIX = " GB";
|
---|
1519 | long KILOBYTE;
|
---|
1520 | KILOBYTE = 1024l;
|
---|
1521 | String KILOBYTE_SUFFIX;
|
---|
1522 | KILOBYTE_SUFFIX = " KB";
|
---|
1523 | long MEGABYTE;
|
---|
1524 | MEGABYTE = 1024000l;
|
---|
1525 | String MEGABYTE_SUFFIX;
|
---|
1526 | MEGABYTE_SUFFIX = " MB";
|
---|
1527 |
|
---|
1528 | StringBuffer result;
|
---|
1529 | result = new StringBuffer("");
|
---|
1530 | float number;
|
---|
1531 | number = 0f;
|
---|
1532 | String suffix;
|
---|
1533 | suffix = null;
|
---|
1534 |
|
---|
1535 | if(length >= GIGABYTE)
|
---|
1536 | {
|
---|
1537 | number = (float) length / (float) GIGABYTE;
|
---|
1538 | suffix = GIGABYTE_SUFFIX;
|
---|
1539 | }
|
---|
1540 | else if(length >= MEGABYTE)
|
---|
1541 | {
|
---|
1542 | number = (float) length / (float) MEGABYTE;
|
---|
1543 | suffix = MEGABYTE_SUFFIX;
|
---|
1544 | }
|
---|
1545 | else if(length >= KILOBYTE)
|
---|
1546 | {
|
---|
1547 | number = (float) length / (float) KILOBYTE;
|
---|
1548 | suffix = KILOBYTE_SUFFIX;
|
---|
1549 | }
|
---|
1550 | else
|
---|
1551 | {
|
---|
1552 | return length + BYTE_SUFFIX;
|
---|
1553 | }
|
---|
1554 |
|
---|
1555 | String number_str;
|
---|
1556 | number_str = Float.toString(number);
|
---|
1557 | char number_char[] = number_str.toCharArray();
|
---|
1558 | int pos,i;
|
---|
1559 | pos = 0;
|
---|
1560 |
|
---|
1561 | while(number_char != null && pos < number_char.length && number_char[pos] != '.')
|
---|
1562 | {
|
---|
1563 | result.append(number_char[pos]);
|
---|
1564 | pos++;
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | if(pos < number_char.length)
|
---|
1568 | {
|
---|
1569 | result.append(number_char[pos]);
|
---|
1570 | pos++;
|
---|
1571 |
|
---|
1572 | for(i = 0; i < 2 && pos < number_char.length; i++, pos++)
|
---|
1573 | result.append(number_char[pos]);
|
---|
1574 |
|
---|
1575 | while(pos < number_char.length && number_char[pos] != 'E')
|
---|
1576 | pos++;
|
---|
1577 |
|
---|
1578 | while(pos < number_char.length)
|
---|
1579 | {
|
---|
1580 | result.append(number_char[pos]);
|
---|
1581 | pos++;
|
---|
1582 | }
|
---|
1583 | }
|
---|
1584 |
|
---|
1585 | result.append(suffix);
|
---|
1586 |
|
---|
1587 | return result.toString();
|
---|
1588 | }
|
---|
1589 |
|
---|
1590 | /**
|
---|
1591 | * This method will decide what action should be done if the user entered a button in
|
---|
1592 | * the Feedback form.
|
---|
1593 | * <br>If user click cancel button then all the information taken in this form will be deleted
|
---|
1594 | * and user will be quitted from the Reporting Feedback sequence.
|
---|
1595 | * <br>If user click the send button then all the information taken will be stored in array which
|
---|
1596 | * then will be saved into xml files and sent when user confirm to send all the files.
|
---|
1597 | * <br>If user click the details button then they can view all the xml files that are going to be send.
|
---|
1598 | * @param e the button that user clicked
|
---|
1599 | */
|
---|
1600 | public void actionPerformed (ActionEvent e)
|
---|
1601 | {
|
---|
1602 | getPrevData();
|
---|
1603 |
|
---|
1604 | if(messages.getString("Send").equals(e.getActionCommand()))
|
---|
1605 | {
|
---|
1606 | String[] imgFile;
|
---|
1607 | String[] err_array;
|
---|
1608 |
|
---|
1609 | imgFile = getimgFile();
|
---|
1610 | err_array = geterr_array();
|
---|
1611 |
|
---|
1612 | timer.start();
|
---|
1613 |
|
---|
1614 | sendMethod(dialog.getVector(),err_array,imgFile);
|
---|
1615 | }
|
---|
1616 |
|
---|
1617 | if(messages.getString("Preview").equals(e.getActionCommand()))
|
---|
1618 | {
|
---|
1619 | String[] imgFile;
|
---|
1620 | String[] err_array;
|
---|
1621 |
|
---|
1622 | imgFile = getimgFile();
|
---|
1623 | err_array = geterr_array();
|
---|
1624 |
|
---|
1625 | timer.start();
|
---|
1626 |
|
---|
1627 | viewMethod(dialog.getVector(),err_array,imgFile);
|
---|
1628 | }
|
---|
1629 |
|
---|
1630 | if(messages.getString("NotSend").equals(e.getActionCommand()))
|
---|
1631 | {
|
---|
1632 | dispose();
|
---|
1633 | }
|
---|
1634 | }
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 |
|
---|
1638 |
|
---|
1639 |
|
---|
1640 |
|
---|
1641 |
|
---|
1642 |
|
---|
1643 |
|
---|
1644 |
|
---|
1645 |
|
---|