KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > fenyo > gnetwatch > data > FloodView


1
2 /*
3  * GNetWatch
4  * Copyright 2006, 2007 Alexandre Fenyo
5  * gnetwatch@fenyo.net
6  *
7  * This file is part of GNetWatch.
8  *
9  * GNetWatch is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * GNetWatch is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with GNetWatch; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  */

23
24 package net.fenyo.gnetwatch.data;
25
26 import java.lang.reflect.*;
27
28 import net.fenyo.gnetwatch.*;
29 import net.fenyo.gnetwatch.GUI.*;
30 import net.fenyo.gnetwatch.targets.*;
31
32 import java.util.*;
33
34 import javax.swing.JFrame JavaDoc;
35 import javax.swing.JLabel JavaDoc;
36
37 import org.apache.commons.logging.Log;
38 import org.apache.commons.logging.LogFactory;
39 import org.eclipse.swt.SWT;
40 import org.eclipse.swt.browser.Browser;
41 import org.eclipse.swt.graphics.Image;
42 import org.eclipse.swt.widgets.Control;
43 import org.eclipse.swt.widgets.Text;
44
45 /**
46  * This view displays the flooded traffic to an IP target.
47  * @author Alexandre Fenyo
48  * @version $Id: FloodView.java,v 1.8 2007/03/03 00:38:20 fenyo Exp $
49  */

50
51 public class FloodView extends DataView {
52   private static Log log = LogFactory.getLog(ReachableView.class);
53
54   /**
55    * Constructor.
56    * @param gui current GUI instance.
57    * @param target ingress target interface.
58    */

59   // GUI thread
60
public FloodView(final GUI gui, final Target target) {
61     super(gui, target);
62     setItem("flood");
63   }
64
65   /**
66    * Creates a new display component.
67    * @param none.
68    * @return BasicComponent new display component.
69    */

70   protected BasicComponent createComponent() {
71     return new FloodComponent(getTarget());
72   }
73
74   /**
75    * Removes every event relative to this view and to this target.
76    * @param none.
77    * @return void.
78    */

79   protected void disposed() {
80     super.disposed();
81     getTarget().removeEvents(EventFlood.class);
82   }
83
84   /**
85    * Returns the name of report this view can generate.
86    * @param none.
87    * @return String report name.
88    */

89   protected String JavaDoc browserName() {
90     return "Flooding";
91   }
92
93   /**
94    * Returns the data unit for values this view can generate.
95    * @param none.
96    * @return String data unit.
97    */

98   protected String JavaDoc browserUnit() {
99     return "bit/s";
100   }
101
102   /**
103    * Returns the event class this view can manage.
104    * @param none.
105    * @return Class event class.
106    */

107   protected Class JavaDoc browserEventClass() {
108     return EventFlood.class;
109   }
110
111   /**
112    * Returns a report as an HTML string.
113    * @param none.
114    * @return StringBull HTML report.
115    */

116   protected StringBuffer JavaDoc getBrowserContent() {
117     return super.getBrowserContent();
118   }
119 }
120
Popular Tags