/*
  i-net software provides programming examples for illustration only, without warranty
  either expressed or implied, including, but not limited to, the implied warranties
  of merchantability and/or fitness for a particular purpose. This programming example
  assumes that you are familiar with the programming language being demonstrated and
  the tools used to create and debug procedures. i-net software support professionals
  can help explain the functionality of a particular procedure, but they will not modify
  these examples to provide added functionality or construct procedures to meet your
  specific needs.
  © i-net software 1998-2010
*/

package samples.standalone;

import java.util.Properties;
import com.inet.report.Listener;

/**
 * This sample class extends the com.inet.report.Listener.
 * This sample shows you how to read, change or add a parameter of/to the report properties. 
 * You only need to overwrite the method checkProperties(Properties reportProperties) to read, 
 * change or add the value(s) of the report properties like datasource, prompt#, etc.
 * 
 * Please refer to the i-net Clear Reports documentation for the list of all parameters 
 * that you can read, change or add in/to the report properties. You can install the i-net Clear Reports 
 * documentation using the setup tool or you can read it online: 
 * http://www.inetsoftware.de/documentation/crystal-clear/online-help/features/report-url-parameters.html.
 */
public class ListenerWithMyHTMLProperties extends Listener {
    
    /**
     * Starts the listener.
     * @param standalone if true then this is a listener of a standalone application
     */
    public ListenerWithMyHTMLProperties(boolean standalone) {
        super( standalone, 0);
    }
    
    /**
     * Main method of this sample
     * @param args arguments not used
     */
    public static void main(String[] args) {
        try {
            new ListenerWithMyHTMLProperties(false);
        } catch(Throwable e){e.printStackTrace();}
    }
        
    /**
     * This method from the Listener you need to overwrite to modify the parameter values.
     * This method is empty in the Listener.
     * @param props The properties of the report that are specified in the report url.     
     */
    public void checkHtmlPageProperties(Properties props) {
        // Here you can see all properties that you can read, set or change.
        // You need to set only this property that you like to change or set.
        // For all other properties will be used the values from the url or from the rpt file.
        props.put("title",                 "i-net Clear Reports Viewer");
        props.put("bgcolor",               "C6C6C6");
        props.put("code",                  "com.inet.viewer.ViewerApplet");
        props.put("codebase",              "http://hostname/client");
        props.put("report",                "http://hostname:9000/?file:C:/report1.rpt");
        props.put("hasgrouptree",          "false");
        props.put("showgrouptree",         "false");
        props.put("hasexportbutton",       "false");
        props.put("hasrefreshbutton",      "true");
        props.put("hasprintbutton",        "true");
        props.put("hastextsearchcontrols", "true");
        props.put("hasloggingenabled",     "false"); // viewer does not print messages in the Java console
        props.put("archive",               "http://hostname/core/ReportViewer.jar");
    }
}

