KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > clif > analyser > lib > gui > GraphAnalyser


1 /* A simple plot application with two plots
2
3  Copyright (c) 1998-1999 The Regents of the University of California.
4  All rights reserved.
5  Permission is hereby granted, without written agreement and without
6  license or royalty fees, to use, copy, modify, and distribute this
7  software and its documentation for any purpose, provided that the above
8  copyright notice and the following two paragraphs appear in all copies
9  of this software.
10
11  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
12  FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
13  ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
14  THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
15  SUCH DAMAGE.
16
17  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
18  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
20  PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
21  CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
22  ENHANCEMENTS, OR MODIFICATIONS.
23
24                                         PT_COPYRIGHT_VERSION_2
25                                        COPYRIGHTENDKEY
26 @ProposedRating red (eal@eecs.berkeley.edu)
27 @AcceptedRating red (cxh@eecs.berkeley.edu)
28 */

29
30 package org.objectweb.clif.analyser.lib.gui;
31
32 import ptolemy.plot.Plot;
33 import java.awt.*;
34 import java.io.File JavaDoc;
35 import java.io.FileInputStream JavaDoc;
36 import java.io.FileNotFoundException JavaDoc;
37 import java.io.IOException JavaDoc;
38 import org.objectweb.clif.analyser.View;
39
40
41
42
43 /** Implementation of the bidimensional graph of the Manual Analyser Interfaces
44  *
45  * @author Damien Croizer
46  * @version $Id: GraphAnalyser.java,v 1.3 2005/01/20 09:42:57 croizeda Exp $
47  */

48
49 public class GraphAnalyser extends Frame {
50
51   
52     public GraphAnalyser() {
53     }
54
55     public Plot init()
56     {
57         Plot rightPlot = new Plot();
58     rightPlot.clear(true);
59     rightPlot.setSize(590,390);
60         rightPlot.setTitle("");
61     return rightPlot;
62     }
63
64
65     public Plot update(View vue)
66     {
67         Plot rightPlot = new Plot();
68     String JavaDoc input = new String JavaDoc("report/"+vue.getTestId() + "/vues/" + vue.getName() + ".view");
69     File JavaDoc file = new File JavaDoc(input);
70         try {
71             rightPlot.clear(true);
72             rightPlot.read(new FileInputStream JavaDoc(file));
73         } catch (FileNotFoundException JavaDoc ex) {
74             System.out.println("File not found: " + file + " : " + ex);
75         } catch (IOException JavaDoc ex) {
76             System.out.println("Error reading input: " + file +
77                    " : " + ex);
78         }
79         // Override the title in the file.
80
rightPlot.setTitle("Test name: "+ vue.getTestId() + " View name: "+ vue.getName());
81     rightPlot.setXLabel("testing time in ms");
82     rightPlot.setYLabel("hits per second");
83     rightPlot.setSize(590,390);
84     return rightPlot;
85     }
86
87
88 }
89
Popular Tags