KickJava   Java API By Example, From Geeks To Geeks.

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


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.widgets.Control;
42 import org.eclipse.swt.widgets.Text;
43
44 /**
45  * This view displays SNMP counters relative to egress interfaces.
46  * @author Alexandre Fenyo
47  * @version $Id: BytesSentView.java,v 1.8 2007/03/03 00:38:20 fenyo Exp $
48  */

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

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

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

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

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

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

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

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