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.Component;
27 import java.awt.event.ActionEvent;
28
29 import javax.swing.AbstractAction;
30
31 import com.mindtree.techworks.insight.Controller;
32
33 /**
34 *
35 * The <code>LoadPageAction</code> class is an AbstractAction derivative that
36 * loads the pages from cache
37 *
38 * @author Antony
39 * @version 1.0, 04/10/25
40 * @see com.mindtree.techworks.insight.gui.Insight
41 */
42
43 public class LoadPageAction extends AbstractAction {
44
45 /**
46 * Used for object serialization
47 */
48 private static final long serialVersionUID = 2232778228085377626L;
49
50 /**
51 * The Controller instance
52 */
53 private Controller controller;
54
55 /**
56 * Constructor for this class
57 * @param controller the Insight that created an instance of this class
58 */
59 public LoadPageAction(Controller controller) {
60 this.controller = controller;
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 String direction = ((Component)e.getSource()).getName();
69 if(controller.getCurrentLogEventModel().getPageSet() != null){
70 controller.getCurrentLogEventModel().getPageSet().navigate(direction);
71 long currLogEventCnt = controller.getCurrentLogEventModel().getPageSet().getCurrentPage().getLogEventList().size();
72 controller.getCurrentLogEventModel().setProcessedEventCount(currLogEventCnt);
73 controller.firePageChanged();
74 }
75 }
76 }