KickJava   Java API By Example, From Geeks To Geeks.

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


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 received traffic (in pages per time unit) from a HTTP/FTP server.
47  * @author Alexandre Fenyo
48  * @version $Id: HTTPPagesView.java,v 1.2 2007/03/09 22:44:20 fenyo Exp $
49  */

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

59   // GUI thread
60
public HTTPPagesView(final GUI gui, final Target target) {
61     super(gui, target);
62     setItem("http pages");
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 HTTPPagesComponent(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(EventHTTPPages.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     // A LOCALISER
91
return "HTTP download";
92   }
93
94   /**
95    * Returns the data unit for values this view can generate.
96    * @param none.
97    * @return String data unit.
98    */

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

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

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