1 2 23 24 package net.fenyo.gnetwatch.GUI; 25 26 import java.io.*; 27 import java.util.Date ; 28 import java.awt.*; 29 import java.awt.event.WindowEvent ; 30 import java.awt.font.*; 31 import java.awt.geom.*; 32 import java.awt.image.*; 33 import javax.swing.*; 34 import javax.imageio.*; 35 36 import net.fenyo.gnetwatch.data.*; 37 import net.fenyo.gnetwatch.targets.*; 38 39 import org.apache.commons.logging.Log; 40 import org.apache.commons.logging.LogFactory; 41 42 47 48 public class BytesSentComponent extends BasicComponent { 49 private static Log log = LogFactory.getLog(BytesSentComponent.class); 50 51 55 public BytesSentComponent(final Target target) { 57 super(target); 58 } 59 60 65 public long getDelayPerInterval() { 66 return 60000; 67 } 68 69 74 public void windowClosing(final WindowEvent e) { 76 getTarget().unregisterComponent(this, EventBytesSent.class); 77 } 78 79 84 protected void updateValues() { 87 synchronized (getSyncUpdate()) { 88 getTarget().registerComponent(this, EventBytesSent.class); 89 final long end = System.currentTimeMillis(); 90 final long begin = end - getDelayPerInterval() * 91 (getDimension().width - axis_margin_left - axis_margin_right) / pixels_per_interval; 92 setEvents(getTarget().getEvents(new Date (begin), new Date (end), EventBytesSent.class)); 93 updateVerticalScale(); 94 } 95 } 96 } 97 | Popular Tags |