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.EventReachable; 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 ChartComponent extends BasicComponent { 49 private static Log log = LogFactory.getLog(ChartComponent.class); 50 51 55 public ChartComponent(final Target target) { 57 super(target); 58 } 59 60 65 public void windowClosing(final WindowEvent e) { 67 getTarget().unregisterComponent(this, EventReachable.class); 68 } 69 70 75 protected void updateValues() { 78 synchronized (getSyncUpdate()) { 79 getTarget().registerComponent(this, EventReachable.class); 80 final long end = System.currentTimeMillis(); 81 final long begin = end - getDelayPerInterval() * 82 (getDimension().width - axis_margin_left - axis_margin_right) / pixels_per_interval; 83 setEvents(getTarget().getEvents(new Date (begin), new Date (end), EventReachable.class)); 84 updateVerticalScale(); 85 } 86 } 87 } 88 | Popular Tags |