diff --git a/src/net/i2p/itoopie/gui/component/Chart.java b/src/net/i2p/itoopie/gui/component/Chart.java deleted file mode 100644 index 8ab2e26df..000000000 --- a/src/net/i2p/itoopie/gui/component/Chart.java +++ /dev/null @@ -1,181 +0,0 @@ -package net.i2p.itoopie.gui.component; - -import info.monitorenter.gui.chart.Chart2D; -import info.monitorenter.gui.chart.ITrace2D; -import info.monitorenter.gui.chart.ITracePainter; -import info.monitorenter.gui.chart.rangepolicies.RangePolicyMinimumViewport; -import info.monitorenter.gui.chart.traces.Trace2DLtd; -import info.monitorenter.gui.chart.traces.painters.TracePainterPolyline; -import info.monitorenter.gui.chart.views.ChartPanel; -import info.monitorenter.reflection.ObjRecorder2Trace2DAdapter; -import info.monitorenter.util.Range; - -import java.awt.BasicStroke; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Container; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import javax.swing.JFrame; - -/** - * A test for the Chart2D that constantly adds new tracepoints to a - * Trace2DLtd. Mainly the runtime- scaling is interesting. - *

- * Furthermore this is an example on how to connect other components to the - * Chart2D using an adaptor- class. If interested have a look on - * {@link info.monitorenter.reflection.ObjRecorder2Trace2DAdapter}. - *

- * - * @author Achim Westermann - * @version $Revision: 1.5 $ - */ -public class Chart extends JFrame { - /** - * Helper class that holds an internal number that is randomly modified by a - * Thread. - *

- * - * @author Achim Westermann - * @version $Revision: 1.5 $ - */ - static class RandomBumper extends Thread { - /** Streches or compresses the grade of jumping of the internal number. */ - protected double m_factor; - - /** The bumping number. */ - protected double m_number = 0; - - /** The propability of an increase versus a decrease of the bumped number. */ - protected double m_plusminus = 0.5; - - /** Needed for randomization of bumping the number. */ - protected java.util.Random m_randomizer = new java.util.Random(); - - /** - * Creates an instance. - *

- * - * @param plusminus - * probability to increase or decrease the number each step. - * @param factor - * affects the amplitude of the number (severity of jumps). - */ - public RandomBumper(final double plusminus, final int factor) { - - if (plusminus < 0 || plusminus > 1) { - System.out.println(this.getClass().getName() - + " ignores constructor-passed value. Must be between 0.0 and 1.0!"); - } else { - this.m_plusminus = plusminus; - } - this.m_factor = factor; - this.setDaemon(true); - this.start(); - } - - /** - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - - while (true) { - double rand = this.m_randomizer.nextDouble(); - if (rand < this.m_plusminus) { - this.m_number += this.m_randomizer.nextDouble() * this.m_factor; - } else { - this.m_number -= this.m_randomizer.nextDouble() * this.m_factor; - } - - try { - Thread.sleep(20); - } catch (InterruptedException e) { - // nop - } - - } - } - } - - /** - * Generated for serialVersionUID. - */ - private static final long serialVersionUID = 3545231432038627123L; - - /** - * Main entry. - *

- * - * @param args - * ignored. - */ - public static void main(final String[] args) { - - Chart2D chart = new Chart2D(); - chart.setUseAntialiasing(true); - chart.setMinPaintLatency(20); - ITrace2D data = new Trace2DLtd(300); - data.setStroke(new BasicStroke(3)); - data.setColor(new Color(255, 0, 0, 255)); - data.setName("random"); - data.setPhysicalUnits("hertz", "ms"); - - ITracePainter dotPainter = new TracePainterPolyline(); - data.setTracePainter(dotPainter); - chart.addTrace(data); - - Chart wnd = new Chart(chart, "AntialiasingChart"); - chart.getAxisX().setPaintGrid(true); - chart.getAxisX().setStartMajorTick(false); - chart.getAxisY().setPaintGrid(true); - - chart.getAxisX().setPaintScale(true); - chart.getAxisX().setPaintScale(true); - - // force ranges: - chart.getAxisY().setRangePolicy(new RangePolicyMinimumViewport(new Range(0, 20))); - // chart.setFont(new Font(null,0,12)); - wnd.setLocation(200, 300); - wnd.setSize(700, 210); - wnd.setResizable(true); - wnd.setVisible(true); - new ObjRecorder2Trace2DAdapter(data, new RandomBumper(0.5, 1000), "m_number", 1000); - } - - /** The chart to use. */ - protected Chart2D m_chart = null; - - /** - * Creates an instance that will dynamically paint on the chart to a trace - * with the given label. - *

- * - * @param chart - * the chart to use. - * @param label - * the name of the trace too display. - */ - public Chart(final Chart2D chart, final String label) { - - super(label); - this.m_chart = chart; - this.addWindowListener(new WindowAdapter() { - /** - * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent) - */ - @Override - public void windowClosing(final WindowEvent e) { - - Chart.this.setVisible(false); - Chart.this.dispose(); - System.exit(0); - - } - }); - Container contentPane = this.getContentPane(); - contentPane.setLayout(new BorderLayout()); - contentPane.add(new ChartPanel(this.m_chart), BorderLayout.CENTER); - } -} \ No newline at end of file