1 /*
2 * $HeadURL: $
3 * $Date: $
4 * $Revision: $
5 * $Author: $
6 *
7 * Copyright (c) 2005 MindTree Consulting Ltd.
8 *
9 * This file is part of Insight.
10 *
11 * Insight is free software: you can redistribute it and/or modify it under the
12 * terms of the GNU General Public License as published by the Free Software
13 * Foundation, either version 3 of the License, or (at your option) any later
14 * version.
15 *
16 * Insight is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * Insight. If not, see <http://www.gnu.org/licenses/>.
23 */
24 package com.mindtree.techworks.insight.gui.action;
25
26 import java.awt.event.ActionEvent;
27
28 import javax.swing.AbstractAction;
29
30 import com.mindtree.techworks.insight.Controller;
31 import com.mindtree.techworks.insight.gui.Insight;
32
33 /**
34 *
35 * The <code>ClearDisplayAction</code> class is an AbstractAction derivative that
36 * resets the display of the Insight application
37 *
38 * @author Regunath B
39 * @version 1.0, 04/10/25
40 * @see com.mindtree.techworks.insight.gui.Insight
41 */
42
43 public class ClearDisplayAction extends AbstractAction {
44
45 /**
46 * Used for object serialization
47 */
48 private static final long serialVersionUID = -1048910165977800595L;
49
50 /**
51 * The Insight instance that created this Action instance
52 */
53 private Insight insight;
54
55 /**
56 * Constructor for this class
57 * @param insight the Insight that created an instance of this class
58 */
59 public ClearDisplayAction(Insight insight) {
60 this.insight = insight;
61 }
62
63 /**
64 * Overriden super class method. Resets the display widgets.
65 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
66 */
67 public void actionPerformed(ActionEvent e) {
68 Controller controller = this.insight.getController();
69 if(controller.getCurrentLogEventModel() != null){
70 controller.clearCurrentModel();
71 }
72 // Proactively call System.gc() to reclaim memory released because of LogEvent instances being cleared
73 System.gc();
74 }
75 }