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 flooded traffic to an IP target.
046: * @author Alexandre Fenyo
047: * @version $Id: FloodView.java,v 1.8 2007/03/03 00:38:20 fenyo Exp $
048: */
049:
050: public class FloodView extends DataView {
051: private static Log log = LogFactory.getLog(ReachableView.class);
052:
053: /**
054: * Constructor.
055: * @param gui current GUI instance.
056: * @param target ingress target interface.
057: */
058: // GUI thread
059: public FloodView(final GUI gui, final Target target) {
060: super (gui, target);
061: setItem("flood");
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 FloodComponent(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(EventFlood.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: return "Flooding";
090: }
091:
092: /**
093: * Returns the data unit for values this view can generate.
094: * @param none.
095: * @return String data unit.
096: */
097: protected String browserUnit() {
098: return "bit/s";
099: }
100:
101: /**
102: * Returns the event class this view can manage.
103: * @param none.
104: * @return Class event class.
105: */
106: protected Class browserEventClass() {
107: return EventFlood.class;
108: }
109:
110: /**
111: * Returns a report as an HTML string.
112: * @param none.
113: * @return StringBull HTML report.
114: */
115: protected StringBuffer getBrowserContent() {
116: return super.getBrowserContent();
117: }
118: }
|