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.widgets.Control;
041: import org.eclipse.swt.widgets.Text;
042:
043: /**
044: * This view displays SNMP counters relative to egress interfaces.
045: * @author Alexandre Fenyo
046: * @version $Id: BytesSentView.java,v 1.8 2007/03/03 00:38:20 fenyo Exp $
047: */
048:
049: public class BytesSentView extends DataView {
050: private static Log log = LogFactory.getLog(BytesSentView.class);
051:
052: /**
053: * Constructor.
054: * @param gui current GUI instance.
055: * @param target ingress target interface.
056: */
057: // GUI thread
058: public BytesSentView(final GUI gui, final Target target) {
059: super (gui, target);
060: setItem("egress");
061: }
062:
063: /**
064: * Creates a new display component.
065: * @param none.
066: * @return BasicComponent new display component.
067: */
068: protected BasicComponent createComponent() {
069: return new BytesSentComponent(getTarget());
070: }
071:
072: /**
073: * Removes every event relative to this view and to this target.
074: * @param none.
075: * @return void.
076: */
077: protected void disposed() {
078: super .disposed();
079: getTarget().removeEvents(EventBytesSent.class);
080: }
081:
082: /**
083: * Returns the name of report this view can generate.
084: * @param none.
085: * @return String report name.
086: */
087: protected String browserName() {
088: return getGUI().getConfig().getString("egress_interface");
089: }
090:
091: /**
092: * Returns the data unit for values this view can generate.
093: * @param none.
094: * @return String data unit.
095: */
096: protected String browserUnit() {
097: return "bit/s";
098: }
099:
100: /**
101: * Returns the event class this view can manage.
102: * @param none.
103: * @return Class event class.
104: */
105: protected Class browserEventClass() {
106: return EventBytesSent.class;
107: }
108:
109: /**
110: * Returns a report as an HTML string.
111: * @param none.
112: * @return StringBull HTML report.
113: */
114: protected StringBuffer getBrowserContent() {
115: return super.getBrowserContent();
116: }
117: }
|