[33053] | 1 | package org.greenstone.gatherer.feedback;
|
---|
| 2 |
|
---|
| 3 | import javax.swing.*;
|
---|
| 4 |
|
---|
| 5 | import java.awt.*;
|
---|
| 6 | import java.awt.event.*;
|
---|
| 7 | import java.util.*;
|
---|
| 8 |
|
---|
| 9 | import javax.swing.tree.*;
|
---|
| 10 | import javax.swing.event.*;
|
---|
| 11 |
|
---|
| 12 | import java.io.*;
|
---|
| 13 | import java.awt.image.*;
|
---|
| 14 | import java.util.Locale;
|
---|
| 15 | import java.util.ResourceBundle;
|
---|
| 16 |
|
---|
| 17 | import org.greenstone.gatherer.util.JarTools;
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * This is the special class listener.
|
---|
| 21 | * <p>This class will record all the action did to any of the
|
---|
| 22 | * component inside the window that were open by the application.
|
---|
| 23 | * <br> This listener will start listening since the beginning of the application
|
---|
| 24 | * until the user quits from the application. It will record :
|
---|
| 25 | * <br>1. All the information about the window and its components where the action occured.
|
---|
| 26 | * <br>2. All the information about all windows and its components that were open when the action occured.
|
---|
| 27 | * <br>Note : point 1 and 2 only start when user wants to send feedback.
|
---|
| 28 | * <br>3. The action's command the user did.
|
---|
| 29 | * <br>4. The date of when the action occured.
|
---|
| 30 | * <br><br>The history of the action will be stored in history.log file, which then will be compressed
|
---|
| 31 | * to a zip file called MyZipFile.zip.</p>
|
---|
| 32 | * <p>The listener this class implements are only the listener interface that a javax.swing.* component
|
---|
| 33 | * could have as stated in API.Some of the listener however is not implemented here as it is considered the event
|
---|
| 34 | * listened by those listener are not essential to be recorded as they not making any major changes
|
---|
| 35 | * to the application.</p>
|
---|
| 36 | * <p>This listener will only record maximum last 60 instructions user did to the application.</p>
|
---|
| 37 | * <p>In this class also we can add some stuff globally through out all the window open by
|
---|
| 38 | * the application.
|
---|
| 39 | * <br>This is the class will add a menu called Feedback through out all the window of type JFrame or JDialog
|
---|
| 40 | * open by the application.This menu will allow user to either sending feedback or viewing the history
|
---|
| 41 | * of all the action user did so far.
|
---|
| 42 | * @author Veronica Liesaputra
|
---|
| 43 | */
|
---|
| 44 | public class ActionRecorderDialog
|
---|
| 45 | implements ActionListener,TreeModelListener,ItemListener,ListDataListener,ChangeListener,
|
---|
| 46 | ListSelectionListener,MenuListener,TableColumnModelListener,TreeSelectionListener
|
---|
| 47 | {
|
---|
| 48 | /**
|
---|
| 49 | * This hold the title of the window where the action occured.
|
---|
| 50 | */
|
---|
| 51 | private String myframe;
|
---|
| 52 |
|
---|
| 53 | /**
|
---|
| 54 | * This hold the title of the window where user called send feedback.
|
---|
| 55 | */
|
---|
| 56 | private String feedbackframe;
|
---|
| 57 |
|
---|
| 58 | /**
|
---|
| 59 | * This hold the instance of ComponentInformation to get all the information inside a window.
|
---|
| 60 | */
|
---|
| 61 | private ComponentInformation compInfo;
|
---|
| 62 |
|
---|
| 63 | /**
|
---|
| 64 | * This will hold a record of the action that user just did at the moment.
|
---|
| 65 | */
|
---|
| 66 | private History log;
|
---|
| 67 |
|
---|
| 68 | /**
|
---|
| 69 | * This will reference to the window where the action occured.
|
---|
| 70 | */
|
---|
| 71 | private Window point;
|
---|
| 72 |
|
---|
| 73 | /**
|
---|
| 74 | * This hold the vector of all the History instances of all the record of action user did
|
---|
| 75 | * so far.
|
---|
| 76 | * This vector will hold the history of all the 30 actions user just did.
|
---|
| 77 | * There are 2 situation for this vector :
|
---|
| 78 | * <br>1. Before user choose to send feedback.
|
---|
| 79 | * <br>Here, If we want to add another record to the vector when the vector size already 30 then,
|
---|
| 80 | * all the 30 records inside the vector will be saved in the temp_history.log file. The vector will
|
---|
| 81 | * be cleared and then added with the new record.
|
---|
| 82 | * <br>If the user quits the application, then whats in the vector will be saved to history.log file.
|
---|
| 83 | * <br>2. After user choose to send feedback.
|
---|
| 84 | * <br>When user choose to send feedback,then what happen is what ever inside the vector at the moment
|
---|
| 85 | * will be saved to history.log file and then vector will be cleared and it will add the new instruction.
|
---|
| 86 | * <br> If we want to add another record to the vector when the vector size already 30 then,
|
---|
| 87 | * all the 30 records inside the vector will be saved in the temp_feedbackhist.log file. The vector will
|
---|
| 88 | * be cleared and then added with the new record.
|
---|
| 89 | * <br> If the user finished with the feedback then it will cleared all the vector and load the vector
|
---|
| 90 | * inside the history.log to it and add the new record to the vector.
|
---|
| 91 | * <br> If the user quits the application, then whats in the vector will not be saved.
|
---|
| 92 | */
|
---|
| 93 | @SuppressWarnings("rawtypes")
|
---|
| 94 | private static Vector vector;
|
---|
| 95 |
|
---|
| 96 | /**
|
---|
| 97 | * This is the flag to tell whether or not the image for the window where the action occured is
|
---|
| 98 | * finished being added properly to the appropriate record.
|
---|
| 99 | * If savefinish = true then it means that the thread of adding image to the record stop, otherwise
|
---|
| 100 | * it means its not yet finished so don't stop the thread.
|
---|
| 101 | */
|
---|
| 102 | private static boolean savefinish = true;
|
---|
| 103 |
|
---|
| 104 | /**
|
---|
| 105 | * This is the thread that contains all the code that the application should be when the user exiting
|
---|
| 106 | * the application.
|
---|
| 107 | */
|
---|
| 108 | private Thread writeThread;
|
---|
| 109 |
|
---|
| 110 | /**
|
---|
| 111 | * This is the runtime of this application.
|
---|
| 112 | */
|
---|
| 113 | private Runtime run;
|
---|
| 114 |
|
---|
| 115 | /**
|
---|
| 116 | * This variable will hold the resource of the words that is stored in feedback.properties file.
|
---|
| 117 | * The calling using messages.getString(someString) will caused someString to be translated
|
---|
| 118 | * into some other string that is hold in that file.usually it will caused it to be translated
|
---|
| 119 | * to the language that the user use or choose to have as stated in Locale.
|
---|
| 120 | */
|
---|
| 121 | private static ResourceBundle messages;
|
---|
| 122 |
|
---|
| 123 | /**
|
---|
| 124 | * This is an instance of ScreenShot that will allow this application to take screen shot of the whole
|
---|
| 125 | * screen or just the screen shot of the window where the actions occured.
|
---|
| 126 | */
|
---|
| 127 | private ScreenShot sh;
|
---|
| 128 |
|
---|
| 129 | /**
|
---|
| 130 | * This HashMap stored the pair of model and its component.
|
---|
| 131 | * This will allow this listener to know which component the model where the actions occured belongs to.
|
---|
| 132 | */
|
---|
| 133 | @SuppressWarnings("rawtypes")
|
---|
| 134 | private HashMap modelHash;
|
---|
| 135 |
|
---|
| 136 | /**
|
---|
| 137 | * This is the flag variable to sign that the user start the Reporting Feedback sequence.
|
---|
| 138 | * If start_rec = false means that the user did not start reporting feedback sequence.
|
---|
| 139 | * Otherwise, it means the user start reporting feedback sequence, here there will be changes in the
|
---|
| 140 | * content of the vector used to save all the records.This also will change the appearance of the
|
---|
| 141 | * window that are currently open by the application. it will make toolbar value = true, rec = true and
|
---|
| 142 | * stop_rec = false.
|
---|
| 143 | */
|
---|
| 144 | private boolean start_rec = false;
|
---|
| 145 |
|
---|
| 146 | /**
|
---|
| 147 | * This is the flag variable to sign that the user are now recording the Reporting Feedback sequence.
|
---|
| 148 | * If rec = true, it means its recording, otherwise its false.It also will decide
|
---|
| 149 | * the GUI appearance of the window that are currently open by the application.
|
---|
| 150 | */
|
---|
| 151 | private boolean rec = false;
|
---|
| 152 |
|
---|
| 153 | /**
|
---|
| 154 | * This is the flag variable to sign that user are finished the Reporting Feedback sequence.
|
---|
| 155 | * If stop_rec = false, then it means user stop the Reporting Feedback sequence.So here, there will
|
---|
| 156 | * be changes in the vector's content. If rec = true then it will also delete the added toolbar on the currently open
|
---|
| 157 | * window by the application and its also will delete all the history and file taken when user doing the
|
---|
| 158 | * Reporting Feedback sequence.
|
---|
| 159 | */
|
---|
| 160 | private boolean stop_rec = true;
|
---|
| 161 |
|
---|
| 162 | /**
|
---|
| 163 | * This is the thread do task to take history of the actions.
|
---|
| 164 | */
|
---|
| 165 | private Thread saveallThread;
|
---|
| 166 |
|
---|
| 167 | /**
|
---|
| 168 | * This is the flag to say whether or not the send feedback button been pushed by user.
|
---|
| 169 | */
|
---|
| 170 | private boolean start_fd = false;
|
---|
| 171 |
|
---|
| 172 | /**
|
---|
| 173 | * This is a blocker to say that user cannot do anything while we taking history.
|
---|
| 174 | */
|
---|
| 175 | private MouseListener mouse_blocker_listener = new MouseAdapter() {};
|
---|
| 176 |
|
---|
| 177 | /**
|
---|
| 178 | * This is the feedback interface window.
|
---|
| 179 | */
|
---|
| 180 | private FeedbackInterface frame;
|
---|
| 181 |
|
---|
| 182 | /**
|
---|
| 183 | * This is an instance of CompListener that will add listener to all the components inside it.
|
---|
| 184 | */
|
---|
| 185 | private CompListener compList;
|
---|
| 186 |
|
---|
| 187 | /**
|
---|
| 188 | * This is the accelerator key (shortcuts key) for taking screenshot.
|
---|
| 189 | */
|
---|
| 190 | private KeyStroke shKey;
|
---|
| 191 |
|
---|
| 192 | /**
|
---|
| 193 | * This is the accelerator key (shortcuts key) for reporting feedback.
|
---|
| 194 | */
|
---|
| 195 | private KeyStroke fdKey;
|
---|
| 196 |
|
---|
| 197 | /**
|
---|
| 198 | * This is the accelerator key (shortcuts key) for viewing history.
|
---|
| 199 | */
|
---|
| 200 | private KeyStroke histKey;
|
---|
| 201 |
|
---|
| 202 | /**
|
---|
| 203 | * This is the accelerator key (shortcuts key) for sending feedback straight away.
|
---|
| 204 | */
|
---|
| 205 | private KeyStroke sndfdKey;
|
---|
| 206 |
|
---|
| 207 | /**
|
---|
| 208 | * This is the modal window where user wants to take the screeshot or sending feedback.
|
---|
| 209 | */
|
---|
| 210 | private Window modalWindow;
|
---|
| 211 |
|
---|
| 212 | /**
|
---|
| 213 | * This constructor will seeting up the data member to its appropriate value.
|
---|
| 214 | * It will get the vector that are stored in the history.log file and also it will
|
---|
| 215 | * setup the writeThread.
|
---|
| 216 | * @param currentLocale is the locale user choose all the text to be displayed as.
|
---|
| 217 | */
|
---|
| 218 | @SuppressWarnings("rawtypes")
|
---|
| 219 | public ActionRecorderDialog (Locale currentLocale)
|
---|
| 220 | {
|
---|
| 221 | messages = ResourceBundle.getBundle("feedback",currentLocale);
|
---|
| 222 | setup_UIManager();
|
---|
| 223 |
|
---|
| 224 | fdKey = KeyStroke.getKeyStroke("F2");
|
---|
| 225 | histKey = KeyStroke.getKeyStroke("F3");
|
---|
| 226 | shKey = KeyStroke.getKeyStroke("F5");
|
---|
| 227 | sndfdKey = KeyStroke.getKeyStroke("F12");
|
---|
| 228 | /*shKey = KeyStroke.getKeyStroke(KeyEvent.VK_SLASH,InputEvent.CTRL_MASK|
|
---|
| 229 | InputEvent.SHIFT_MASK);*/
|
---|
| 230 |
|
---|
| 231 | final ZipFile zip;
|
---|
| 232 | zip = new ZipFile();
|
---|
| 233 | zip.unZipFile();
|
---|
| 234 | vector = getPrev_log("history.log");
|
---|
| 235 | sh = new ScreenShot();
|
---|
| 236 | modelHash = new HashMap();
|
---|
| 237 | compInfo = new ComponentInformation(this,currentLocale,modelHash);
|
---|
| 238 | compList = new CompListener(this,modelHash);
|
---|
| 239 | EventQueue eq;
|
---|
| 240 | eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
|
---|
| 241 | eq.push(new MyEventQueue());
|
---|
| 242 | run = Runtime.getRuntime();
|
---|
| 243 | Runnable writeRun;
|
---|
| 244 | writeRun = new Runnable()
|
---|
| 245 | {
|
---|
| 246 | public void run()
|
---|
| 247 | {
|
---|
| 248 | try
|
---|
| 249 | {
|
---|
| 250 | if (stop_rec == true)
|
---|
| 251 | {
|
---|
| 252 | File f;
|
---|
| 253 | f = new File("history.log");
|
---|
| 254 | FileOutputStream fos;
|
---|
| 255 | fos = new FileOutputStream("history.log");
|
---|
| 256 | ObjectOutputStream oos;
|
---|
| 257 | oos = new ObjectOutputStream(fos);
|
---|
| 258 | oos.writeObject(vector);
|
---|
| 259 | vector.removeAllElements();
|
---|
| 260 | vector = getPrev_log("temp_history.log");
|
---|
| 261 | oos.writeObject(vector);
|
---|
| 262 | oos.close();
|
---|
| 263 | f = new File("temp_history.log");
|
---|
| 264 | f.delete();
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 | File f2;
|
---|
| 268 | f2 = new File("feedbackhist.log");
|
---|
| 269 | f2.delete();
|
---|
| 270 | f2 = new File("temp_feedbackhist.log");
|
---|
| 271 | f2.delete();
|
---|
| 272 |
|
---|
| 273 | zip.sendZipFile();
|
---|
| 274 | writeThread = null;
|
---|
| 275 | }
|
---|
| 276 | catch (IOException exp) {}
|
---|
| 277 | }
|
---|
| 278 | };
|
---|
| 279 |
|
---|
| 280 | writeThread = new Thread(writeRun);
|
---|
| 281 | run.addShutdownHook(writeThread);
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | /** change the locale for the resource bundle*/
|
---|
| 285 | public void setLocale(Locale loc) {
|
---|
| 286 | messages = ResourceBundle.getBundle("feedback",loc);
|
---|
| 287 | }
|
---|
| 288 | /**
|
---|
| 289 | * This method will setup some of the GUI appearance that window should have when the user
|
---|
| 290 | * choose to start the Reporting Feedback sequence.
|
---|
| 291 | */
|
---|
| 292 | public void setup_UIManager ()
|
---|
| 293 | {
|
---|
| 294 | // why do you do all this???
|
---|
| 295 | //UIManager.put("TabbedPane.selected",(new Color(224,240,224)));
|
---|
| 296 | //UIManager.put("Button.select",(new Color(224,240,224)));
|
---|
| 297 | //UIManager.put("ScrollBar.background",(new Color(176,208,176)));
|
---|
| 298 | //UIManager.put("ScrollBar.highlight",(new Color(224,240,224)));
|
---|
| 299 | //UIManager.put("ScrollBar.thumb",(new Color(224,240,224)));
|
---|
| 300 | //UIManager.put("ScrollBar.track",(new Color(224,240,224)));
|
---|
| 301 | //UIManager.put("Tree.textBackground",new Color(224,240,224));
|
---|
| 302 | //UIManager.put("Label.font",new Font("Dialog",Font.PLAIN,12));
|
---|
| 303 | //UIManager.put("ComboBox.font",new Font("Dialog",Font.PLAIN,12));
|
---|
| 304 | //UIManager.put("TextArea.font",new Font("Dialog",Font.PLAIN,12));
|
---|
| 305 | }
|
---|
| 306 |
|
---|
| 307 | /**
|
---|
| 308 | * This method will get the information about all the components inside the window that are
|
---|
| 309 | * open by the application when the action occured and save it to vector.
|
---|
| 310 | * @param comp its the component where the user did the action.
|
---|
| 311 | * @param command its the action's command the user did.
|
---|
| 312 | */
|
---|
| 313 | private void saving (final Component comp,final String command)
|
---|
| 314 | {
|
---|
| 315 | if ((command.equals(messages.getString("SendFeedback"))) ||
|
---|
| 316 | ((command.equals("FastSend")) && (stop_rec == false)))
|
---|
| 317 | {
|
---|
| 318 | start_fd = true;
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | Runnable saveall;
|
---|
| 322 | saveall = new Runnable ()
|
---|
| 323 | {
|
---|
| 324 | public void run ()
|
---|
| 325 | {
|
---|
| 326 | try
|
---|
| 327 | {
|
---|
| 328 | Runnable savework;
|
---|
| 329 | savework = new Runnable ()
|
---|
| 330 | {
|
---|
| 331 | public void run ()
|
---|
| 332 | {
|
---|
| 333 | Date curr_date;
|
---|
| 334 | curr_date = new Date();
|
---|
| 335 | log = new History(curr_date,command);
|
---|
| 336 |
|
---|
| 337 | if ((start_fd == true)&&(command.equals(messages.getString("WindowOpened"))))
|
---|
| 338 | {
|
---|
| 339 | start_rec = true;
|
---|
| 340 | rec = true;
|
---|
| 341 | start_fd = false;
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | getFrame(comp,command);
|
---|
| 345 | saveState(command);
|
---|
| 346 | saveLog();
|
---|
| 347 |
|
---|
| 348 | if ((point != null) && (rec == true))
|
---|
| 349 | {
|
---|
| 350 | if (command.equals(messages.getString("WindowClosed")))
|
---|
| 351 | {
|
---|
| 352 | if (point instanceof JDialog)
|
---|
| 353 | if (((JDialog)point).isModal() == true)
|
---|
| 354 | if (point == modalWindow)
|
---|
| 355 | frame.setComment(false);
|
---|
| 356 | }
|
---|
| 357 | }
|
---|
| 358 | }
|
---|
| 359 | };
|
---|
| 360 |
|
---|
| 361 | SwingUtilities.invokeAndWait(savework);
|
---|
| 362 | }
|
---|
| 363 | catch (Exception ex) {ex.printStackTrace();}
|
---|
| 364 | }
|
---|
| 365 | };
|
---|
| 366 |
|
---|
| 367 | saveallThread = new Thread(saveall);
|
---|
| 368 | saveallThread.start();
|
---|
| 369 | }
|
---|
| 370 |
|
---|
| 371 | /**
|
---|
| 372 | * This method will get the screen shot of the window where the actions occured and
|
---|
| 373 | * add the image also its dimension to the passed record.
|
---|
| 374 | * It will caused the saveThread to start so it can allows other stuff to be run concurrently
|
---|
| 375 | * and this thread will be stopped when the screen shot of the window alreadyfinished taken.
|
---|
| 376 | * @param hst is the record where the image and its dimension should be stored to.
|
---|
| 377 | */
|
---|
| 378 | public void saveImage (final History hst)
|
---|
| 379 | {
|
---|
| 380 | Runnable saveRun;
|
---|
| 381 | saveRun = new Runnable()
|
---|
| 382 | {
|
---|
| 383 | History hist = hst;
|
---|
| 384 | public void run()
|
---|
| 385 | {
|
---|
| 386 | String img,width,height;
|
---|
| 387 | Rectangle rect;
|
---|
| 388 | int w, h,dimwidth,dimheight;
|
---|
| 389 |
|
---|
| 390 | if (point != null)
|
---|
| 391 | {
|
---|
| 392 | dimwidth = sh.getWidth();
|
---|
| 393 | dimheight = sh.getHeight();
|
---|
| 394 |
|
---|
| 395 | w = point.getWidth();
|
---|
| 396 | h = point.getHeight();
|
---|
| 397 |
|
---|
| 398 | try
|
---|
| 399 | {
|
---|
| 400 | rect = new Rectangle(point.getLocationOnScreen(),
|
---|
| 401 | new Dimension(w,h));
|
---|
| 402 |
|
---|
| 403 | if (w >= dimwidth)
|
---|
| 404 | w = dimwidth - 50;
|
---|
| 405 |
|
---|
| 406 | width = "" + w;
|
---|
| 407 |
|
---|
| 408 | if (h >= dimheight)
|
---|
| 409 | h = dimheight - 50;
|
---|
| 410 |
|
---|
| 411 | height = "" + h;
|
---|
| 412 | }
|
---|
| 413 | catch (IllegalComponentStateException exp)
|
---|
| 414 | {
|
---|
| 415 | rect = null;
|
---|
| 416 | width = null;
|
---|
| 417 | height = null;
|
---|
| 418 | }
|
---|
| 419 | }
|
---|
| 420 | else
|
---|
| 421 | {
|
---|
| 422 | rect = null;
|
---|
| 423 | width = null;
|
---|
| 424 | height = null;
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | if (rect != null)
|
---|
| 428 | {
|
---|
| 429 | img = sh.getImage(rect);
|
---|
| 430 | if (savefinish == true)
|
---|
| 431 | {
|
---|
| 432 | hist.setImage(img,height,width);
|
---|
| 433 | }
|
---|
| 434 | }
|
---|
| 435 | }
|
---|
| 436 | };
|
---|
| 437 |
|
---|
| 438 | Thread saveThread;
|
---|
| 439 | saveThread = new Thread(saveRun);
|
---|
| 440 | saveThread.start();
|
---|
| 441 | }
|
---|
| 442 |
|
---|
| 443 | /**
|
---|
| 444 | * This method will setup the savefinish value.
|
---|
| 445 | * (Precondition: (save != null))
|
---|
| 446 | * @param save the value savefinish should have.
|
---|
| 447 | */
|
---|
| 448 | public static void setSavefinish (boolean save)
|
---|
| 449 | {
|
---|
| 450 | savefinish = save;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 |
|
---|
| 454 | /**
|
---|
| 455 | * This method will make the JMenu that is should be added to all the
|
---|
| 456 | * window opened by the application.
|
---|
| 457 | * <br>If rec = false then the JMenu will give user option to start the Reporting Feedback sequence
|
---|
| 458 | * or Sending feedback or to view the history of actions they have done so far.
|
---|
| 459 | * <br>If rec = true then the JMenu will only give user option to view the history of actions
|
---|
| 460 | * they have done so far or sending feedback or taking screenshot.
|
---|
| 461 | * @return JMenu that should be added to all window open.
|
---|
| 462 | */
|
---|
| 463 | public JMenu makeMenu ()
|
---|
| 464 | {
|
---|
| 465 | JMenu menu;
|
---|
| 466 | JMenuItem item,item2,item3;
|
---|
| 467 | ImageIcon icon,icon2,icon3;
|
---|
| 468 |
|
---|
| 469 | icon3 = JarTools.getImage("fastsend.gif");
|
---|
| 470 | item3 = new JMenuItem(messages.getString("SendFeedback"),
|
---|
| 471 | new ImageIcon(icon3.getImage().getScaledInstance
|
---|
| 472 | (20,20,Image.SCALE_SMOOTH)));
|
---|
| 473 | item3.setActionCommand("FastSend");
|
---|
| 474 | item3.addActionListener(this);
|
---|
| 475 | item3.setMnemonic(KeyEvent.VK_N);
|
---|
| 476 | item3.setAccelerator(sndfdKey);
|
---|
| 477 | item3.setToolTipText("Send feedback now");
|
---|
| 478 |
|
---|
| 479 | item = null;
|
---|
| 480 |
|
---|
| 481 | if (rec == false)
|
---|
| 482 | {
|
---|
| 483 | icon = JarTools.getImage("feedback.gif");
|
---|
| 484 | item = new JMenuItem("Report Feedback",
|
---|
| 485 | new ImageIcon(icon.getImage().getScaledInstance
|
---|
| 486 | (20,20,Image.SCALE_SMOOTH)));
|
---|
| 487 | item.setActionCommand(messages.getString("SendFeedback"));
|
---|
| 488 | item.addActionListener(this);
|
---|
| 489 | item.setMnemonic(KeyEvent.VK_F);
|
---|
| 490 | item.setAccelerator(fdKey);
|
---|
| 491 | item.setToolTipText("Report feedback");
|
---|
| 492 | }
|
---|
| 493 | else
|
---|
| 494 | {
|
---|
| 495 | icon = JarTools.getImage("camera.gif");
|
---|
| 496 | item = new JMenuItem(messages.getString("ScreenShot"),
|
---|
| 497 | new ImageIcon(icon.getImage().getScaledInstance
|
---|
| 498 | (20,20,Image.SCALE_SMOOTH)));
|
---|
| 499 | item.setActionCommand("ScreenShot");
|
---|
| 500 | item.setMnemonic(KeyEvent.VK_S);
|
---|
| 501 | item.addActionListener(this);
|
---|
| 502 | item.setAccelerator(shKey);
|
---|
| 503 | item.setToolTipText("Take screenshot of the whole screen.");
|
---|
| 504 | }
|
---|
| 505 |
|
---|
| 506 | icon2 = JarTools.getImage("history.gif");
|
---|
| 507 | item2 = new JMenuItem(messages.getString("LookHistory"),
|
---|
| 508 | new ImageIcon(icon2.getImage().getScaledInstance
|
---|
| 509 | (20,20,Image.SCALE_SMOOTH)));
|
---|
| 510 | item2.setActionCommand(messages.getString("LookHistory"));
|
---|
| 511 | item2.addActionListener(this);
|
---|
| 512 | item2.setMnemonic(KeyEvent.VK_H);
|
---|
| 513 | item2.setAccelerator(histKey);
|
---|
| 514 | item2.setToolTipText(messages.getString("LookHistoryButton"));
|
---|
| 515 |
|
---|
| 516 | menu = new JMenu (messages.getString("Feedback"));
|
---|
| 517 | menu.setMnemonic(KeyEvent.VK_D);
|
---|
| 518 |
|
---|
| 519 |
|
---|
| 520 | if (item != null)
|
---|
| 521 | menu.add(item);
|
---|
| 522 |
|
---|
| 523 | menu.add(item3);
|
---|
| 524 |
|
---|
| 525 | menu.add(item2);
|
---|
| 526 |
|
---|
| 527 | if (rec == true)
|
---|
| 528 | menu.setBackground(new Color(176,209,217));
|
---|
| 529 | else
|
---|
| 530 | menu.setBackground(new Color(204,204,204));
|
---|
| 531 |
|
---|
| 532 | return menu;
|
---|
| 533 | }
|
---|
| 534 |
|
---|
| 535 | public void refreshLocationAndSize(Window window) {
|
---|
| 536 |
|
---|
| 537 | window.setLocation(window.getX(),window.getY());
|
---|
| 538 |
|
---|
| 539 | Toolkit kit;
|
---|
| 540 | kit = Toolkit.getDefaultToolkit();
|
---|
| 541 | Dimension screenSize;
|
---|
| 542 | screenSize = kit.getScreenSize();
|
---|
| 543 | int screenHeight;
|
---|
| 544 | screenHeight = screenSize.height;
|
---|
| 545 | int screenWidth;
|
---|
| 546 | screenWidth = screenSize.width;
|
---|
| 547 |
|
---|
| 548 | if ((window.getSize().width > screenWidth) &&
|
---|
| 549 | (window.getSize().height > screenHeight)) {
|
---|
| 550 | window.setSize(window.getPreferredSize());
|
---|
| 551 | }
|
---|
| 552 | }
|
---|
| 553 |
|
---|
| 554 |
|
---|
| 555 | /**
|
---|
| 556 | * This method will setup the GUI that this window should have at the moment.
|
---|
| 557 | * If start_rec is true then JMenu don't have the option to start Reporting Feedback sequence in it.
|
---|
| 558 | * If stop_rec is true and rec is true then JMenu there should be an option to start Reporting Feedback sequence in it.
|
---|
| 559 | * The JMenu will only be affected window of type JDialog and JFrame only.
|
---|
| 560 | * (Precondition: (window != null))
|
---|
| 561 | * @param window its the window that we want to set the GUI
|
---|
| 562 | */
|
---|
| 563 | public void setUI (Window window)
|
---|
| 564 | {
|
---|
| 565 | if (start_rec == true) {
|
---|
| 566 | if (window instanceof JFrame) {
|
---|
| 567 | JFrame a;
|
---|
| 568 | a = (JFrame) window;
|
---|
| 569 |
|
---|
| 570 | JMenuBar menuBar;
|
---|
| 571 | menuBar = a.getJMenuBar();
|
---|
| 572 |
|
---|
| 573 | if (menuBar != null) {
|
---|
| 574 |
|
---|
| 575 | JMenu temp_menu;
|
---|
| 576 | temp_menu = menuBar.getMenu(menuBar.getMenuCount() - 1);
|
---|
| 577 | temp_menu.setBackground(new Color(176,209,217));
|
---|
| 578 | temp_menu.remove(0);
|
---|
| 579 |
|
---|
| 580 | JMenuItem item;
|
---|
| 581 | ImageIcon icon;
|
---|
| 582 | icon = JarTools.getImage("camera.gif");
|
---|
| 583 | item = new JMenuItem(messages.getString("ScreenShot"),
|
---|
| 584 | new ImageIcon(icon.getImage().getScaledInstance
|
---|
| 585 | (20,20,Image.SCALE_SMOOTH)));
|
---|
| 586 | item.setActionCommand("ScreenShot");
|
---|
| 587 | item.setMnemonic(KeyEvent.VK_S);
|
---|
| 588 | item.addActionListener(this);
|
---|
| 589 | item.setAccelerator(shKey);
|
---|
| 590 | item.setToolTipText("Take screenshot of this window");
|
---|
| 591 |
|
---|
| 592 | temp_menu.insert(item,0);
|
---|
| 593 | }
|
---|
| 594 |
|
---|
| 595 | refreshLocationAndSize(a);
|
---|
| 596 | a.validate();
|
---|
| 597 | a.repaint();
|
---|
| 598 | }
|
---|
| 599 | else if (window instanceof JDialog) {
|
---|
| 600 |
|
---|
| 601 | JDialog a;
|
---|
| 602 | a = (JDialog) window;
|
---|
| 603 | JMenuBar menuBar;
|
---|
| 604 | menuBar = a.getJMenuBar();
|
---|
| 605 |
|
---|
| 606 | if (menuBar != null) {
|
---|
| 607 |
|
---|
| 608 | JMenu temp_menu;
|
---|
| 609 | temp_menu = menuBar.getMenu(menuBar.getMenuCount() - 1);
|
---|
| 610 | temp_menu.setBackground(new Color(176,209,217));
|
---|
| 611 | temp_menu.remove(0);
|
---|
| 612 |
|
---|
| 613 | JMenuItem item;
|
---|
| 614 | ImageIcon icon;
|
---|
| 615 | icon = JarTools.getImage("camera.gif");
|
---|
| 616 | item = new JMenuItem(messages.getString("ScreenShot"),
|
---|
| 617 | new ImageIcon(icon.getImage().getScaledInstance
|
---|
| 618 | (20,20,Image.SCALE_SMOOTH)));
|
---|
| 619 | item.setActionCommand("ScreenShot");
|
---|
| 620 | item.setMnemonic(KeyEvent.VK_S);
|
---|
| 621 | item.addActionListener(this);
|
---|
| 622 | item.setAccelerator(shKey);
|
---|
| 623 | item.setToolTipText("Take screenshot of this window");
|
---|
| 624 |
|
---|
| 625 | temp_menu.insert(item,0);
|
---|
| 626 | }
|
---|
| 627 | refreshLocationAndSize(a);
|
---|
| 628 | a.validate();
|
---|
| 629 | a.repaint();
|
---|
| 630 | }
|
---|
| 631 | else if (window instanceof JWindow) {
|
---|
| 632 | JWindow a;
|
---|
| 633 | a = (JWindow) window;
|
---|
| 634 |
|
---|
| 635 | ((JComponent) a.getContentPane()).unregisterKeyboardAction(fdKey);
|
---|
| 636 |
|
---|
| 637 | ((JComponent) a.getContentPane()).registerKeyboardAction(this, "ScreenShot", shKey,JComponent.WHEN_IN_FOCUSED_WINDOW);
|
---|
| 638 | }
|
---|
| 639 | else
|
---|
| 640 | return;
|
---|
| 641 | }
|
---|
| 642 | else {
|
---|
| 643 |
|
---|
| 644 | if ((stop_rec == true) && (rec == true)) {
|
---|
| 645 |
|
---|
| 646 | if (window instanceof JFrame) {
|
---|
| 647 | JFrame a;
|
---|
| 648 | a = (JFrame) window;
|
---|
| 649 |
|
---|
| 650 | JMenuBar menuBar;
|
---|
| 651 | menuBar = a.getJMenuBar();
|
---|
| 652 |
|
---|
| 653 | if (menuBar != null) {
|
---|
| 654 |
|
---|
| 655 | JMenu temp_menu;
|
---|
| 656 | temp_menu = menuBar.getMenu(menuBar.getMenuCount() - 1);
|
---|
| 657 | temp_menu.setBackground(new Color(204,204,204));
|
---|
| 658 | temp_menu.remove(0);
|
---|
| 659 |
|
---|
| 660 | ImageIcon icon;
|
---|
| 661 | JMenuItem item;
|
---|
| 662 |
|
---|
| 663 | icon = JarTools.getImage("feedback.gif");
|
---|
| 664 | item = new JMenuItem("Report Feedback", new ImageIcon(icon.getImage().getScaledInstance(20,20,Image.SCALE_SMOOTH)));
|
---|
| 665 | item.setActionCommand(messages.getString("SendFeedback"));
|
---|
| 666 | item.addActionListener(this);
|
---|
| 667 | item.setMnemonic(KeyEvent.VK_F);
|
---|
| 668 | item.setAccelerator(fdKey);
|
---|
| 669 | item.setToolTipText(messages.getString("SendFeedbackButton"));
|
---|
| 670 |
|
---|
| 671 | temp_menu.insert(item,0);
|
---|
| 672 | }
|
---|
| 673 | a.setSize(a.getPreferredSize());
|
---|
| 674 | a.validate();
|
---|
| 675 | a.repaint();
|
---|
| 676 | }
|
---|
| 677 | else if (window instanceof JDialog) {
|
---|
| 678 | JDialog a;
|
---|
| 679 | a = (JDialog) window;
|
---|
| 680 |
|
---|
| 681 | JMenuBar menuBar;
|
---|
| 682 | menuBar = a.getJMenuBar();
|
---|
| 683 |
|
---|
| 684 | if (menuBar != null) {
|
---|
| 685 |
|
---|
| 686 | JMenu temp_menu;
|
---|
| 687 | temp_menu = menuBar.getMenu(menuBar.getMenuCount() - 1);
|
---|
| 688 | temp_menu.setBackground(new Color(204,204,204));
|
---|
| 689 | temp_menu.remove(0);
|
---|
| 690 |
|
---|
| 691 | ImageIcon icon;
|
---|
| 692 | JMenuItem item;
|
---|
| 693 |
|
---|
| 694 | icon = JarTools.getImage("feedback.gif");
|
---|
| 695 | item = new JMenuItem("Report Feedback", new ImageIcon(icon.getImage().getScaledInstance(20,20,Image.SCALE_SMOOTH)));
|
---|
| 696 | item.setActionCommand(messages.getString("SendFeedback"));
|
---|
| 697 | item.addActionListener(this);
|
---|
| 698 | item.setMnemonic(KeyEvent.VK_F);
|
---|
| 699 | item.setAccelerator(fdKey);
|
---|
| 700 | item.setToolTipText(messages.getString("SendFeedbackButton"));
|
---|
| 701 |
|
---|
| 702 | temp_menu.insert(item,0);
|
---|
| 703 | }
|
---|
| 704 | a.setSize(a.getPreferredSize());
|
---|
| 705 | a.validate();
|
---|
| 706 | a.repaint();
|
---|
| 707 | }
|
---|
| 708 | else if (window instanceof JWindow) {
|
---|
| 709 | JWindow a;
|
---|
| 710 | a = (JWindow) window;
|
---|
| 711 |
|
---|
| 712 | ((JComponent) a.getContentPane()).registerKeyboardAction(this, messages.getString("SendFeedback"), fdKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
|
---|
| 713 |
|
---|
| 714 | ((JComponent) a.getContentPane()).unregisterKeyboardAction(shKey);
|
---|
| 715 |
|
---|
| 716 | }
|
---|
| 717 | else
|
---|
| 718 | return;
|
---|
| 719 | }
|
---|
| 720 | else
|
---|
| 721 | return;
|
---|
| 722 | }
|
---|
| 723 | }
|
---|
| 724 |
|
---|
| 725 | /**
|
---|
| 726 | * This will make an Window[] convert to ArrayList that contain list of Window.
|
---|
| 727 | * (Precondition: (windows != null))
|
---|
| 728 | * @param windows the array that we want to convert to ArrayList
|
---|
| 729 | * @return the array list that contains all object in array windows.
|
---|
| 730 | */
|
---|
| 731 | @SuppressWarnings({ "rawtypes", "unchecked" })
|
---|
| 732 | public ArrayList addToArrayList (Window[] windows,ArrayList arr)
|
---|
| 733 | {
|
---|
| 734 | int i;
|
---|
| 735 |
|
---|
| 736 | for (i = 0 ; i < windows.length ; i++)
|
---|
| 737 | {
|
---|
| 738 | arr.add(windows[i]);
|
---|
| 739 | }
|
---|
| 740 |
|
---|
| 741 | return arr;
|
---|
| 742 | }
|
---|
| 743 |
|
---|
| 744 | /**
|
---|
| 745 | * This method will get all the information of the window that are currently open when the action
|
---|
| 746 | * occured and these windows are not the window where the action occured.
|
---|
| 747 | * It will add these windows information to the current record and it will also setting up the
|
---|
| 748 | * GUI for each of these windows.
|
---|
| 749 | * @param command the action's command user did.
|
---|
| 750 | */
|
---|
| 751 | @SuppressWarnings({ "rawtypes", "unchecked" })
|
---|
| 752 | public void saveState(String command)
|
---|
| 753 | {
|
---|
| 754 | Window[] frame_windows;
|
---|
| 755 | ArrayList windows;
|
---|
| 756 | Frame[] frames;
|
---|
| 757 | int i,j;
|
---|
| 758 |
|
---|
| 759 | if (log == null)
|
---|
| 760 | return;
|
---|
| 761 |
|
---|
| 762 | windows = new ArrayList();
|
---|
| 763 |
|
---|
| 764 | frames = Frame.getFrames();
|
---|
| 765 | for (i = 0 ; i<frames.length;i++)
|
---|
| 766 | {
|
---|
| 767 | frame_windows = frames[i].getOwnedWindows();
|
---|
| 768 | windows = addToArrayList(frame_windows,windows);
|
---|
| 769 |
|
---|
| 770 | for (j = 0;j < frame_windows.length ; j++)
|
---|
| 771 | {
|
---|
| 772 | Window window;
|
---|
| 773 | window = frame_windows[j];
|
---|
| 774 |
|
---|
| 775 | if (window == point)
|
---|
| 776 | {
|
---|
| 777 | Container cont;
|
---|
| 778 | cont = window.getParent();
|
---|
| 779 |
|
---|
| 780 | if ((cont != null) && (cont instanceof Window) &&
|
---|
| 781 | (windows.contains(cont) == false)&&(cont != point))
|
---|
| 782 | {
|
---|
| 783 | if (cont instanceof ReportDetails.View) {}
|
---|
| 784 | else if (cont instanceof Movie) {}
|
---|
| 785 | else
|
---|
| 786 | {
|
---|
| 787 | setUI((Window) cont);
|
---|
| 788 |
|
---|
| 789 | /*if (rec == true)
|
---|
| 790 | {
|
---|
| 791 | log.addComponent(compInfo.getInside((Window) cont),
|
---|
| 792 | messages.getString("CurrentlyOpenWindow"));
|
---|
| 793 | }
|
---|
| 794 | else*/
|
---|
| 795 | compList.getInside((Window) cont);
|
---|
| 796 |
|
---|
| 797 | windows.add(cont);
|
---|
| 798 | }
|
---|
| 799 | }
|
---|
| 800 | else
|
---|
| 801 | {}
|
---|
| 802 | }
|
---|
| 803 | else
|
---|
| 804 | {
|
---|
| 805 | if (window instanceof ReportDetails.View) {}
|
---|
| 806 | else if (window instanceof Movie) {}
|
---|
| 807 | else
|
---|
| 808 | {
|
---|
| 809 | if ((window != null) && (window != point))
|
---|
| 810 | {
|
---|
| 811 | setUI(window);
|
---|
| 812 |
|
---|
| 813 | if (rec == true)
|
---|
| 814 | {
|
---|
| 815 | log.addComponent(compInfo.getInside((Window) window),
|
---|
| 816 | messages.getString("CurrentlyOpenWindow"));
|
---|
| 817 | }
|
---|
| 818 | else
|
---|
| 819 | compList.getInside((Window) window);
|
---|
| 820 |
|
---|
| 821 | Container cont;
|
---|
| 822 | cont = window.getParent();
|
---|
| 823 |
|
---|
| 824 | if ((cont != null) && (cont instanceof Window) &&
|
---|
| 825 | (cont != point) && (windows.contains(cont) == false))
|
---|
| 826 | {
|
---|
| 827 | if (cont instanceof ReportDetails.View) {}
|
---|
| 828 | else if (cont instanceof Movie) {}
|
---|
| 829 | else
|
---|
| 830 | {
|
---|
| 831 | setUI((Window)cont);
|
---|
| 832 |
|
---|
| 833 | /*if (rec == true)
|
---|
| 834 | {
|
---|
| 835 | log.addComponent(compInfo.getInside((Window) cont),
|
---|
| 836 | messages.getString("CurrentlyOpenWindow"));
|
---|
| 837 | }
|
---|
| 838 | else*/
|
---|
| 839 | compList.getInside((Window) cont);
|
---|
| 840 |
|
---|
| 841 | windows.add(cont);
|
---|
| 842 | }
|
---|
| 843 | }
|
---|
| 844 | else {}
|
---|
| 845 | }
|
---|
| 846 | }
|
---|
| 847 | }
|
---|
| 848 | }
|
---|
| 849 | }
|
---|
| 850 | }
|
---|
| 851 |
|
---|
| 852 | /**
|
---|
| 853 | * This method will get all the information about the window where the actions occured and it also will setting up
|
---|
| 854 | * how hthe GUI should look like in this window and it will also take the image of this window.
|
---|
| 855 | * @param comp is the component where the actions happened.
|
---|
| 856 | * @param command is the command of user's action
|
---|
| 857 | */
|
---|
| 858 | public void getFrame (Component comp,String command)
|
---|
| 859 | {
|
---|
| 860 | boolean cls;
|
---|
| 861 |
|
---|
| 862 | cls = false;
|
---|
| 863 | point = null;
|
---|
| 864 |
|
---|
| 865 | Container frame;
|
---|
| 866 | myframe = null;
|
---|
| 867 |
|
---|
| 868 | if (comp == null)
|
---|
| 869 | return;
|
---|
| 870 | else if (comp instanceof Window)
|
---|
| 871 | frame = (Container) comp;
|
---|
| 872 | else
|
---|
| 873 | frame = SwingUtilities.getWindowAncestor(comp);
|
---|
| 874 |
|
---|
| 875 | if (frame instanceof Window)
|
---|
| 876 | {
|
---|
| 877 | JMenu menu;
|
---|
| 878 | point = (Window) frame;
|
---|
| 879 |
|
---|
| 880 | point.addMouseListener(mouse_blocker_listener);
|
---|
| 881 | point.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
| 882 |
|
---|
| 883 |
|
---|
| 884 | if ((frame instanceof ReportDetails.View)||
|
---|
| 885 | (frame instanceof Movie))
|
---|
| 886 | {
|
---|
| 887 | log = null;
|
---|
| 888 | return;
|
---|
| 889 | }
|
---|
| 890 |
|
---|
| 891 | if (command.equals(messages.getString("WindowClosed")))
|
---|
| 892 | {
|
---|
| 893 | cls = true;
|
---|
| 894 | if (frame instanceof FeedbackInterface)
|
---|
| 895 | {
|
---|
| 896 | stop_rec = true;
|
---|
| 897 | }
|
---|
| 898 | else
|
---|
| 899 | {}
|
---|
| 900 | }
|
---|
| 901 |
|
---|
| 902 | if (command.equals(messages.getString("WindowOpened")))
|
---|
| 903 | {
|
---|
| 904 | menu = makeMenu();
|
---|
| 905 | }
|
---|
| 906 | else
|
---|
| 907 | {
|
---|
| 908 | menu = null;
|
---|
| 909 | }
|
---|
| 910 |
|
---|
| 911 | if (frame instanceof JFrame)
|
---|
| 912 | {
|
---|
| 913 | JFrame a;
|
---|
| 914 | a = (JFrame) frame;
|
---|
| 915 |
|
---|
| 916 | myframe = a.getTitle();
|
---|
| 917 |
|
---|
| 918 | if (menu != null)
|
---|
| 919 | {
|
---|
| 920 | JMenuBar menuBar;
|
---|
| 921 | menuBar = a.getJMenuBar();
|
---|
| 922 |
|
---|
| 923 | if (menuBar == null)
|
---|
| 924 | {
|
---|
| 925 | menuBar = new JMenuBar();
|
---|
| 926 | menuBar.add(menu);
|
---|
| 927 | a.setJMenuBar(menuBar);
|
---|
| 928 | }
|
---|
| 929 | else
|
---|
| 930 | menuBar.add(menu);
|
---|
| 931 | }
|
---|
| 932 |
|
---|
| 933 | if ((menu != null))
|
---|
| 934 | {
|
---|
| 935 | refreshLocationAndSize(a);
|
---|
| 936 | a.validate();
|
---|
| 937 | a.repaint();
|
---|
| 938 | }
|
---|
| 939 | }
|
---|
| 940 | else if (frame instanceof JDialog)
|
---|
| 941 | {
|
---|
| 942 | JDialog a;
|
---|
| 943 | a = (JDialog) frame;
|
---|
| 944 |
|
---|
| 945 | myframe = a.getTitle();
|
---|
| 946 |
|
---|
| 947 | if (menu != null)
|
---|
| 948 | {
|
---|
| 949 | JMenuBar menuBar;
|
---|
| 950 | menuBar = a.getJMenuBar();
|
---|
| 951 |
|
---|
| 952 | if (menuBar == null)
|
---|
| 953 | {
|
---|
| 954 | menuBar = new JMenuBar();
|
---|
| 955 | menuBar.add(menu);
|
---|
| 956 | a.setJMenuBar(menuBar);
|
---|
| 957 | }
|
---|
| 958 | else
|
---|
| 959 | menuBar.add(menu);
|
---|
| 960 | }
|
---|
| 961 |
|
---|
| 962 | if ((menu != null))
|
---|
| 963 | {
|
---|
| 964 | refreshLocationAndSize(a);
|
---|
| 965 | a.validate();
|
---|
| 966 | a.repaint();
|
---|
| 967 | }
|
---|
| 968 | }
|
---|
| 969 | else if (frame instanceof JWindow)
|
---|
| 970 | {
|
---|
| 971 | JWindow a;
|
---|
| 972 | a = (JWindow) frame;
|
---|
| 973 |
|
---|
| 974 | if (menu != null)
|
---|
| 975 | {
|
---|
| 976 | ((JComponent) a.getContentPane()).registerKeyboardAction(this,
|
---|
| 977 | messages.getString("LookHistory"),
|
---|
| 978 | histKey,
|
---|
| 979 | JComponent.WHEN_IN_FOCUSED_WINDOW);
|
---|
| 980 |
|
---|
| 981 | if (rec == false)
|
---|
| 982 | {
|
---|
| 983 | ((JComponent) a.getContentPane()).registerKeyboardAction(this,
|
---|
| 984 | messages.getString("SendFeedback"),
|
---|
| 985 | fdKey,
|
---|
| 986 | JComponent.WHEN_IN_FOCUSED_WINDOW);
|
---|
| 987 |
|
---|
| 988 | ((JComponent) a.getContentPane()).unregisterKeyboardAction(shKey);
|
---|
| 989 | }
|
---|
| 990 | else
|
---|
| 991 | {
|
---|
| 992 | ((JComponent) a.getContentPane()).unregisterKeyboardAction(fdKey);
|
---|
| 993 |
|
---|
| 994 | ((JComponent) a.getContentPane()).registerKeyboardAction(this,
|
---|
| 995 | "ScreenShot",
|
---|
| 996 | shKey,
|
---|
| 997 | JComponent.WHEN_IN_FOCUSED_WINDOW);
|
---|
| 998 | }
|
---|
| 999 | }
|
---|
| 1000 |
|
---|
| 1001 | if (cls == true)
|
---|
| 1002 | {
|
---|
| 1003 | ((JComponent) a.getContentPane()).unregisterKeyboardAction(fdKey);
|
---|
| 1004 |
|
---|
| 1005 | ((JComponent) a.getContentPane()).unregisterKeyboardAction(shKey);
|
---|
| 1006 | }
|
---|
| 1007 | }
|
---|
| 1008 |
|
---|
| 1009 | /*if ((command.equals(messages.getString("WindowClosed")))||
|
---|
| 1010 | (log == null))
|
---|
| 1011 | {}
|
---|
| 1012 | else
|
---|
| 1013 | saveImage(log);*/
|
---|
| 1014 |
|
---|
| 1015 | /*if (rec == true)
|
---|
| 1016 | log.addComponent(compInfo.getInside(point),command);
|
---|
| 1017 | else*/
|
---|
| 1018 | compList.getInside(point);
|
---|
| 1019 |
|
---|
| 1020 | if (myframe == null)
|
---|
| 1021 | myframe = " ";
|
---|
| 1022 |
|
---|
| 1023 | log.setTitle(myframe);
|
---|
| 1024 |
|
---|
| 1025 | return;
|
---|
| 1026 | }
|
---|
| 1027 | else
|
---|
| 1028 | return;
|
---|
| 1029 | }
|
---|
| 1030 |
|
---|
| 1031 | /**
|
---|
| 1032 | * This method will add the current record to the vector.
|
---|
| 1033 | */
|
---|
| 1034 | @SuppressWarnings("unchecked")
|
---|
| 1035 | public void saveLog()
|
---|
| 1036 | {
|
---|
| 1037 | if (start_rec == true)
|
---|
| 1038 | {
|
---|
| 1039 | save_HistLog("history.log");
|
---|
| 1040 | vector.removeAllElements();
|
---|
| 1041 | System.gc();
|
---|
| 1042 | start_rec = false;
|
---|
| 1043 | stop_rec = false;
|
---|
| 1044 | rec = true;
|
---|
| 1045 | }
|
---|
| 1046 |
|
---|
| 1047 | if (log != null)
|
---|
| 1048 | vector.add(0,log);
|
---|
| 1049 |
|
---|
| 1050 | if (vector.size() > 30)
|
---|
| 1051 | {
|
---|
| 1052 | if (rec == false)
|
---|
| 1053 | {
|
---|
| 1054 | save_tempHistLog("history.log");
|
---|
| 1055 | }
|
---|
| 1056 | else
|
---|
| 1057 | save_tempHistLog("feedbackhist.log");
|
---|
| 1058 | vector.removeAllElements();
|
---|
| 1059 | //vector.removeElementAt(vector.size() - 1);
|
---|
| 1060 | System.gc();
|
---|
| 1061 | }
|
---|
| 1062 |
|
---|
| 1063 | if ((rec == true) && (stop_rec == true))
|
---|
| 1064 | {
|
---|
| 1065 | save_HistLog("feedbackhist.log");
|
---|
| 1066 | vector.removeAllElements();
|
---|
| 1067 | System.gc();
|
---|
| 1068 | vector = getPrev_log("history.log");
|
---|
| 1069 | File f2;
|
---|
| 1070 | f2 = new File("feedbackhist.log");
|
---|
| 1071 | f2.delete();
|
---|
| 1072 | f2 = new File("temp_feedbackhist.log");
|
---|
| 1073 | f2.delete();
|
---|
| 1074 | start_rec = false;
|
---|
| 1075 | stop_rec = true;
|
---|
| 1076 | rec = false;
|
---|
| 1077 | }
|
---|
| 1078 |
|
---|
| 1079 | if (point != null)
|
---|
| 1080 | {
|
---|
| 1081 | point.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
| 1082 | point.removeMouseListener(mouse_blocker_listener);
|
---|
| 1083 | }
|
---|
| 1084 | }
|
---|
| 1085 |
|
---|
| 1086 | /**
|
---|
| 1087 | * This method will save whatever in the vector at the moment to a file
|
---|
| 1088 | * with the specified filename.
|
---|
| 1089 | * Then it will also save the vector inside the file with the name "temp_"
|
---|
| 1090 | * concatenated with the specified filename into it.
|
---|
| 1091 | * (Precondition : (filename != null))
|
---|
| 1092 | * @param filename its the name of the file where the vector should be saved.
|
---|
| 1093 | */
|
---|
| 1094 | public void save_HistLog(String filename)
|
---|
| 1095 | {
|
---|
| 1096 | try
|
---|
| 1097 | {
|
---|
| 1098 | File f;
|
---|
| 1099 | f = new File(filename);
|
---|
| 1100 | FileOutputStream fos;
|
---|
| 1101 | fos = new FileOutputStream(f);
|
---|
| 1102 | ObjectOutputStream oos;
|
---|
| 1103 | oos = new ObjectOutputStream(fos);
|
---|
| 1104 | oos.writeObject(vector);
|
---|
| 1105 | vector.removeAllElements();
|
---|
| 1106 | System.gc();
|
---|
| 1107 | vector = getPrev_log("temp_"+ filename);
|
---|
| 1108 | oos.writeObject(vector);
|
---|
| 1109 | oos.close();
|
---|
| 1110 | f = new File("temp_" + filename);
|
---|
| 1111 | f.delete();
|
---|
| 1112 | writeThread = null;
|
---|
| 1113 | }
|
---|
| 1114 | catch (IOException exp) {}
|
---|
| 1115 | }
|
---|
| 1116 |
|
---|
| 1117 | /**
|
---|
| 1118 | * This method will save whatever in the vector at the moment to a file with a
|
---|
| 1119 | * name "temp_" concatenated with the specified filename into it.
|
---|
| 1120 | * (Precondition : (filename != null))
|
---|
| 1121 | * @param filename its part of the name of the file where the vector should be saved.
|
---|
| 1122 | */
|
---|
| 1123 | public void save_tempHistLog(String filename)
|
---|
| 1124 | {
|
---|
| 1125 | try
|
---|
| 1126 | {
|
---|
| 1127 | File f;
|
---|
| 1128 | f = new File("temp_"+ filename);
|
---|
| 1129 | FileOutputStream fos;
|
---|
| 1130 | fos = new FileOutputStream(f);
|
---|
| 1131 | ObjectOutputStream oos;
|
---|
| 1132 | oos = new ObjectOutputStream(fos);
|
---|
| 1133 | oos.writeObject(vector);
|
---|
| 1134 | oos.close();
|
---|
| 1135 | }
|
---|
| 1136 | catch (IOException exp) {}
|
---|
| 1137 | }
|
---|
| 1138 |
|
---|
| 1139 | /**
|
---|
| 1140 | * This method will get vector that is stored in a file with the specified filename and
|
---|
| 1141 | * it will also save the second vector in that file to a file with a name
|
---|
| 1142 | * temp_history.log.
|
---|
| 1143 | * If file with the specified filename does not exist then it will return a new vector.
|
---|
| 1144 | * (Precondition : (filename != null))
|
---|
| 1145 | * @param filename is the name of the file where we want to get the vector.
|
---|
| 1146 | * @return the first vector saved in the file with the specified filename.
|
---|
| 1147 | */
|
---|
| 1148 | @SuppressWarnings("rawtypes")
|
---|
| 1149 | public Vector getPrev_log(String filename)
|
---|
| 1150 | {
|
---|
| 1151 | Vector stack;
|
---|
| 1152 | ObjectInputStream ois;
|
---|
| 1153 | stack = null;
|
---|
| 1154 | try
|
---|
| 1155 | {
|
---|
| 1156 | File f;
|
---|
| 1157 | f = new File(filename);
|
---|
| 1158 | if (f.exists() == true)
|
---|
| 1159 | {
|
---|
| 1160 | FileInputStream fis;
|
---|
| 1161 | fis = new FileInputStream(f);
|
---|
| 1162 | ois = new ObjectInputStream(fis);
|
---|
| 1163 | stack = (Vector) ois.readObject();
|
---|
| 1164 |
|
---|
| 1165 | Vector stack2;
|
---|
| 1166 | stack2 = null;
|
---|
| 1167 |
|
---|
| 1168 | try
|
---|
| 1169 | {
|
---|
| 1170 | stack2 = (Vector) ois.readObject();
|
---|
| 1171 | }
|
---|
| 1172 | catch (EOFException e) {stack2 = null;}
|
---|
| 1173 |
|
---|
| 1174 | if (stack2 != null)
|
---|
| 1175 | {
|
---|
| 1176 | File f2;
|
---|
| 1177 | f2 = new File("temp_history.log");
|
---|
| 1178 | FileOutputStream fos;
|
---|
| 1179 | fos = new FileOutputStream(f2);
|
---|
| 1180 | ObjectOutputStream oos;
|
---|
| 1181 | oos = new ObjectOutputStream(fos);
|
---|
| 1182 | oos.writeObject(stack2);
|
---|
| 1183 | oos.close();
|
---|
| 1184 | stack2.removeAllElements();
|
---|
| 1185 | stack2 = null;
|
---|
| 1186 | System.gc();
|
---|
| 1187 | }
|
---|
| 1188 |
|
---|
| 1189 | ois.close();
|
---|
| 1190 | return stack;
|
---|
| 1191 | }
|
---|
| 1192 | else
|
---|
| 1193 | stack = new Vector();
|
---|
| 1194 | }
|
---|
| 1195 | catch (IOException exp) {exp.printStackTrace();}
|
---|
| 1196 | catch (ClassNotFoundException exp2) {System.out.println("class exp");}
|
---|
| 1197 |
|
---|
| 1198 | return stack;
|
---|
| 1199 | }
|
---|
| 1200 |
|
---|
| 1201 | /**
|
---|
| 1202 | * This method will make sure that there is something running at the moment.
|
---|
| 1203 | */
|
---|
| 1204 | @SuppressWarnings("unused")
|
---|
| 1205 | private static void ensureEventThread()
|
---|
| 1206 | {
|
---|
| 1207 | if (SwingUtilities.isEventDispatchThread())
|
---|
| 1208 | {
|
---|
| 1209 | return;
|
---|
| 1210 | }
|
---|
| 1211 | throw new RuntimeException("something running");
|
---|
| 1212 | }
|
---|
| 1213 |
|
---|
| 1214 | /**
|
---|
| 1215 | * This method will called the Conformation window to show up.
|
---|
| 1216 | * @param err_array this is the array containing all the information taken when user doing the Feedback form.
|
---|
| 1217 | * @param imgFile this is the array conataining the String representation of the images taken when user doing the
|
---|
| 1218 | * Feedback form.
|
---|
| 1219 | */
|
---|
| 1220 | /*public void getVector(String[] err_array,String[] imgFile)
|
---|
| 1221 | {
|
---|
| 1222 | Conformation rd;
|
---|
| 1223 | rd = new Conformation(vector,err_array,imgFile,messages);
|
---|
| 1224 | return;
|
---|
| 1225 | }*/
|
---|
| 1226 |
|
---|
| 1227 | /**
|
---|
| 1228 | * This method will get the vector that hold the history.
|
---|
| 1229 | * @return the vector that hold the history stored so far.
|
---|
| 1230 | */
|
---|
| 1231 | @SuppressWarnings("rawtypes")
|
---|
| 1232 | public Vector getVector()
|
---|
| 1233 | {
|
---|
| 1234 | return vector;
|
---|
| 1235 | }
|
---|
| 1236 |
|
---|
| 1237 | /**
|
---|
| 1238 | * This class will catch the window opened and window closed event.
|
---|
| 1239 | * If an application open or close a window it will be listened by this class so the information
|
---|
| 1240 | * about that window and all the other open window can be took.
|
---|
| 1241 | */
|
---|
| 1242 | class MyEventQueue extends EventQueue
|
---|
| 1243 | {
|
---|
| 1244 | /**
|
---|
| 1245 | * This method will catch the window opened and window closed event.
|
---|
| 1246 | * If an application open or close a window it will be listened by this class so the information
|
---|
| 1247 | * about that window and all the other open window can be took.
|
---|
| 1248 | * @param evt its the event.
|
---|
| 1249 | */
|
---|
| 1250 | protected void dispatchEvent(AWTEvent evt)
|
---|
| 1251 | {
|
---|
| 1252 | super.dispatchEvent(evt);
|
---|
| 1253 | int id;
|
---|
| 1254 | id = evt.getID();
|
---|
| 1255 |
|
---|
| 1256 | if ((id == WindowEvent.WINDOW_OPENED)||(id == WindowEvent.WINDOW_CLOSED))
|
---|
| 1257 | {
|
---|
| 1258 | String command;
|
---|
| 1259 | command = " ";
|
---|
| 1260 |
|
---|
| 1261 | if (id == WindowEvent.WINDOW_OPENED) command = messages.getString("WindowOpened");
|
---|
| 1262 | else if (id == WindowEvent.WINDOW_CLOSED) command = messages.getString("WindowClosed");
|
---|
| 1263 |
|
---|
| 1264 | WindowEvent e;
|
---|
| 1265 | e = (WindowEvent) evt;
|
---|
| 1266 | Window comp;
|
---|
| 1267 | comp = e.getWindow();
|
---|
| 1268 |
|
---|
| 1269 | if ((comp instanceof ReportDetails.View)||
|
---|
| 1270 | (comp instanceof Movie))
|
---|
| 1271 | return;
|
---|
| 1272 |
|
---|
| 1273 | saving(comp,command);
|
---|
| 1274 | }
|
---|
| 1275 | }
|
---|
| 1276 | }
|
---|
| 1277 |
|
---|
| 1278 | /**
|
---|
| 1279 | * This method will take the screenshot of the whole screen.
|
---|
| 1280 | * @param p the window where user select to take screenshot.
|
---|
| 1281 | * @return the screenshot image.
|
---|
| 1282 | */
|
---|
| 1283 | //public byte[] recreateEvent (final Window p)
|
---|
| 1284 | public BufferedImage recreateEvent (final Window p)
|
---|
| 1285 | {
|
---|
| 1286 | setup_UIManager();
|
---|
| 1287 | Rectangle rect;
|
---|
| 1288 | int w, h;
|
---|
| 1289 |
|
---|
| 1290 | if (p != null)
|
---|
| 1291 | {
|
---|
| 1292 | w = p.getWidth();
|
---|
| 1293 | h = p.getHeight();
|
---|
| 1294 |
|
---|
| 1295 | try
|
---|
| 1296 | {
|
---|
| 1297 | rect = new Rectangle(p.getLocationOnScreen(),
|
---|
| 1298 | new Dimension(w,h));
|
---|
| 1299 | }
|
---|
| 1300 | catch (IllegalComponentStateException exp)
|
---|
| 1301 | {
|
---|
| 1302 | rect = null;
|
---|
| 1303 | }
|
---|
| 1304 | }
|
---|
| 1305 | else
|
---|
| 1306 | {
|
---|
| 1307 | rect = null;
|
---|
| 1308 | }
|
---|
| 1309 |
|
---|
| 1310 | if (rect != null)
|
---|
| 1311 | {
|
---|
| 1312 | //byte[] img;
|
---|
| 1313 | BufferedImage img;
|
---|
| 1314 | img = sh.captureScreen();
|
---|
| 1315 |
|
---|
| 1316 | return img;
|
---|
| 1317 | }
|
---|
| 1318 | else
|
---|
| 1319 | return null;
|
---|
| 1320 | }
|
---|
| 1321 |
|
---|
| 1322 | /**
|
---|
| 1323 | * This method will listen to any action event that occured.
|
---|
| 1324 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1325 | * window open when the action occured.
|
---|
| 1326 | * @param e the ActionEvent.
|
---|
| 1327 | */
|
---|
| 1328 | public void actionPerformed(ActionEvent e)
|
---|
| 1329 | {
|
---|
| 1330 | String command;
|
---|
| 1331 | command = e.getActionCommand();
|
---|
| 1332 | Component comp;
|
---|
| 1333 | comp = (Component)e.getSource();
|
---|
| 1334 |
|
---|
| 1335 | saving(comp,command);
|
---|
| 1336 |
|
---|
| 1337 | if (myframe == null)
|
---|
| 1338 | myframe = " ";
|
---|
| 1339 |
|
---|
| 1340 | if("FastSend".equals(e.getActionCommand()))
|
---|
| 1341 | {
|
---|
| 1342 | point.addMouseListener(mouse_blocker_listener);
|
---|
| 1343 | point.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
| 1344 |
|
---|
| 1345 | BufferedImage img;
|
---|
| 1346 | img = recreateEvent(point);
|
---|
| 1347 |
|
---|
| 1348 | if (stop_rec == true)
|
---|
| 1349 | {
|
---|
| 1350 | feedbackframe = myframe;
|
---|
| 1351 |
|
---|
| 1352 | JDialog.setDefaultLookAndFeelDecorated(true);
|
---|
| 1353 | stop_rec = false;
|
---|
| 1354 | frame = null;
|
---|
| 1355 | frame = new FeedbackInterface(sh,feedbackframe,messages,this);
|
---|
| 1356 | if ((img != null) && (savefinish == true))
|
---|
| 1357 | {
|
---|
| 1358 | int x,y,w,h,iw,ih;
|
---|
| 1359 | double wrat,hrat;
|
---|
| 1360 | Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
| 1361 |
|
---|
| 1362 | iw = (int) (dim.getWidth() - 60);
|
---|
| 1363 | ih = (int) (dim.getHeight() * 0.75) - 50;
|
---|
| 1364 |
|
---|
| 1365 | wrat = iw/((double)dim.getWidth());
|
---|
| 1366 | hrat = ih/((double)dim.getHeight());
|
---|
| 1367 |
|
---|
| 1368 | w = (int) (point.getWidth() * wrat);
|
---|
| 1369 | h = (int) (point.getHeight() * hrat);
|
---|
| 1370 | x = (int) (point.getLocationOnScreen().x * wrat);
|
---|
| 1371 | y = (int) (point.getLocationOnScreen().y * hrat);
|
---|
| 1372 |
|
---|
| 1373 | //frame.addScreenPanel(feedbackframe,sh.getBuffImage(),img);
|
---|
| 1374 | frame.addScreenPanel(feedbackframe,img,x,y,w,h);
|
---|
| 1375 | }
|
---|
| 1376 | frame.setVisible(false);
|
---|
| 1377 | }
|
---|
| 1378 | else
|
---|
| 1379 | {
|
---|
| 1380 | if ((img != null) &&(savefinish == true))
|
---|
| 1381 | {
|
---|
| 1382 | int x,y,w,h,iw,ih;
|
---|
| 1383 | double wrat,hrat;
|
---|
| 1384 | Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
| 1385 |
|
---|
| 1386 | iw = (int) (dim.getWidth() - 60);
|
---|
| 1387 | ih = (int) (dim.getHeight() * 0.75) - 50;
|
---|
| 1388 |
|
---|
| 1389 | wrat = iw/((double)dim.getWidth());
|
---|
| 1390 | hrat = ih/((double)dim.getHeight());
|
---|
| 1391 |
|
---|
| 1392 | w = (int) (point.getWidth() * wrat);
|
---|
| 1393 | h = (int) (point.getHeight() * hrat);
|
---|
| 1394 | x = (int) (point.getLocationOnScreen().x * wrat);
|
---|
| 1395 | y = (int) (point.getLocationOnScreen().y * hrat);
|
---|
| 1396 |
|
---|
| 1397 | //frame.addScreenPanel(feedbackframe,sh.getBuffImage(),img);
|
---|
| 1398 | if (point instanceof JDialog)
|
---|
| 1399 | ((JDialog) point).isModal();
|
---|
| 1400 |
|
---|
| 1401 | feedbackframe = myframe;
|
---|
| 1402 | frame.addScreenPanel(feedbackframe,img,x,y,w,h);
|
---|
| 1403 | }
|
---|
| 1404 | }
|
---|
| 1405 |
|
---|
| 1406 | ActionEvent evt;
|
---|
| 1407 | evt = new ActionEvent(frame.send_button,ActionEvent.ACTION_PERFORMED,messages.getString("Send"));
|
---|
| 1408 |
|
---|
| 1409 | frame.actionPerformed(evt);
|
---|
| 1410 |
|
---|
| 1411 | point.removeMouseListener(mouse_blocker_listener);
|
---|
| 1412 | point.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
| 1413 | }
|
---|
| 1414 |
|
---|
| 1415 | if(messages.getString("SendFeedback").equals(e.getActionCommand()))
|
---|
| 1416 | {
|
---|
| 1417 | setup_UIManager();
|
---|
| 1418 | //byte[] img;
|
---|
| 1419 | BufferedImage img;
|
---|
| 1420 | boolean modal;
|
---|
| 1421 |
|
---|
| 1422 | point.addMouseListener(mouse_blocker_listener);
|
---|
| 1423 | point.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
| 1424 |
|
---|
| 1425 | modal = false;
|
---|
| 1426 |
|
---|
| 1427 | img = recreateEvent(point);
|
---|
| 1428 | feedbackframe = myframe;
|
---|
| 1429 | if (point instanceof JDialog)
|
---|
| 1430 | modal = ((JDialog)point).isModal();
|
---|
| 1431 |
|
---|
| 1432 | JDialog.setDefaultLookAndFeelDecorated(true);
|
---|
| 1433 | stop_rec = false;
|
---|
| 1434 | frame = null;
|
---|
| 1435 | frame = new FeedbackInterface(sh,feedbackframe,messages,this);
|
---|
| 1436 | if ((img != null) && (savefinish == true))
|
---|
| 1437 | {
|
---|
| 1438 | int x,y,w,h,iw,ih;
|
---|
| 1439 | double wrat,hrat;
|
---|
| 1440 | Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
| 1441 |
|
---|
| 1442 | iw = (int) (dim.getWidth() - 60);
|
---|
| 1443 | ih = (int) (dim.getHeight() * 0.75) - 50;
|
---|
| 1444 |
|
---|
| 1445 | wrat = iw/((double)dim.getWidth());
|
---|
| 1446 | hrat = ih/((double)dim.getHeight());
|
---|
| 1447 |
|
---|
| 1448 | w = (int) (point.getWidth() * wrat);
|
---|
| 1449 | h = (int) (point.getHeight() * hrat);
|
---|
| 1450 | x = (int) (point.getLocationOnScreen().x * wrat);
|
---|
| 1451 | y = (int) (point.getLocationOnScreen().y * hrat);
|
---|
| 1452 |
|
---|
| 1453 | //frame.addScreenPanel(feedbackframe,sh.getBuffImage(),img);
|
---|
| 1454 | frame.addScreenPanel(feedbackframe,img,x,y,w,h);
|
---|
| 1455 | frame.setComment(modal);
|
---|
| 1456 |
|
---|
| 1457 | if (modal == true)
|
---|
| 1458 | {
|
---|
| 1459 | modalWindow = point;
|
---|
| 1460 | }
|
---|
| 1461 | }
|
---|
| 1462 |
|
---|
| 1463 | point.removeMouseListener(mouse_blocker_listener);
|
---|
| 1464 | point.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
| 1465 | }
|
---|
| 1466 |
|
---|
| 1467 | if ("ScreenShot".equals(e.getActionCommand()))
|
---|
| 1468 | {
|
---|
| 1469 | point.addMouseListener(mouse_blocker_listener);
|
---|
| 1470 | point.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
| 1471 |
|
---|
| 1472 | //byte[] img;
|
---|
| 1473 | BufferedImage img;
|
---|
| 1474 | boolean modal;
|
---|
| 1475 | modal = false;
|
---|
| 1476 | img = recreateEvent(point);
|
---|
| 1477 |
|
---|
| 1478 | if ((img != null) &&(savefinish == true))
|
---|
| 1479 | {
|
---|
| 1480 | int x,y,w,h,iw,ih;
|
---|
| 1481 | double wrat,hrat;
|
---|
| 1482 | Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
| 1483 |
|
---|
| 1484 | iw = (int) (dim.getWidth() - 60);
|
---|
| 1485 | ih = (int) (dim.getHeight() * 0.75) - 50;
|
---|
| 1486 |
|
---|
| 1487 | wrat = iw/((double)dim.getWidth());
|
---|
| 1488 | hrat = ih/((double)dim.getHeight());
|
---|
| 1489 |
|
---|
| 1490 | w = (int) (point.getWidth() * wrat);
|
---|
| 1491 | h = (int) (point.getHeight() * hrat);
|
---|
| 1492 | x = (int) (point.getLocationOnScreen().x * wrat);
|
---|
| 1493 | y = (int) (point.getLocationOnScreen().y * hrat);
|
---|
| 1494 |
|
---|
| 1495 | //frame.addScreenPanel(feedbackframe,sh.getBuffImage(),img);
|
---|
| 1496 | if (point instanceof JDialog)
|
---|
| 1497 | modal = ((JDialog) point).isModal();
|
---|
| 1498 |
|
---|
| 1499 | feedbackframe = myframe;
|
---|
| 1500 | frame.addScreenPanel(feedbackframe,img,x,y,w,h);
|
---|
| 1501 | frame.setComment(modal);
|
---|
| 1502 |
|
---|
| 1503 | if (modal == true)
|
---|
| 1504 | modalWindow = point;
|
---|
| 1505 | }
|
---|
| 1506 |
|
---|
| 1507 | point.removeMouseListener(mouse_blocker_listener);
|
---|
| 1508 | point.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
| 1509 | }
|
---|
| 1510 |
|
---|
| 1511 | if (messages.getString("LookHistory").equals(e.getActionCommand()))
|
---|
| 1512 | {
|
---|
| 1513 | point.addMouseListener(mouse_blocker_listener);
|
---|
| 1514 | point.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
---|
| 1515 |
|
---|
| 1516 | setup_UIManager();
|
---|
| 1517 | new ReportDetails(vector,null,null,messages,rec);
|
---|
| 1518 |
|
---|
| 1519 | point.removeMouseListener(mouse_blocker_listener);
|
---|
| 1520 | point.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
---|
| 1521 | }
|
---|
| 1522 | }
|
---|
| 1523 |
|
---|
| 1524 |
|
---|
| 1525 | /**
|
---|
| 1526 | * This method will listen to any Change event that occured.
|
---|
| 1527 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1528 | * window open when the action occured.
|
---|
| 1529 | * @param e the ChangeEvent.
|
---|
| 1530 | */
|
---|
| 1531 | public void stateChanged(ChangeEvent e)
|
---|
| 1532 | {
|
---|
| 1533 | String command;
|
---|
| 1534 | command = messages.getString("ChangeState");
|
---|
| 1535 | Object obj;
|
---|
| 1536 | obj = e.getSource();
|
---|
| 1537 |
|
---|
| 1538 | Component comp;
|
---|
| 1539 |
|
---|
| 1540 | if (obj instanceof Component)
|
---|
| 1541 | {
|
---|
| 1542 | comp = (Component)e.getSource();
|
---|
| 1543 | }
|
---|
| 1544 | else
|
---|
| 1545 | {
|
---|
| 1546 | if (modelHash.containsKey(obj) == true)
|
---|
| 1547 | {
|
---|
| 1548 | comp = (Component) modelHash.get(obj);
|
---|
| 1549 | }
|
---|
| 1550 | else
|
---|
| 1551 | {
|
---|
| 1552 | comp = null;
|
---|
| 1553 | System.out.println("weird" + obj.toString());
|
---|
| 1554 | }
|
---|
| 1555 | }
|
---|
| 1556 |
|
---|
| 1557 | saving(comp,command);
|
---|
| 1558 | }
|
---|
| 1559 |
|
---|
| 1560 | /**
|
---|
| 1561 | * This method will listen to any tree selection event that occured.
|
---|
| 1562 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1563 | * window open when the action occured.
|
---|
| 1564 | * @param e the TreeSelectionEvent.
|
---|
| 1565 | */
|
---|
| 1566 | public void valueChanged(TreeSelectionEvent e)
|
---|
| 1567 | {
|
---|
| 1568 | MutableTreeNode node;
|
---|
| 1569 | node = (MutableTreeNode)
|
---|
| 1570 | (e.getPath().getLastPathComponent());
|
---|
| 1571 |
|
---|
| 1572 | if (node == null) return;
|
---|
| 1573 |
|
---|
| 1574 | Object obj;
|
---|
| 1575 | obj = e.getSource();
|
---|
| 1576 |
|
---|
| 1577 | Component comp;
|
---|
| 1578 |
|
---|
| 1579 | if (obj instanceof Component)
|
---|
| 1580 | {
|
---|
| 1581 | comp = (Component)e.getSource();
|
---|
| 1582 | }
|
---|
| 1583 | else
|
---|
| 1584 | {
|
---|
| 1585 | if (modelHash.containsKey(obj) == true)
|
---|
| 1586 | {
|
---|
| 1587 | comp = (Component) modelHash.get(obj);
|
---|
| 1588 | }
|
---|
| 1589 | else
|
---|
| 1590 | {
|
---|
| 1591 | comp = null;
|
---|
| 1592 | System.out.println("weird" + obj.toString());
|
---|
| 1593 | }
|
---|
| 1594 | }
|
---|
| 1595 |
|
---|
| 1596 | String command;
|
---|
| 1597 | command = messages.getString("Node") + " ";
|
---|
| 1598 | if (node instanceof DefaultMutableTreeNode)
|
---|
| 1599 | command = command + ((DefaultMutableTreeNode)node).getUserObject() + " ";
|
---|
| 1600 | command = command + messages.getString("ValueChanged");
|
---|
| 1601 |
|
---|
| 1602 | saving(comp,command);
|
---|
| 1603 | }
|
---|
| 1604 |
|
---|
| 1605 | /**
|
---|
| 1606 | * This method will listen to any tree nodes change in the tree model event that occured.
|
---|
| 1607 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1608 | * window open when the action occured.
|
---|
| 1609 | * @param e the TreeModelEvent.
|
---|
| 1610 | */
|
---|
| 1611 | public void treeNodesChanged(TreeModelEvent e)
|
---|
| 1612 | {
|
---|
| 1613 | MutableTreeNode node;
|
---|
| 1614 | node = (MutableTreeNode)
|
---|
| 1615 | (e.getTreePath().getLastPathComponent());
|
---|
| 1616 |
|
---|
| 1617 | try {
|
---|
| 1618 | int index;
|
---|
| 1619 | index = e.getChildIndices()[0];
|
---|
| 1620 | node = (MutableTreeNode)(node.getChildAt(index));
|
---|
| 1621 | } catch (NullPointerException exc) {}
|
---|
| 1622 |
|
---|
| 1623 | Object obj;
|
---|
| 1624 | obj = e.getSource();
|
---|
| 1625 |
|
---|
| 1626 | Component comp;
|
---|
| 1627 |
|
---|
| 1628 | if (obj instanceof Component)
|
---|
| 1629 | {
|
---|
| 1630 | comp = (Component)e.getSource();
|
---|
| 1631 | }
|
---|
| 1632 | else
|
---|
| 1633 | {
|
---|
| 1634 | if (modelHash.containsKey(obj) == true)
|
---|
| 1635 | {
|
---|
| 1636 | comp = (Component) modelHash.get(obj);
|
---|
| 1637 | }
|
---|
| 1638 | else
|
---|
| 1639 | {
|
---|
| 1640 | comp = null;
|
---|
| 1641 | System.out.println("weird" + obj.toString());
|
---|
| 1642 | }
|
---|
| 1643 | }
|
---|
| 1644 |
|
---|
| 1645 | String command;
|
---|
| 1646 | command = messages.getString("Node");
|
---|
| 1647 |
|
---|
| 1648 | if (node instanceof DefaultMutableTreeNode)
|
---|
| 1649 | command = command + " " + ((DefaultMutableTreeNode)node).getUserObject();
|
---|
| 1650 |
|
---|
| 1651 | command = command + " " + messages.getString("Change");
|
---|
| 1652 |
|
---|
| 1653 | saving(comp,command);
|
---|
| 1654 | }
|
---|
| 1655 |
|
---|
| 1656 | /**
|
---|
| 1657 | * This method will listen to any tree nodes inserted in the tree model event that occured.
|
---|
| 1658 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1659 | * window open when the action occured.
|
---|
| 1660 | * @param e the TreeModelEvent.
|
---|
| 1661 | */
|
---|
| 1662 | public void treeNodesInserted(TreeModelEvent e)
|
---|
| 1663 | {
|
---|
| 1664 | MutableTreeNode node;
|
---|
| 1665 | node = (MutableTreeNode)
|
---|
| 1666 | (e.getTreePath().getLastPathComponent());
|
---|
| 1667 |
|
---|
| 1668 | try {
|
---|
| 1669 | int index;
|
---|
| 1670 | index = e.getChildIndices()[0];
|
---|
| 1671 | node = (MutableTreeNode)(node.getChildAt(index));
|
---|
| 1672 | } catch (NullPointerException exc) {}
|
---|
| 1673 |
|
---|
| 1674 | Object obj;
|
---|
| 1675 | obj = e.getSource();
|
---|
| 1676 |
|
---|
| 1677 | Component comp;
|
---|
| 1678 |
|
---|
| 1679 | if (obj instanceof Component)
|
---|
| 1680 | {
|
---|
| 1681 | comp = (Component)e.getSource();
|
---|
| 1682 | }
|
---|
| 1683 | else
|
---|
| 1684 | {
|
---|
| 1685 | if (modelHash.containsKey(obj) == true)
|
---|
| 1686 | {
|
---|
| 1687 | comp = (Component) modelHash.get(obj);
|
---|
| 1688 | }
|
---|
| 1689 | else
|
---|
| 1690 | {
|
---|
| 1691 | comp = null;
|
---|
| 1692 | System.out.println("weird" + obj.toString());
|
---|
| 1693 | }
|
---|
| 1694 | }
|
---|
| 1695 |
|
---|
| 1696 | String command;
|
---|
| 1697 | command = messages.getString("Node");
|
---|
| 1698 | if (node instanceof DefaultMutableTreeNode)
|
---|
| 1699 | command = command + " " + ((DefaultMutableTreeNode)node).getUserObject();
|
---|
| 1700 |
|
---|
| 1701 | command = command + " " + messages.getString("Inserted");
|
---|
| 1702 |
|
---|
| 1703 | saving(comp,command);
|
---|
| 1704 | }
|
---|
| 1705 |
|
---|
| 1706 | /**
|
---|
| 1707 | * This method will listen to any tree nodes removed in the tree model event that occured.
|
---|
| 1708 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1709 | * window open when the action occured.
|
---|
| 1710 | * @param e the TreeModelEvent.
|
---|
| 1711 | */
|
---|
| 1712 | public void treeNodesRemoved(TreeModelEvent e)
|
---|
| 1713 | {
|
---|
| 1714 | MutableTreeNode node;
|
---|
| 1715 | node = (MutableTreeNode)
|
---|
| 1716 | (e.getTreePath().getLastPathComponent());
|
---|
| 1717 |
|
---|
| 1718 | try {
|
---|
| 1719 | int index;
|
---|
| 1720 | index = e.getChildIndices()[0];
|
---|
| 1721 | node = (MutableTreeNode)(node.getChildAt(index));
|
---|
| 1722 | } catch (NullPointerException exc) {}
|
---|
| 1723 |
|
---|
| 1724 | Object obj;
|
---|
| 1725 | obj = e.getSource();
|
---|
| 1726 |
|
---|
| 1727 | Component comp;
|
---|
| 1728 |
|
---|
| 1729 | if (obj instanceof Component)
|
---|
| 1730 | {
|
---|
| 1731 | comp = (Component)e.getSource();
|
---|
| 1732 | }
|
---|
| 1733 | else
|
---|
| 1734 | {
|
---|
| 1735 | if (modelHash.containsKey(obj) == true)
|
---|
| 1736 | {
|
---|
| 1737 | comp = (Component) modelHash.get(obj);
|
---|
| 1738 | }
|
---|
| 1739 | else
|
---|
| 1740 | {
|
---|
| 1741 | comp = null;
|
---|
| 1742 | System.out.println("weird" + obj.toString());
|
---|
| 1743 | }
|
---|
| 1744 | }
|
---|
| 1745 |
|
---|
| 1746 | String command;
|
---|
| 1747 | command = messages.getString("Node");
|
---|
| 1748 | if (node instanceof DefaultMutableTreeNode)
|
---|
| 1749 | command = command + " " + ((DefaultMutableTreeNode)node).getUserObject();
|
---|
| 1750 | command = command + " " + messages.getString("Removed");
|
---|
| 1751 |
|
---|
| 1752 | saving(comp,command);
|
---|
| 1753 | }
|
---|
| 1754 |
|
---|
| 1755 | /**
|
---|
| 1756 | * This method will listen to any tree structure change in the tree model event that occured.
|
---|
| 1757 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1758 | * window open when the action occured.
|
---|
| 1759 | * @param e the TreeModelEvent.
|
---|
| 1760 | */
|
---|
| 1761 | public void treeStructureChanged(TreeModelEvent e)
|
---|
| 1762 | {
|
---|
| 1763 | Object obj;
|
---|
| 1764 | obj = e.getSource();
|
---|
| 1765 |
|
---|
| 1766 | Component comp;
|
---|
| 1767 |
|
---|
| 1768 | if (obj instanceof Component)
|
---|
| 1769 | {
|
---|
| 1770 | comp = (Component)e.getSource();
|
---|
| 1771 | }
|
---|
| 1772 | else
|
---|
| 1773 | {
|
---|
| 1774 | if (modelHash.containsKey(obj) == true)
|
---|
| 1775 | {
|
---|
| 1776 | comp = (Component) modelHash.get(obj);
|
---|
| 1777 | }
|
---|
| 1778 | else
|
---|
| 1779 | {
|
---|
| 1780 | comp = null;
|
---|
| 1781 | System.out.println("weird" + obj.toString());
|
---|
| 1782 | }
|
---|
| 1783 | }
|
---|
| 1784 |
|
---|
| 1785 | String command;
|
---|
| 1786 | command = messages.getString("TreeStructuredChanged");
|
---|
| 1787 |
|
---|
| 1788 | saving(comp,command);
|
---|
| 1789 | }
|
---|
| 1790 |
|
---|
| 1791 | /**
|
---|
| 1792 | * This method will listen to any item state change in the item event that occured.
|
---|
| 1793 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1794 | * window open when the action occured.
|
---|
| 1795 | * @param e the ItemEvent.
|
---|
| 1796 | */
|
---|
| 1797 | public void itemStateChanged(ItemEvent e)
|
---|
| 1798 | {
|
---|
| 1799 | Component comp;
|
---|
| 1800 | comp = (Component) e.getSource();
|
---|
| 1801 | String command;
|
---|
| 1802 | command = ((String) e.getItem()) + " " +
|
---|
| 1803 | messages.getString("ItemStateChanged");
|
---|
| 1804 |
|
---|
| 1805 | saving(comp,command);
|
---|
| 1806 | }
|
---|
| 1807 |
|
---|
| 1808 | /**
|
---|
| 1809 | * This method will listen to any contents change in the list data event that occured.
|
---|
| 1810 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1811 | * window open when the action occured.
|
---|
| 1812 | * @param e the ListDataEvent.
|
---|
| 1813 | */
|
---|
| 1814 | public void contentsChanged (ListDataEvent e)
|
---|
| 1815 | {
|
---|
| 1816 | Object obj;
|
---|
| 1817 | obj = e.getSource();
|
---|
| 1818 |
|
---|
| 1819 | Component comp;
|
---|
| 1820 |
|
---|
| 1821 | if (obj instanceof Component)
|
---|
| 1822 | {
|
---|
| 1823 | comp = (Component)e.getSource();
|
---|
| 1824 | }
|
---|
| 1825 | else
|
---|
| 1826 | {
|
---|
| 1827 | if (modelHash.containsKey(obj) == true)
|
---|
| 1828 | {
|
---|
| 1829 | comp = (Component) modelHash.get(obj);
|
---|
| 1830 | }
|
---|
| 1831 | else
|
---|
| 1832 | {
|
---|
| 1833 | comp = null;
|
---|
| 1834 | System.out.println("weird" + obj.toString());
|
---|
| 1835 | }
|
---|
| 1836 | }
|
---|
| 1837 |
|
---|
| 1838 | String command;
|
---|
| 1839 | command = messages.getString("ListChanged");
|
---|
| 1840 |
|
---|
| 1841 | saving(comp,command);
|
---|
| 1842 | }
|
---|
| 1843 |
|
---|
| 1844 | /**
|
---|
| 1845 | * This method will listen to any interval added in the list data event that occured.
|
---|
| 1846 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1847 | * window open when the action occured.
|
---|
| 1848 | * @param e the ListDataEvent.
|
---|
| 1849 | */
|
---|
| 1850 | public void intervalAdded (ListDataEvent e)
|
---|
| 1851 | {
|
---|
| 1852 | Object obj;
|
---|
| 1853 | obj = e.getSource();
|
---|
| 1854 |
|
---|
| 1855 | Component comp;
|
---|
| 1856 |
|
---|
| 1857 | if (obj instanceof Component)
|
---|
| 1858 | {
|
---|
| 1859 | comp = (Component)e.getSource();
|
---|
| 1860 | }
|
---|
| 1861 | else
|
---|
| 1862 | {
|
---|
| 1863 | if (modelHash.containsKey(obj) == true)
|
---|
| 1864 | {
|
---|
| 1865 | comp = (Component) modelHash.get(obj);
|
---|
| 1866 | }
|
---|
| 1867 | else
|
---|
| 1868 | {
|
---|
| 1869 | comp = null;
|
---|
| 1870 | System.out.println("weird" + obj.toString());
|
---|
| 1871 | }
|
---|
| 1872 | }
|
---|
| 1873 |
|
---|
| 1874 | String command;
|
---|
| 1875 | command = messages.getString("ListContentsAdded");
|
---|
| 1876 |
|
---|
| 1877 | saving(comp,command);
|
---|
| 1878 | }
|
---|
| 1879 |
|
---|
| 1880 | /**
|
---|
| 1881 | * This method will listen to any interval removed in the list data event that occured.
|
---|
| 1882 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1883 | * window open when the action occured.
|
---|
| 1884 | * @param e the ListDataEvent.
|
---|
| 1885 | */
|
---|
| 1886 | public void intervalRemoved (ListDataEvent e)
|
---|
| 1887 | {
|
---|
| 1888 | Object obj;
|
---|
| 1889 | obj = e.getSource();
|
---|
| 1890 |
|
---|
| 1891 | Component comp;
|
---|
| 1892 |
|
---|
| 1893 | if (obj instanceof Component)
|
---|
| 1894 | {
|
---|
| 1895 | comp = (Component)e.getSource();
|
---|
| 1896 | }
|
---|
| 1897 | else
|
---|
| 1898 | {
|
---|
| 1899 | if (modelHash.containsKey(obj) == true)
|
---|
| 1900 | {
|
---|
| 1901 | comp = (Component) modelHash.get(obj);
|
---|
| 1902 | }
|
---|
| 1903 | else
|
---|
| 1904 | {
|
---|
| 1905 | comp = null;
|
---|
| 1906 | System.out.println("weird" + obj.toString());
|
---|
| 1907 | }
|
---|
| 1908 | }
|
---|
| 1909 |
|
---|
| 1910 | String command;
|
---|
| 1911 | command = messages.getString("ListContentRemoved");
|
---|
| 1912 |
|
---|
| 1913 | saving(comp,command);
|
---|
| 1914 | }
|
---|
| 1915 |
|
---|
| 1916 | /**
|
---|
| 1917 | * This method will listen to any value changed in the list data event that occured.
|
---|
| 1918 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1919 | * window open when the action occured.
|
---|
| 1920 | * @param e the ListDataEvent.
|
---|
| 1921 | */
|
---|
| 1922 | public void valueChanged (ListSelectionEvent e)
|
---|
| 1923 | {
|
---|
| 1924 | Object obj;
|
---|
| 1925 | obj = e.getSource();
|
---|
| 1926 |
|
---|
| 1927 | Component comp;
|
---|
| 1928 |
|
---|
| 1929 | if (obj instanceof Component)
|
---|
| 1930 | {
|
---|
| 1931 | comp = (Component)e.getSource();
|
---|
| 1932 | }
|
---|
| 1933 | else
|
---|
| 1934 | {
|
---|
| 1935 | if (modelHash.containsKey(obj) == true)
|
---|
| 1936 | {
|
---|
| 1937 | comp = (Component) modelHash.get(obj);
|
---|
| 1938 | }
|
---|
| 1939 | else
|
---|
| 1940 | {
|
---|
| 1941 | comp = null;
|
---|
| 1942 | System.out.println("weird" + obj.toString());
|
---|
| 1943 | }
|
---|
| 1944 | }
|
---|
| 1945 |
|
---|
| 1946 | String command;
|
---|
| 1947 | command = messages.getString("ListValueChanged");
|
---|
| 1948 |
|
---|
| 1949 | saving(comp,command);
|
---|
| 1950 | }
|
---|
| 1951 |
|
---|
| 1952 | /**
|
---|
| 1953 | * This method will listen to any menu canceled in the menu event that occured.
|
---|
| 1954 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1955 | * window open when the action occured.
|
---|
| 1956 | * @param e the MenuEvent.
|
---|
| 1957 | */
|
---|
| 1958 | public void menuCanceled (MenuEvent e)
|
---|
| 1959 | {
|
---|
| 1960 | Component comp;
|
---|
| 1961 | comp = (Component) e.getSource();
|
---|
| 1962 | String command;
|
---|
| 1963 | command = messages.getString("MenuCanceled");
|
---|
| 1964 |
|
---|
| 1965 | saving(comp,command);
|
---|
| 1966 | }
|
---|
| 1967 |
|
---|
| 1968 | /**
|
---|
| 1969 | * This method will listen to any menu deselected in the menu event that occured.
|
---|
| 1970 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1971 | * window open when the action occured.
|
---|
| 1972 | * @param e the MenuEvent.
|
---|
| 1973 | */
|
---|
| 1974 | public void menuDeselected (MenuEvent e)
|
---|
| 1975 | {
|
---|
| 1976 | Component comp;
|
---|
| 1977 | comp = (Component) e.getSource();
|
---|
| 1978 | String command;
|
---|
| 1979 | command = messages.getString("MenuDeselected");
|
---|
| 1980 |
|
---|
| 1981 | saving(comp,command);
|
---|
| 1982 | }
|
---|
| 1983 |
|
---|
| 1984 | /**
|
---|
| 1985 | * This method will listen to any menu selected in the menu event that occured.
|
---|
| 1986 | * It will allow this special listener class to record all the information inside all the
|
---|
| 1987 | * window open when the action occured.
|
---|
| 1988 | * @param e the MenuEvent.
|
---|
| 1989 | */
|
---|
| 1990 | public void menuSelected(MenuEvent e)
|
---|
| 1991 | {
|
---|
| 1992 | Component comp;
|
---|
| 1993 | comp = (Component) e.getSource();
|
---|
| 1994 | String command;
|
---|
| 1995 | command = messages.getString("MenuSelected");
|
---|
| 1996 |
|
---|
| 1997 | saving(comp,command);
|
---|
| 1998 | }
|
---|
| 1999 |
|
---|
| 2000 | /**
|
---|
| 2001 | * This method will listen to any column added in the table column model event that occured.
|
---|
| 2002 | * It will allow this special listener class to record all the information inside all the
|
---|
| 2003 | * window open when the action occured.
|
---|
| 2004 | * @param e the TableColumnModelEvent.
|
---|
| 2005 | */
|
---|
| 2006 | public void columnAdded (TableColumnModelEvent e)
|
---|
| 2007 | {
|
---|
| 2008 | Object obj;
|
---|
| 2009 | obj = e.getSource();
|
---|
| 2010 |
|
---|
| 2011 | Component comp;
|
---|
| 2012 |
|
---|
| 2013 | if (obj instanceof Component)
|
---|
| 2014 | {
|
---|
| 2015 | comp = (Component)e.getSource();
|
---|
| 2016 | }
|
---|
| 2017 | else
|
---|
| 2018 | {
|
---|
| 2019 | if (modelHash.containsKey(obj) == true)
|
---|
| 2020 | {
|
---|
| 2021 | comp = (Component) modelHash.get(obj);
|
---|
| 2022 | }
|
---|
| 2023 | else
|
---|
| 2024 | {
|
---|
| 2025 | comp = null;
|
---|
| 2026 | System.out.println("weird" + obj.toString());
|
---|
| 2027 | }
|
---|
| 2028 | }
|
---|
| 2029 |
|
---|
| 2030 | String command;
|
---|
| 2031 | command = messages.getString("ColumnIndex") + " " + e.getToIndex()
|
---|
| 2032 | + messages.getString("AddedToTable");
|
---|
| 2033 |
|
---|
| 2034 | saving(comp,command);
|
---|
| 2035 | }
|
---|
| 2036 |
|
---|
| 2037 | public void columnMarginChanged(ChangeEvent e) {}
|
---|
| 2038 |
|
---|
| 2039 | /**
|
---|
| 2040 | * This method will listen to any column moved in the table column model event that occured.
|
---|
| 2041 | * It will allow this special listener class to record all the information inside all the
|
---|
| 2042 | * window open when the action occured.
|
---|
| 2043 | * @param e the TableColumnModelEvent.
|
---|
| 2044 | */
|
---|
| 2045 | public void columnMoved(TableColumnModelEvent e)
|
---|
| 2046 | {
|
---|
| 2047 | Object obj;
|
---|
| 2048 | obj = e.getSource();
|
---|
| 2049 |
|
---|
| 2050 | Component comp;
|
---|
| 2051 |
|
---|
| 2052 | if (obj instanceof Component)
|
---|
| 2053 | {
|
---|
| 2054 | comp = (Component)e.getSource();
|
---|
| 2055 | }
|
---|
| 2056 | else
|
---|
| 2057 | {
|
---|
| 2058 | if (modelHash.containsKey(obj) == true)
|
---|
| 2059 | {
|
---|
| 2060 | comp = (Component) modelHash.get(obj);
|
---|
| 2061 | }
|
---|
| 2062 | else
|
---|
| 2063 | {
|
---|
| 2064 | comp = null;
|
---|
| 2065 | System.out.println("weird" + obj.toString());
|
---|
| 2066 | }
|
---|
| 2067 | }
|
---|
| 2068 |
|
---|
| 2069 | String command;
|
---|
| 2070 | command = messages.getString("ColumnIndexFrom") + " " +
|
---|
| 2071 | e.getFromIndex() + " " +
|
---|
| 2072 | messages.getString("MovedToColumnIndex") + " " + e.getToIndex() +
|
---|
| 2073 | " " + messages.getString("InTheTable");
|
---|
| 2074 |
|
---|
| 2075 | saving(comp,command);
|
---|
| 2076 | }
|
---|
| 2077 |
|
---|
| 2078 | /**
|
---|
| 2079 | * This method will listen to any column removed in the table column model event that occured.
|
---|
| 2080 | * It will allow this special listener class to record all the information inside all the
|
---|
| 2081 | * window open when the action occured.
|
---|
| 2082 | * @param e the TableColumnModelEvent.
|
---|
| 2083 | */
|
---|
| 2084 | public void columnRemoved(TableColumnModelEvent e)
|
---|
| 2085 | {
|
---|
| 2086 | Object obj;
|
---|
| 2087 | obj = e.getSource();
|
---|
| 2088 |
|
---|
| 2089 | Component comp;
|
---|
| 2090 |
|
---|
| 2091 | if (obj instanceof Component)
|
---|
| 2092 | {
|
---|
| 2093 | comp = (Component)e.getSource();
|
---|
| 2094 | }
|
---|
| 2095 | else
|
---|
| 2096 | {
|
---|
| 2097 | if (modelHash.containsKey(obj) == true)
|
---|
| 2098 | {
|
---|
| 2099 | comp = (Component) modelHash.get(obj);
|
---|
| 2100 | }
|
---|
| 2101 | else
|
---|
| 2102 | {
|
---|
| 2103 | comp = null;
|
---|
| 2104 | System.out.println("weird" + obj.toString());
|
---|
| 2105 | }
|
---|
| 2106 | }
|
---|
| 2107 |
|
---|
| 2108 | String command;
|
---|
| 2109 | command = messages.getString("ColumnIndex") + " " + e.getFromIndex() +
|
---|
| 2110 | " " + messages.getString("RemovedFromTheTable");
|
---|
| 2111 |
|
---|
| 2112 | saving(comp,command);
|
---|
| 2113 | }
|
---|
| 2114 |
|
---|
| 2115 | public void columnSelectionChanged(ListSelectionEvent e) {}
|
---|
| 2116 | }
|
---|
| 2117 |
|
---|
| 2118 |
|
---|
| 2119 |
|
---|
| 2120 |
|
---|
| 2121 |
|
---|
| 2122 |
|
---|
| 2123 |
|
---|
| 2124 |
|
---|
| 2125 |
|
---|
| 2126 |
|
---|