001: /*
002: * GNetWatch
003: * Copyright 2006, 2007 Alexandre Fenyo
004: * gnetwatch@fenyo.net
005: *
006: * This file is part of GNetWatch.
007: *
008: * GNetWatch is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License as published by
010: * the Free Software Foundation; either version 2 of the License, or
011: * (at your option) any later version.
012: *
013: * GNetWatch is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with GNetWatch; if not, write to the Free Software
020: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
021: */
022:
023: package net.fenyo.gnetwatch.data;
024:
025: import java.lang.reflect.*;
026:
027: import net.fenyo.gnetwatch.*;
028: import net.fenyo.gnetwatch.GUI.*;
029: import net.fenyo.gnetwatch.targets.*;
030:
031: import java.util.*;
032:
033: import javax.swing.JFrame;
034: import javax.swing.JLabel;
035:
036: import org.apache.commons.logging.Log;
037: import org.apache.commons.logging.LogFactory;
038: import org.eclipse.swt.SWT;
039: import org.eclipse.swt.browser.Browser;
040: import org.eclipse.swt.graphics.Image;
041: import org.eclipse.swt.widgets.Control;
042: import org.eclipse.swt.widgets.Text;
043:
044: /**
045: * This view displays the received traffic (in pages per time unit) from a HTTP/FTP server.
046: * @author Alexandre Fenyo
047: * @version $Id: HTTPPagesView.java,v 1.2 2007/03/09 22:44:20 fenyo Exp $
048: */
049:
050: public class HTTPPagesView extends DataView {
051: private static Log log = LogFactory.getLog(HTTPPagesView.class);
052:
053: /**
054: * Constructor.
055: * @param gui current GUI instance.
056: * @param target ingress target interface.
057: */
058: // GUI thread
059: public HTTPPagesView(final GUI gui, final Target target) {
060: super (gui, target);
061: setItem("http pages");
062: }
063:
064: /**
065: * Creates a new display component.
066: * @param none.
067: * @return BasicComponent new display component.
068: */
069: protected BasicComponent createComponent() {
070: return new HTTPPagesComponent(getTarget());
071: }
072:
073: /**
074: * Removes every event relative to this view and to this target.
075: * @param none.
076: * @return void.
077: */
078: protected void disposed() {
079: super .disposed();
080: getTarget().removeEvents(EventHTTPPages.class);
081: }
082:
083: /**
084: * Returns the name of report this view can generate.
085: * @param none.
086: * @return String report name.
087: */
088: protected String browserName() {
089: // A LOCALISER
090: return "HTTP download";
091: }
092:
093: /**
094: * Returns the data unit for values this view can generate.
095: * @param none.
096: * @return String data unit.
097: */
098: protected String browserUnit() {
099: return "pages/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 browserEventClass() {
108: return EventHTTPPages.class;
109: }
110:
111: /**
112: * Returns a report as an HTML string.
113: * @param none.
114: * @return StringBull HTML report.
115: */
116: protected StringBuffer getBrowserContent() {
117: return super.getBrowserContent();
118: }
119: }
|