View Javadoc
1   package net.logAnalyzer.reports;
2   
3   import java.awt.image.BufferedImage;
4   import java.io.IOException;
5   
6   import javax.swing.JComponent;
7   
8   /***
9    * This interface defines the methods needed to manipulate generated reports.
10   * Generated reports could be based on an XML Document as
11   * {@link net.logAnalyzer.reports.XMLReport}, a chart as
12   * {@link net.logAnalyzer.reports.ChartReport} or simple plain text buffer as
13   * {@link net.logAnalyzer.reports.TXTReport} or any other implementation of
14   * yours.
15   * 
16   * @author Karim REFEYTON
17   * @version 0.1
18   */
19  public interface LAReport {
20      /***
21       * Return the file extension of the report.
22       * 
23       * @return Report file name extension.
24       */
25      public String getFileExtension();
26  
27      /***
28       * Return the name of the report.
29       * 
30       * @return Report name.
31       */
32      public String getName();
33  
34      /***
35       * Set the name of the report.
36       * 
37       * @param name
38       *            Report name.
39       */
40      public void setName(String name);
41  
42      /***
43       * Return the mime type of the report.
44       * 
45       * @return Mime type of the report.
46       */
47      public String getMimeType();
48  
49      /***
50       * Save the report with the specified filename. The filename can contain a
51       * relative or absolute path.
52       * <p>
53       * If the file exists, it is overwritten.
54       * </p>
55       * 
56       * @param filename
57       *            Name of the output file.
58       * @throws IOException
59       *             If an I/O exception occurs.
60       */
61      public void saveToFile(String filename) throws IOException;
62  
63      /***
64       * Create an image from the report as a {@link BufferedImage}.
65       * 
66       * @param width
67       *            Image width.
68       * @param height
69       *            Image height.
70       * @return Image from the report; <tt>null</tt> if unsupported feature.
71       */
72      public BufferedImage createBufferedImage(int width, int height);
73  
74      /***
75       * Create the GUI displaying the report as a {@link JComponent} component.
76       * 
77       * @return GUI showing the report.
78       */
79      public JComponent createGUI();
80  
81      /***
82       * Return the string representation of the report.
83       * 
84       * @return String report.
85       * @see java.lang.Object#toString()
86       */
87      public String toString();
88  }