ChartApplet.java
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:59k
源码类别:

OA系统

开发平台:

Java

  1. // Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2002-12-21 10:58:01
  2. // Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
  3. // Decompiler options: packimports(3) 
  4. // Source File Name:   ChartApplet.java
  5. package cn.com.fcsoft.chart;
  6. import java.applet.Applet;
  7. import java.applet.AppletContext;
  8. import java.awt.*;
  9. import java.awt.event.*;
  10. import java.io.PrintStream;
  11. import java.net.MalformedURLException;
  12. import java.net.URL;
  13. import java.util.*;
  14. // Referenced classes of package com.objectplanet.chart:
  15. //            ChartSample, Chart, LineChartApplet, BarChartApplet, 
  16. //            PieChartApplet, NonFlickerPanel
  17. public abstract class ChartApplet extends Applet
  18.     implements Runnable, ItemListener, MouseMotionListener
  19. {
  20.     public void stop()
  21.     {
  22.         if(refreshThread != null)
  23.         {
  24.             refreshThread.stop();
  25.             refreshThread = null;
  26.         }
  27.     }
  28.     protected Color[] getColorValues(String s)
  29.     {
  30.         Color acolor[] = null;
  31.         if(s != null)
  32.         {
  33.             StringTokenizer stringtokenizer = new StringTokenizer(s, ",");
  34.             acolor = new Color[stringtokenizer.countTokens()];
  35.             for(int i = 0; i < acolor.length; i++)
  36.                 if(stringtokenizer.hasMoreTokens())
  37.                     acolor[i] = createColor(stringtokenizer.nextToken().trim());
  38.         }
  39.         return acolor;
  40.     }
  41.     private URL getSampleURL(int i, int j, int k)
  42.     {
  43.         String s = createURLParam("url", j, k);
  44.         URL url = (URL)urlList.get(s);
  45.         if(url == null)
  46.         {
  47.             String s1;
  48.             if(i > 1)
  49.                 s1 = createURLParam("url", j, -1);
  50.             else
  51.                 s1 = createURLParam("url", -1, k);
  52.             url = (URL)urlList.get(s1);
  53.         }
  54.         if(url == null)
  55.             url = (URL)urlList.get(createURLParam("url", -1, -1));
  56.         return url;
  57.     }
  58.     public void reset()
  59.     {
  60.         urlList = new Hashtable();
  61.         urlTargetList = new Hashtable();
  62.         HAND_CURSOR = new Cursor(12);
  63.         POINT_CURSOR = new Cursor(0);
  64.         lastSelectedSample = -1;
  65.         lastSelectedSeries = -1;
  66.         theChart.reset();
  67.     }
  68.     public void mouseDragged(MouseEvent mouseevent)
  69.     {
  70.     }
  71.     public ChartApplet()
  72.     {
  73.         labelDelimiter = ",";
  74.         automaticRefreshTime = 2500;
  75.         rangeStep = new double[2];
  76.         theChart = createChart(null);
  77.         overlayChartApplets = new Vector();
  78.         prefix = "";
  79.         setLayout(new BorderLayout());
  80.         theChart.addItemListener(this);
  81.         theChart.addMouseMotionListener(this);
  82.     }
  83.     public void itemStateChanged(ItemEvent itemevent)
  84.     {
  85.         ChartSample chartsample = (ChartSample)itemevent.getItem();
  86.         Chart chart = (Chart)itemevent.getSource();
  87.         if(itemevent.getStateChange() == 1 && chartsample != null && chart != null)
  88.         {
  89.             int i = chart.getSeriesCount();
  90.             int j = chartsample.getIndex();
  91.             int k = chartsample.getSeries();
  92.             long l = System.currentTimeMillis();
  93.             boolean flag = j == lastSelectedSample && k == lastSelectedSeries;
  94.             if(flag && l - lastSelectedTime < 350L)
  95.             {
  96.                 URL url = getSampleURL(i, k, j);
  97.                 if(url != null)
  98.                 {
  99.                     String s = createURLParam("urltarget", k, j);
  100.                     String s1 = (String)urlTargetList.get(s);
  101.                     if(s1 == null)
  102.                     {
  103.                         String s2;
  104.                         if(i > 1)
  105.                             s2 = createURLParam("urltarget", k, -1);
  106.                         else
  107.                             s2 = createURLParam("urltarget", -1, j);
  108.                         s1 = (String)urlTargetList.get(s2);
  109.                     }
  110.                     if(s1 == null)
  111.                         s1 = (String)urlTargetList.get("urltarget");
  112.                     AppletContext appletcontext = getAppletContext();
  113.                     if(appletcontext != null)
  114.                         appletcontext.showDocument(url, s1);
  115.                 }
  116.             }
  117.             lastSelectedSample = j;
  118.             lastSelectedSeries = k;
  119.             lastSelectedTime = l;
  120.         }
  121.     }
  122.     public void mouseMoved(MouseEvent mouseevent)
  123.     {
  124.         if(urlList.size() == 0)
  125.             return;
  126.         Chart chart = (Chart)mouseevent.getSource();
  127.         ChartSample chartsample = chart.checkSelection(new Point(mouseevent.getX(), mouseevent.getY()));
  128.         int i = chart.getSeriesCount();
  129.         Cursor cursor = POINT_CURSOR;
  130.         if(chartsample != null)
  131.         {
  132.             URL url = getSampleURL(i, chartsample.getSeries(), chartsample.getIndex());
  133.             if(url != null)
  134.                 cursor = HAND_CURSOR;
  135.         }
  136.         setCursor(cursor);
  137.     }
  138.     private boolean shouldSet(String s, boolean flag)
  139.     {
  140.         String s1 = getParameter(s);
  141.         return s1 != null && s1.trim().length() > 0 || flag;
  142.     }
  143.     static String convertLineBreaks(String s)
  144.     {
  145.         if(s == null)
  146.             return null;
  147.         char ac[] = s.toCharArray();
  148.         char ac1[] = new char[ac.length];
  149.         int i = 0;
  150.         for(int j = 0; j < ac.length; j++)
  151.             if(j < ac.length - 1 && ac[j] == '\' && ac[j + 1] == 'n')
  152.             {
  153.                 ac1[i++] = 'n';
  154.                 j++;
  155.             } else
  156.             {
  157.                 ac1[i++] = ac[j];
  158.             }
  159.         return new String(ac1, 0, i);
  160.     }
  161.     private static int getFontType(String s)
  162.     {
  163.         s = s.toLowerCase().trim();
  164.         if(s.equals("bold"))
  165.             return 1;
  166.         if(s.equals("italic"))
  167.             return 2;
  168.         else
  169.             return s.equals("bolditalic") || s.equals("italicbold") ? 3 : 0;
  170.     }
  171.     public void setParentApplet(Applet applet)
  172.     {
  173.         if(applet == this)
  174.             applet = null;
  175.         parentApplet = applet;
  176.     }
  177.     protected static Color createColor(String s)
  178.     {
  179.         if(s == null || s.length() == 0)
  180.             return null;
  181.         if(s.indexOf(",") >= 0)
  182.         {
  183.             StringTokenizer stringtokenizer = new StringTokenizer(s, ", ");
  184.             try
  185.             {
  186.                 return new Color(Integer.parseInt(stringtokenizer.nextToken()), Integer.parseInt(stringtokenizer.nextToken()), Integer.parseInt(stringtokenizer.nextToken()));
  187.             }
  188.             catch(Exception exception1)
  189.             {
  190.                 System.out.println("Invalid RGB color: " + s);
  191.             }
  192.         } else
  193.         if(s.startsWith("#"))
  194.         {
  195.             try
  196.             {
  197.                 return new Color(Integer.parseInt(s.substring(1, 3), 16), Integer.parseInt(s.substring(3, 5), 16), Integer.parseInt(s.substring(5, 7), 16));
  198.             }
  199.             catch(Exception exception)
  200.             {
  201.                 System.out.println("Invalid hex color: " + s);
  202.             }
  203.         } else
  204.         {
  205.             s = s.toLowerCase();
  206.             if(s.equals("black"))
  207.                 return Color.black;
  208.             if(s.equals("blue"))
  209.                 return Color.blue;
  210.             if(s.equals("cyan"))
  211.                 return Color.cyan;
  212.             if(s.equals("darkgray"))
  213.                 return Color.darkGray;
  214.             if(s.equals("gray"))
  215.                 return Color.gray;
  216.             if(s.equals("green"))
  217.                 return Color.green;
  218.             if(s.equals("lightgray"))
  219.                 return Color.lightGray;
  220.             if(s.equals("magenta"))
  221.                 return Color.magenta;
  222.             if(s.equals("orange"))
  223.                 return Color.orange;
  224.             if(s.equals("pink"))
  225.                 return Color.pink;
  226.             if(s.equals("red"))
  227.                 return Color.red;
  228.             if(s.equals("white"))
  229.                 return Color.white;
  230.             if(s.equals("yellow"))
  231.                 return Color.yellow;
  232.             System.out.println("Invalid color name: " + s);
  233.         }
  234.         return null;
  235.     }
  236.     protected void setRangeParameters(boolean flag)
  237.     {
  238.         if(shouldSet(prefix + "rangeStep", flag))
  239.             setParameter("rangeStep", getParameter(prefix + "rangeStep"));
  240.         if(shouldSet(prefix + "range", flag))
  241.             setParameter("range", getParameter(prefix + "range"));
  242.         if(shouldSet(prefix + "lowerRange", flag))
  243.             setParameter("lowerRange", getParameter(prefix + "lowerRange"));
  244.         setParameter("rangeOn_2", getParameter(prefix + "rangeOn_2"));
  245.         if(shouldSet(prefix + "rangeStep_2", flag))
  246.             setParameter("rangeStep_2", getParameter(prefix + "rangeStep_2"));
  247.         if(shouldSet(prefix + "range_2", flag))
  248.             setParameter("range_2", getParameter(prefix + "range_2"));
  249.         if(shouldSet(prefix + "lowerRange_2", flag))
  250.             setParameter("lowerRange_2", getParameter(prefix + "lowerRange_2"));
  251.         initParameter("rangeAdjusterOn", getParameter(prefix + "rangeAdjusterOn"));
  252.         initParameter("rangeAdjusterOn_2", getParameter(prefix + "rangeAdjusterOn_2"));
  253.     }
  254.     public void setParameterPrefix(String s)
  255.     {
  256.         prefix = s != null ? s : "";
  257.     }
  258.     public String getParameterPrefix()
  259.     {
  260.         return prefix;
  261.     }
  262.     protected abstract Chart createChart(String s);
  263.     public void start()
  264.     {
  265.         if(automaticRefreshTime > 0)
  266.         {
  267.             refreshThread = new Thread(this);
  268.             refreshThread.start();
  269.         }
  270.     }
  271.     private void initParameter(String s, String s1)
  272.     {
  273.         if(s1 != null)
  274.             setParameter(s, s1);
  275.     }
  276.     protected static Double[] getDoubleValues(String s)
  277.     {
  278.         Double adouble[] = null;
  279.         if(s != null && !s.equals(""))
  280.         {
  281.             boolean flag = s.trim().startsWith(",");
  282.             StringTokenizer stringtokenizer = new StringTokenizer(s, ",");
  283.             adouble = new Double[stringtokenizer.countTokens() + (flag ? 1 : 0)];
  284.             for(int i = flag ? 1 : 0; i < adouble.length; i++)
  285.                 try
  286.                 {
  287.                     adouble[i] = new Double(stringtokenizer.nextToken());
  288.                 }
  289.                 catch(NumberFormatException numberformatexception) { }
  290.         }
  291.         return adouble;
  292.     }
  293.     protected String[] getStringValues(String s)
  294.     {
  295.         String as[] = null;
  296.         if(s != null)
  297.         {
  298.             boolean flag = s.trim().startsWith(labelDelimiter);
  299.             StringTokenizer stringtokenizer = new StringTokenizer(s, labelDelimiter);
  300.             as = new String[stringtokenizer.countTokens() + (flag ? 1 : 0)];
  301.             for(int i = flag ? 1 : 0; i < as.length; i++)
  302.                 as[i] = stringtokenizer.nextToken();
  303.         }
  304.         return as;
  305.     }
  306.     public void setParameter(String s, String s1)
  307.     {
  308.         if(s == null || theChart == null)
  309.             return;
  310.         s = s.toLowerCase();
  311.         if(s.startsWith("series") && s.endsWith("_values"))
  312.             try
  313.             {
  314.                 int i = Integer.parseInt(s.substring(6, s.indexOf("_values")));
  315.                 s = "sampleValues_" + i;
  316.             }
  317.             catch(NumberFormatException numberformatexception) { }
  318.         if(s.equals("width"))
  319.         {
  320.             if(s1 != null && s1.trim().length() > 0)
  321.                 try
  322.                 {
  323.                     int j = Integer.parseInt(s1.trim());
  324.                     setSize(j, theChart.getSize().height);
  325.                     theChart.setSize(j, theChart.getSize().height);
  326.                 }
  327.                 catch(NumberFormatException numberformatexception1)
  328.                 {
  329.                     System.out.println("Invalid width: " + s1);
  330.                 }
  331.         } else
  332.         if(s.equals("height"))
  333.         {
  334.             if(s1 != null && s1.trim().length() > 0)
  335.                 try
  336.                 {
  337.                     int k = Integer.parseInt(s1.trim());
  338.                     setSize(theChart.getSize().width, k);
  339.                     theChart.setSize(theChart.getSize().width, k);
  340.                 }
  341.                 catch(NumberFormatException numberformatexception2)
  342.                 {
  343.                     System.out.println("Invalid height: " + s1);
  344.                 }
  345.         } else
  346.         if(s.equals("samplevalues"))
  347.         {
  348.             Double adouble[] = getDoubleValues(s1);
  349.             if(adouble != null && s1.trim().length() > 0)
  350.             {
  351.                 int i5 = theChart.getSampleCount();
  352.                 for(int k6 = 0; k6 < i5; k6++)
  353.                     if(k6 < adouble.length && adouble[k6] != null)
  354.                     {
  355.                         theChart.setSampleValue(0, k6, adouble[k6].doubleValue());
  356.                     } else
  357.                     {
  358.                         ChartSample chartsample = theChart.getSample(0, k6);
  359.                         if(chartsample != null)
  360.                             chartsample.clearValue();
  361.                     }
  362.             }
  363.         } else
  364.         if(s.equals("samplecount"))
  365.         {
  366.             if(s1 != null && s1.trim().length() > 0)
  367.                 try
  368.                 {
  369.                     theChart.setSampleCount(Math.max(0, Integer.parseInt(s1.trim())));
  370.                 }
  371.                 catch(NumberFormatException numberformatexception3)
  372.                 {
  373.                     System.out.println("Invalid sampleCount: " + s1);
  374.                 }
  375.         } else
  376.         if(s.equals("samplecolors"))
  377.         {
  378.             if(s1 != null && s1.trim().length() > 0)
  379.             {
  380.                 Color acolor[] = getColorValues(s1);
  381.                 theChart.setSampleColors(acolor);
  382.             } else
  383.             {
  384.                 theChart.setSampleColors(null);
  385.             }
  386.         } else
  387.         if(s.equals("legendcolors"))
  388.         {
  389.             if(s1 != null && s1.trim().length() > 0)
  390.             {
  391.                 Color acolor1[] = getColorValues(s1);
  392.                 theChart.setLegendColors(acolor1);
  393.             } else
  394.             {
  395.                 theChart.setLegendColors(null);
  396.             }
  397.         } else
  398.         if(s.equals("seriescount"))
  399.         {
  400.             if(s1 != null && s1.trim().length() > 0)
  401.                 try
  402.                 {
  403.                     theChart.setSeriesCount(Math.max(1, Integer.parseInt(s1.trim())));
  404.                 }
  405.                 catch(NumberFormatException numberformatexception4)
  406.                 {
  407.                     System.out.println("Invalid seriesCount: " + s1);
  408.                 }
  409.             else
  410.                 theChart.setSeriesCount(1);
  411.         } else
  412.         if(s.startsWith("samplevalues_"))
  413.             try
  414.             {
  415.                 int l = Integer.parseInt(s.substring(13));
  416.                 if(l >= 0 && l < theChart.getSeriesCount())
  417.                 {
  418.                     Double adouble3[] = getDoubleValues(s1);
  419.                     int l6 = theChart.getSampleCount();
  420.                     for(int i8 = 0; i8 < l6; i8++)
  421.                         if(adouble3 != null && i8 < adouble3.length && adouble3[i8] != null)
  422.                         {
  423.                             theChart.setSampleValue(l, i8, adouble3[i8].doubleValue());
  424.                         } else
  425.                         {
  426.                             ChartSample chartsample1 = theChart.getSample(l, i8);
  427.                             if(chartsample1 != null)
  428.                                 chartsample1.clearValue();
  429.                         }
  430.                 }
  431.             }
  432.             catch(NumberFormatException numberformatexception5)
  433.             {
  434.                 System.out.println("Invalid series index: " + s1);
  435.             }
  436.         else
  437.         if(s.startsWith("seriesrange_"))
  438.             try
  439.             {
  440.                 int i1 = Integer.parseInt(s.substring(12));
  441.                 if(i1 >= 0 && i1 < theChart.getSeriesCount())
  442.                     if(s1 != null && s1.length() > 0)
  443.                         try
  444.                         {
  445.                             int j5 = Integer.parseInt(s1.trim());
  446.                             j5 = j5 == 2 ? 1 : 0;
  447.                             theChart.setSeriesRange(i1, j5);
  448.                         }
  449.                         catch(NumberFormatException numberformatexception14)
  450.                         {
  451.                             System.out.println("Invalid range index: " + s + " " + s1);
  452.                         }
  453.                     else
  454.                         theChart.setSeriesRange(i1, 0);
  455.             }
  456.             catch(NumberFormatException numberformatexception6)
  457.             {
  458.                 System.out.println("Invalid series index: " + s + " " + s1);
  459.             }
  460.         else
  461.         if(s.startsWith("rangestep"))
  462.         {
  463.             int j1 = s.equals("rangestep_2") ? 1 : 0;
  464.             try
  465.             {
  466.                 if(s1 != null && s1.trim().length() > 0)
  467.                 {
  468.                     rangeStep[j1] = (new Double(s1.trim())).doubleValue();
  469.                     rangeStep[j1] = Math.abs(rangeStep[j1]);
  470.                     theChart.setRelativeRange(j1, 1.0D, rangeStep[j1]);
  471.                     theChart.setLowerRelativeRange(j1, 1.0D, rangeStep[j1]);
  472.                 } else
  473.                 {
  474.                     rangeStep[j1] = -1D;
  475.                     theChart.setRelativeRangeIndex(j1, 1.0D);
  476.                     theChart.setLowerRelativeRangeIndex(j1, 1.0D);
  477.                 }
  478.             }
  479.             catch(NumberFormatException numberformatexception15)
  480.             {
  481.                 System.out.println("Invalid rangeStep: " + s1);
  482.                 rangeStep[j1] = -1D;
  483.                 theChart.setLowerRelativeRange(1.0D);
  484.             }
  485.         } else
  486.         if(s.equals("range") || s.equals("range_2"))
  487.         {
  488.             int k1 = s.equals("range_2") ? 1 : 0;
  489.             try
  490.             {
  491.                 if(s1 != null && s1.trim().length() > 0)
  492.                     theChart.setRange(k1, (new Double(s1.trim())).doubleValue());
  493.                 else
  494.                 if(rangeStep[k1] > -1D)
  495.                     theChart.setRelativeRange(k1, 1.0D, rangeStep[k1]);
  496.                 else
  497.                     theChart.setRelativeRangeIndex(k1, 1.0D);
  498.             }
  499.             catch(NumberFormatException numberformatexception16)
  500.             {
  501.                 System.out.println("Invalid range: " + s1);
  502.                 if(rangeStep[k1] != -1D)
  503.                     theChart.setRelativeRange(k1, 1.0D, rangeStep[k1]);
  504.                 else
  505.                     theChart.setRelativeRangeIndex(k1, 1.0D);
  506.             }
  507.         } else
  508.         if(s.equals("lowerrange") || s.equals("lowerrange_2"))
  509.         {
  510.             int l1 = s.equals("lowerrange_2") ? 1 : 0;
  511.             try
  512.             {
  513.                 if(s1 != null && s1.trim().length() > 0)
  514.                     theChart.setLowerRange(l1, (new Double(s1.trim())).doubleValue());
  515.                 else
  516.                 if(rangeStep[l1] != -1D)
  517.                     theChart.setLowerRelativeRange(l1, 1.0D, rangeStep[l1]);
  518.                 else
  519.                     theChart.setLowerRelativeRangeIndex(l1, 1.0D);
  520.             }
  521.             catch(NumberFormatException numberformatexception17)
  522.             {
  523.                 System.out.println("Invalid lowerRange: " + s1);
  524.                 if(rangeStep[l1] > -1D)
  525.                     theChart.setLowerRelativeRange(l1, 1.0D, rangeStep[l1]);
  526.                 else
  527.                     theChart.setLowerRelativeRangeIndex(l1, 1.0D);
  528.             }
  529.         } else
  530.         if(s.startsWith("rangeon"))
  531.         {
  532.             int i2 = s.equals("rangeon_2") ? 1 : 0;
  533.             if(s1 != null && s1.trim().length() > 0)
  534.                 theChart.setRangeOn(i2, s1.trim().toLowerCase().equals("true"));
  535.         } else
  536.         if(s.startsWith("rangecolor"))
  537.         {
  538.             int j2 = s.equals("rangecolor_2") ? 1 : 0;
  539.             if(s1 != null && s1.trim().length() > 0)
  540.                 theChart.setRangeColor(j2, createColor(s1));
  541.         } else
  542.         if(s.startsWith("rangeposition"))
  543.         {
  544.             int k2 = s.equals("rangeposition_2") ? 1 : 0;
  545.             if(s1 != null && s1.length() > 0)
  546.             {
  547.                 s1 = s1.trim().toLowerCase();
  548.                 if(s1.equals("right") || s1.equals("top"))
  549.                     theChart.setRangePosition(k2, 1);
  550.                 else
  551.                     theChart.setRangePosition(k2, 0);
  552.             }
  553.         } else
  554.         if(s.startsWith("rangeadjusteron"))
  555.         {
  556.             int l2 = s.equals("rangeadjusteron_2") ? 1 : 0;
  557.             theChart.setRangeAdjusterOn(l2, s1.trim().toLowerCase().equals("true"));
  558.         } else
  559.         if(s.startsWith("rangeadjusterposition"))
  560.         {
  561.             int i3 = s.equals("rangeadjusterposition_2") ? 1 : 0;
  562.             if(s1 != null && s1.length() > 0)
  563.             {
  564.                 s1 = s1.trim().toLowerCase();
  565.                 if(s1.equals("right") || s1.equals("top"))
  566.                     theChart.setRangeAdjusterPosition(i3, 1);
  567.                 else
  568.                     theChart.setRangeAdjusterPosition(i3, 0);
  569.             }
  570.         } else
  571.         if(s.startsWith("rangeadjusted_"))
  572.         {
  573.             int j3 = s.equals("rangeadjusted_2") ? 1 : 0;
  574.             if(s1 != null && s1.length() > 0)
  575.                 if(s1.trim().equals("1"))
  576.                     theChart.setRangeAdjusted(j3, 0);
  577.                 else
  578.                 if(s1.trim().equals("2"))
  579.                     theChart.setRangeAdjusted(j3, 1);
  580.                 else
  581.                     theChart.setRangeAdjusted(j3, 2);
  582.         } else
  583.         if(s.startsWith("rangedecimalcount"))
  584.         {
  585.             int k3 = s.equals("rangedecimalcount_2") ? 1 : 0;
  586.             try
  587.             {
  588.                 if(s1 != null && s1.trim().length() > 0)
  589.                     theChart.setRangeDecimalCount(k3, Integer.parseInt(s1.trim()));
  590.                 else
  591.                     theChart.setRangeDecimalCount(k3, 0);
  592.             }
  593.             catch(NumberFormatException numberformatexception18)
  594.             {
  595.                 System.out.println("Invalid " + s + ": " + s1);
  596.                 theChart.setRangeDecimalCount(k3, 0);
  597.             }
  598.         } else
  599.         if(s.equals("labeldelimiter"))
  600.         {
  601.             if(s1 != null && s1.trim().length() > 0)
  602.                 labelDelimiter = s1;
  603.             else
  604.                 labelDelimiter = ",";
  605.         } else
  606.         if(s.equals("serieslabels"))
  607.             theChart.setSeriesLabels(getStringValues(convertLineBreaks(s1)));
  608.         else
  609.         if(s.equals("serieslabelcolors"))
  610.         {
  611.             Color acolor2[] = getColorValues(s1);
  612.             int k5 = theChart.getSeriesCount();
  613.             for(int i7 = 0; i7 < k5; i7++)
  614.                 if(acolor2 != null && i7 < acolor2.length)
  615.                     theChart.setSeriesLabelColor(i7, acolor2[i7]);
  616.                 else
  617.                     theChart.setSeriesLabelColor(i7, null);
  618.         } else
  619.         if(s.equals("samplelabels"))
  620.             theChart.setSampleLabels(getStringValues(convertLineBreaks(s1)));
  621.         else
  622.         if(s.equals("samplelabelcolors"))
  623.         {
  624.             Color acolor3[] = getColorValues(s1);
  625.             int l5 = theChart.getSampleCount();
  626.             for(int j7 = 0; j7 < l5; j7++)
  627.                 if(acolor3 != null && j7 < acolor3.length)
  628.                     theChart.setSampleLabelColor(j7, acolor3[j7]);
  629.                 else
  630.                     theChart.setSampleLabelColor(j7, null);
  631.         } else
  632.         if(s.equals("legendlabels"))
  633.         {
  634.             theChart.setLegendLabels(null);
  635.             if(s1 != null && s1.trim().length() > 0)
  636.             {
  637.                 String as[] = getStringValues(convertLineBreaks(s1));
  638.                 if(as.length > 1)
  639.                     theChart.setLegendLabels(as);
  640.                 else
  641.                 if(as.length == 1 && as[0] != null)
  642.                     if(as[0].trim().toLowerCase().equals("samplelabels"))
  643.                         theChart.setLegendLabels(theChart.getSampleLabels());
  644.                     else
  645.                     if(as[0].trim().toLowerCase().equals("serieslabels"))
  646.                         theChart.setLegendLabels(theChart.getSeriesLabels());
  647.                     else
  648.                         theChart.setLegendLabels(as);
  649.             }
  650.         } else
  651.         if(s.startsWith("valuelabelson"))
  652.         {
  653.             if(s.equals("valuelabelson"))
  654.                 theChart.setValueLabelsOn(-1, s1 != null && s1.trim().toLowerCase().equals("true"));
  655.             else
  656.             if(s.startsWith("valuelabelson_"))
  657.                 try
  658.                 {
  659.                     int l3 = Integer.parseInt(s.substring(14));
  660.                     if(l3 >= 0 && l3 < theChart.getSeriesCount())
  661.                         theChart.setValueLabelsOn(l3, s1 != null && s1.trim().toLowerCase().equals("true"));
  662.                 }
  663.                 catch(NumberFormatException numberformatexception7)
  664.                 {
  665.                     System.out.println("Invalid " + s + " " + s1);
  666.                 }
  667.         } else
  668.         if(s.startsWith("valuelabelprefix") || s.startsWith("valuelabelpostfix"))
  669.             theChart.setLabel(s, convertLineBreaks(s1));
  670.         else
  671.         if(s.startsWith("sampledecimalcount"))
  672.             try
  673.             {
  674.                 if(s.equals("sampledecimalcount"))
  675.                 {
  676.                     if(s1 != null && s1.trim().length() > 0)
  677.                         theChart.setSampleDecimalCount(-1, Integer.parseInt(s1.trim()));
  678.                     else
  679.                         theChart.setSampleDecimalCount(-1, 0);
  680.                 } else
  681.                 if(s.startsWith("sampledecimalcount_"))
  682.                 {
  683.                     int i4 = Integer.parseInt(s.substring(19));
  684.                     if(i4 >= 0 && i4 < theChart.getSeriesCount())
  685.                         if(s1 != null && s1.trim().length() > 0)
  686.                             theChart.setSampleDecimalCount(i4, Integer.parseInt(s1.trim()));
  687.                         else
  688.                             theChart.setSampleDecimalCount(i4, 0);
  689.                 }
  690.             }
  691.             catch(NumberFormatException numberformatexception8)
  692.             {
  693.                 System.out.println("Invalid " + s + " " + s1);
  694.             }
  695.         else
  696.         if(s.equals("charttitle") || s.equals("title"))
  697.         {
  698.             theChart.setTitle(convertLineBreaks(s1));
  699.             theChart.setTitleOn(s1 != null && s1.length() > 0);
  700.         } else
  701.         if(s.equals("legendon"))
  702.             theChart.setLegendOn(s1 != null && s1.trim().toLowerCase().equals("true"));
  703.         else
  704.         if(s.equals("legendposition"))
  705.         {
  706.             theChart.setLegendPosition(1);
  707.             if(s1 != null && s1.trim().length() > 0)
  708.             {
  709.                 s1 = s1.toLowerCase();
  710.                 if(s1.equals("right"))
  711.                     theChart.setLegendPosition(1);
  712.                 else
  713.                 if(s1.equals("top"))
  714.                     theChart.setLegendPosition(2);
  715.                 else
  716.                 if(s1.equals("bottom"))
  717.                     theChart.setLegendPosition(3);
  718.                 else
  719.                 if(s1.equals("left"))
  720.                     theChart.setLegendPosition(0);
  721.                 else
  722.                     System.out.println("Invalid legendPosition: " + s1);
  723.             }
  724.         } else
  725.         if(s.equals("automaticrefreshtime"))
  726.             try
  727.             {
  728.                 if(s1 != null && s1.trim().length() > 0)
  729.                     automaticRefreshTime = Math.max(100, Integer.parseInt(s1));
  730.                 else
  731.                     automaticRefreshTime = 0x36ee80;
  732.             }
  733.             catch(NumberFormatException numberformatexception9)
  734.             {
  735.                 System.out.println("Invalid automaticRefreshTime: " + s1);
  736.                 automaticRefreshTime = 0x36ee80;
  737.             }
  738.         else
  739.         if(s.equals("3dmodeon"))
  740.             theChart.set3DModeOn(s1 != null && s1.toLowerCase().equals("true"));
  741.         else
  742.         if(s.equals("3ddepth"))
  743.         {
  744.             theChart.set3DDepth(-1);
  745.             if(s1 != null && s1.trim().length() > 0)
  746.                 try
  747.                 {
  748.                     int j4 = Integer.parseInt(s1.trim());
  749.                     theChart.set3DDepth(j4);
  750.                 }
  751.                 catch(NumberFormatException numberformatexception10)
  752.                 {
  753.                     System.out.println("Invalid 3DDepth: " + s1);
  754.                 }
  755.         } else
  756.         if(s.equals("foreground"))
  757.         {
  758.             if(s1 != null && s1.trim().length() > 0)
  759.             {
  760.                 Color color = createColor(s1);
  761.                 if(color != null)
  762.                     theChart.setForeground(color);
  763.                 else
  764.                     theChart.setForeground(Color.black);
  765.             } else
  766.             {
  767.                 theChart.setForeground(Color.black);
  768.             }
  769.         } else
  770.         if(s.equals("background"))
  771.         {
  772.             if(s1 != null && s1.trim().length() > 0)
  773.             {
  774.                 Color color1 = createColor(s1);
  775.                 if(color1 != null)
  776.                     theChart.setBackground(color1);
  777.                 else
  778.                     theChart.setBackground(new Color(231, 221, 231));
  779.             } else
  780.             {
  781.                 theChart.setBackground(new Color(231, 221, 231));
  782.             }
  783.         } else
  784.         if(s.equals("chartforeground"))
  785.         {
  786.             if(s1 != null && s1.trim().length() > 0)
  787.             {
  788.                 Color color2 = createColor(s1);
  789.                 if(color2 != null)
  790.                     theChart.setChartForeground(color2);
  791.                 else
  792.                     theChart.setChartForeground(Color.black);
  793.             } else
  794.             {
  795.                 theChart.setChartForeground(Color.black);
  796.             }
  797.         } else
  798.         if(s.equals("chartbackground"))
  799.         {
  800.             if(s1 != null && s1.trim().length() > 0)
  801.             {
  802.                 Color color3 = createColor(s1);
  803.                 if(color3 != null)
  804.                     theChart.setChartBackground(color3);
  805.                 else
  806.                     theChart.setChartBackground(Color.white);
  807.             } else
  808.             {
  809.                 theChart.setChartBackground(Color.white);
  810.             }
  811.         } else
  812.         if(s.equals("titlefont"))
  813.         {
  814.             if(s1 != null && s1.trim().length() > 0)
  815.                 theChart.setFont("titleFont", createFont(s1, "Dialog", 1, 14));
  816.             else
  817.                 theChart.setFont("titleFont", new Font("Dialog", 1, 14));
  818.         } else
  819.         if(s.equals("font"))
  820.         {
  821.             if(s1 != null && s1.trim().length() > 0)
  822.                 theChart.setFont(createFont(s1, "Arial", 0, 11));
  823.             else
  824.                 theChart.setFont(new Font("Arial", 0, 11));
  825.         } else
  826.         if(s.endsWith("font"))
  827.         {
  828.             if(s1 != null && s1.trim().length() > 0)
  829.                 theChart.setFont(s, createFont(s1, "Arial", 0, 11));
  830.             else
  831.                 theChart.setFont(s, null);
  832.         } else
  833.         if(s.equals("graphinsets"))
  834.         {
  835.             if(s1 != null && s1.trim().length() > 0)
  836.             {
  837.                 StringTokenizer stringtokenizer = new StringTokenizer(s1.trim(), ",");
  838.                 int i6 = -1;
  839.                 int k7 = -1;
  840.                 int j8 = -1;
  841.                 int k8 = -1;
  842.                 try
  843.                 {
  844.                     if(stringtokenizer.hasMoreTokens())
  845.                         i6 = Integer.parseInt(((String)stringtokenizer.nextElement()).trim());
  846.                     if(stringtokenizer.hasMoreTokens())
  847.                         k7 = Integer.parseInt(((String)stringtokenizer.nextElement()).trim());
  848.                     if(stringtokenizer.hasMoreTokens())
  849.                         j8 = Integer.parseInt(((String)stringtokenizer.nextElement()).trim());
  850.                     if(stringtokenizer.hasMoreTokens())
  851.                         k8 = Integer.parseInt(((String)stringtokenizer.nextElement()).trim());
  852.                     theChart.setGraphInsets(i6, k7, j8, k8);
  853.                 }
  854.                 catch(NumberFormatException numberformatexception21)
  855.                 {
  856.                     System.out.println("Invalid graphinsets: " + s1);
  857.                 }
  858.             } else
  859.             {
  860.                 theChart.setGraphInsets(-1, -1, -1, -1);
  861.             }
  862.         } else
  863.         if(s.startsWith("urltarget"))
  864.         {
  865.             if(s1 != null && s1.trim().length() > 0)
  866.                 urlTargetList.put(s, s1);
  867.             else
  868.             if(s.equals("urltarget"))
  869.                 urlTargetList.put(s, "_self");
  870.             else
  871.                 urlTargetList.remove(s);
  872.         } else
  873.         if(s.startsWith("url"))
  874.         {
  875.             if(s1 != null && s1.trim().length() > 0)
  876.             {
  877.                 URL url = createURL(s1);
  878.                 if(url != null)
  879.                     urlList.put(s, url);
  880.                 else
  881.                     urlList.remove(s);
  882.             } else
  883.             {
  884.                 urlList.remove(s);
  885.             }
  886.         } else
  887.         if(s.equals("sample_urltarget"))
  888.         {
  889.             System.out.println(s + " is deprecated, use urltarget");
  890.             setParameter("urltarget", s1);
  891.         } else
  892.         if(s.startsWith("sample") && s.endsWith("_urltarget"))
  893.         {
  894.             System.out.println(s + " is deprecated, use urltarget_N_M");
  895.             String s2 = s.substring(6, s.indexOf("_urltarget"));
  896.             setParameter("urltarget_" + s2, s1);
  897.         } else
  898.         if(s.startsWith("sample") && s.endsWith("_url"))
  899.         {
  900.             System.out.println(s + " is deprecated, use url_N_M");
  901.             String s3 = s.substring(6, s.indexOf("_url"));
  902.             setParameter("url_" + s3, s1);
  903.         } else
  904.         if(s.equals("valuelineson"))
  905.             theChart.setValueLinesOn(s1 != null && s1.trim().toLowerCase().equals("true"));
  906.         else
  907.         if(s.equals("maxvaluelinecount"))
  908.         {
  909.             if(s1 != null && s1.trim().length() > 0)
  910.                 try
  911.                 {
  912.                     theChart.setMaxValueLineCount(Integer.parseInt(s1.trim()));
  913.                 }
  914.                 catch(NumberFormatException numberformatexception11)
  915.                 {
  916.                     System.out.println("Invalid maxValueLineCount: " + s1);
  917.                     theChart.setMaxValueLineCount(-1);
  918.                 }
  919.             else
  920.                 theChart.setMaxValueLineCount(-1);
  921.         } else
  922.         if(s.equals("defaultgridlineson"))
  923.         {
  924.             if(s1 != null)
  925.             {
  926.                 String as1[] = getStringValues(s1);
  927.                 if(as1.length < 3)
  928.                     theChart.setDefaultGridLinesOn(as1[0].trim().toLowerCase().equals("true"));
  929.                 else
  930.                 if(as1.length >= 3)
  931.                 {
  932.                     double d = Double.valueOf(as1[1]).doubleValue();
  933.                     double d2 = Double.valueOf(as1[2]).doubleValue();
  934.                     theChart.setDefaultGridLinesOn(as1[0].trim().toLowerCase().equals("true"), d, d2);
  935.                 }
  936.             }
  937.         } else
  938.         if(s.equals("defaultgridlinescolor"))
  939.         {
  940.             theChart.setDefaultGridLinesColor(null);
  941.             if(s1 != null && s1.trim().length() > 0)
  942.             {
  943.                 Color acolor4[] = getColorValues(s1);
  944.                 if(acolor4 != null && acolor4.length > 0 && acolor4[0] != null)
  945.                     theChart.setDefaultGridLinesColor(acolor4[0]);
  946.             }
  947.         } else
  948.         if(s.equals("gridlines"))
  949.         {
  950.             theChart.setGridLines(null);
  951.             if(s1 != null)
  952.             {
  953.                 Double adouble1[] = getDoubleValues(s1);
  954.                 if(adouble1 != null)
  955.                 {
  956.                     double ad[] = new double[adouble1.length];
  957.                     for(int l7 = 0; l7 < adouble1.length; l7++)
  958.                         if(adouble1[l7] != null)
  959.                             ad[l7] = adouble1[l7].doubleValue();
  960.                     theChart.setGridLines(ad);
  961.                 }
  962.             }
  963.         } else
  964.         if(s.equals("gridlinescolor"))
  965.         {
  966.             theChart.setGridLinesColor(null);
  967.             if(s1 != null && s1.trim().length() > 0)
  968.             {
  969.                 Color acolor5[] = getColorValues(s1);
  970.                 if(acolor5 != null && acolor5.length > 0 && acolor5[0] != null)
  971.                     theChart.setGridLinesColor(acolor5[0]);
  972.             }
  973.         } else
  974.         if(s.equals("gridlinecolors"))
  975.         {
  976.             if(s1 != null && s1.trim().length() > 0)
  977.                 theChart.setGridLineColors(getColorValues(s1));
  978.             else
  979.                 theChart.setGridLineColors(null);
  980.         } else
  981.         if(s.equals("valuelinescolor"))
  982.         {
  983.             if(s1 != null && s1.trim().length() > 0)
  984.             {
  985.                 Color color4 = createColor(s1);
  986.                 if(color4 != null)
  987.                     theChart.setValueLinesColor(color4);
  988.                 else
  989.                     theChart.setValueLinesColor(Color.lightGray);
  990.             } else
  991.             {
  992.                 theChart.setValueLinesColor(Color.lightGray);
  993.             }
  994.         } else
  995.         if(s.equals("sampleaxisrange"))
  996.         {
  997.             theChart.setSampleAxisRange(0.0D, 100D);
  998.             if(s1 != null && s1.trim().length() > 0)
  999.             {
  1000.                 Double adouble2[] = getDoubleValues(s1);
  1001.                 if(adouble2.length >= 2)
  1002.                     theChart.setSampleAxisRange(adouble2[0] != null ? adouble2[0].doubleValue() : 0.0D, adouble2[1] != null ? adouble2[1].doubleValue() : 100D);
  1003.             }
  1004.         } else
  1005.         if(s.equals("rangelabelsoff"))
  1006.             theChart.setRangeLabelsOn(s1 == null || !s1.trim().toLowerCase().equals("true"));
  1007.         else
  1008.         if(s.equals("sampleaxislabel") || s.equals("rangeaxislabel") || s.equals("rangeaxislabel_2"))
  1009.             theChart.setLabel(s, convertLineBreaks(s1));
  1010.         else
  1011.         if(s.equals("rangelabelprefix") || s.equals("rangelabelpostfix"))
  1012.             theChart.setLabel(s, convertLineBreaks(s1));
  1013.         else
  1014.         if(s.endsWith("angle") || s.equals("rangeaxislabelangle_2"))
  1015.             try
  1016.             {
  1017.                 if(s1 != null && s1.trim().length() > 0)
  1018.                     theChart.setLabelAngle(s, Integer.parseInt(s1));
  1019.                 else
  1020.                     theChart.setLabelAngle(s, 0);
  1021.             }
  1022.             catch(NumberFormatException numberformatexception12)
  1023.             {
  1024.                 System.out.println("Invalid " + s + ": " + s1);
  1025.             }
  1026.         else
  1027.         if(s.startsWith("targetvalueline"))
  1028.         {
  1029.             if(targets.containsKey(s))
  1030.             {
  1031.                 String s4 = (String)targets.remove(s);
  1032.                 theChart.setTargetValueLine(s4, 0.0D, null, 0);
  1033.             }
  1034.             if(s1 != null && s1.length() > 0)
  1035.             {
  1036.                 StringTokenizer stringtokenizer1 = new StringTokenizer(s1, labelDelimiter);
  1037.                 String s5 = null;
  1038.                 if(stringtokenizer1.hasMoreElements())
  1039.                     s5 = (String)stringtokenizer1.nextElement();
  1040.                 double d1 = 0.0D;
  1041.                 if(stringtokenizer1.hasMoreElements())
  1042.                     try
  1043.                     {
  1044.                         String s6 = (String)stringtokenizer1.nextElement();
  1045.                         d1 = (new Double(s6.trim())).doubleValue();
  1046.                     }
  1047.                     catch(NumberFormatException numberformatexception20)
  1048.                     {
  1049.                         System.out.println("Invalid targetValueLine value: " + s1);
  1050.                     }
  1051.                 Color color5 = theChart.getValueLinesColor();
  1052.                 if(stringtokenizer1.hasMoreElements())
  1053.                 {
  1054.                     String s7 = (String)stringtokenizer1.nextElement();
  1055.                     color5 = createColor(s7.trim());
  1056.                     if(color5 == null)
  1057.                         color5 = theChart.getValueLinesColor();
  1058.                 }
  1059.                 byte byte0 = 3;
  1060.                 if(stringtokenizer1.hasMoreElements())
  1061.                 {
  1062.                     String s8 = ((String)stringtokenizer1.nextElement()).trim();
  1063.                     if(s8.equals("label"))
  1064.                         byte0 = 1;
  1065.                     else
  1066.                     if(s8.equals("value"))
  1067.                         byte0 = 2;
  1068.                     else
  1069.                         byte0 = 3;
  1070.                 }
  1071.                 if(s5 != null)
  1072.                 {
  1073.                     targets.put(s, s5);
  1074.                     theChart.setTargetValueLine(s5, d1, color5, byte0);
  1075.                 }
  1076.             }
  1077.         } else
  1078.         if(s.equals("samplescrolleron"))
  1079.             theChart.setSampleScrollerOn(s1 != null && s1.trim().toLowerCase().equals("true"));
  1080.         else
  1081.         if(s.equals("visiblesamples"))
  1082.         {
  1083.             if(s1 != null && s1.length() > 0)
  1084.             {
  1085.                 int k4 = 0;
  1086.                 int j6 = -1;
  1087.                 StringTokenizer stringtokenizer2 = new StringTokenizer(s1, ",");
  1088.                 try
  1089.                 {
  1090.                     if(stringtokenizer2.hasMoreTokens())
  1091.                         k4 = Integer.parseInt(((String)stringtokenizer2.nextElement()).trim());
  1092.                     if(stringtokenizer2.hasMoreTokens())
  1093.                         j6 = Integer.parseInt(((String)stringtokenizer2.nextElement()).trim());
  1094.                 }
  1095.                 catch(NumberFormatException numberformatexception19)
  1096.                 {
  1097.                     System.out.println("Invalid visibleSamples: " + s1);
  1098.                 }
  1099.                 theChart.setVisibleSamples(k4, j6);
  1100.             } else
  1101.             {
  1102.                 theChart.setVisibleSamples(0, -1);
  1103.             }
  1104.         } else
  1105.         if(!s.equals("chart"))
  1106.             if(s.startsWith("overlay"))
  1107.             {
  1108.                 if(s1 != null && s1.trim().length() > 0)
  1109.                 {
  1110.                     s1 = s1.trim().toLowerCase();
  1111.                     Object obj = null;
  1112.                     if(s1.equals("line"))
  1113.                         obj = new LineChartApplet();
  1114.                     else
  1115.                     if(s1.equals("bar"))
  1116.                         obj = new BarChartApplet();
  1117.                     else
  1118.                     if(s1.equals("pie"))
  1119.                         obj = new PieChartApplet();
  1120.                     else
  1121.                         System.out.println("invalid " + s + " " + s1);
  1122.                     if(obj != null)
  1123.                     {
  1124.                         ((ChartApplet)obj).setParentApplet(this);
  1125.                         ((ChartApplet)obj).setParameterPrefix(s + "_");
  1126.                         ((ChartApplet)obj).init();
  1127.                         overlayChartApplets.addElement(obj);
  1128.                         theChart.addOverlayChart(((ChartApplet)obj).theChart);
  1129.                     }
  1130.                 }
  1131.             } else
  1132.             if(s.startsWith("legendimage_"))
  1133.                 try
  1134.                 {
  1135.                     int l4 = Integer.parseInt(s.substring(s.indexOf("_") + 1));
  1136.                     theChart.setLegendImage(l4, null);
  1137.                     if(s1 != null && s1.trim().length() > 0)
  1138.                     {
  1139.                         java.awt.Image image = getImage(getDocumentBase(), s1);
  1140.                         if(image != null)
  1141.                         {
  1142.                             theChart.addImage(s, image);
  1143.                             theChart.setLegendImage(l4, s);
  1144.                         }
  1145.                     }
  1146.                 }
  1147.                 catch(NumberFormatException numberformatexception13)
  1148.                 {
  1149.                     System.out.println("Invalid legend index: " + s);
  1150.                 }
  1151.                 catch(SecurityException securityexception)
  1152.                 {
  1153.                     System.out.println("Security exception, could not load image: " + s1);
  1154.                 }
  1155.                 finally { }
  1156.             else
  1157.             if(s.startsWith("printasbitmap"))
  1158.                 theChart.setPrintAsBitmap(s1 != null && s1.trim().toLowerCase().equals("true"));
  1159.             else
  1160.             if(s.equals("floatingonlegendoff"))
  1161.                 theChart.setFloatingOnLegendOn(s1 == null || !s1.trim().equalsIgnoreCase("true"));
  1162.             else
  1163.                 System.out.println("Invalid parameter name: " + s);
  1164.     }
  1165.     public String getParameter(String s)
  1166.     {
  1167.         String s1 = null;
  1168.         if(parentApplet != null)
  1169.             s1 = parentApplet.getParameter(s);
  1170.         else
  1171.             try
  1172.             {
  1173.                 s1 = super.getParameter(s);
  1174.             }
  1175.             catch(NullPointerException nullpointerexception) { }
  1176.         return s1;
  1177.     }
  1178.     private URL createURL(String s)
  1179.     {
  1180.         URL url = null;
  1181.         try
  1182.         {
  1183.             url = new URL(s);
  1184.         }
  1185.         catch(MalformedURLException malformedurlexception)
  1186.         {
  1187.             URL url1 = getDocumentBase();
  1188.             if(url1 == null)
  1189.                 return null;
  1190.             String s1 = url1.toExternalForm();
  1191.             int i = s1.lastIndexOf("?");
  1192.             if(i > -1)
  1193.                 s1 = s1.substring(0, i);
  1194.             if(!s1.endsWith("/"))
  1195.                 s1 = s1.substring(0, s1.lastIndexOf("/") + 1);
  1196.             if(s1.startsWith("file:/\"))
  1197.                 s1 = "file://" + s1.substring(8);
  1198.             try
  1199.             {
  1200.                 url = new URL(s1 + s);
  1201.             }
  1202.             catch(MalformedURLException malformedurlexception1)
  1203.             {
  1204.                 System.out.println("Invalid URL: " + s1);
  1205.             }
  1206.         }
  1207.         return url;
  1208.     }
  1209.     protected void refresh()
  1210.     {
  1211.     }
  1212.     public void run()
  1213.     {
  1214.         try
  1215.         {
  1216.             Thread.sleep((int)Math.random() * 1000);
  1217.             do
  1218.             {
  1219.                 Thread.sleep(automaticRefreshTime);
  1220.                 refresh();
  1221.             } while(true);
  1222.         }
  1223.         catch(InterruptedException interruptedexception)
  1224.         {
  1225.             return;
  1226.         }
  1227.     }
  1228.     public void init()
  1229.     {
  1230.         String s = getParameter(prefix + "chartClass");
  1231.         if(s != null)
  1232.             theChart = createChart(s);
  1233.         reset();
  1234.         if(theChart == null)
  1235.             return;
  1236.         String s1 = getParameter(prefix + "doubleBufferingOff");
  1237.         if(s1 != null && s1.equals("true"))
  1238.         {
  1239.             add("Center", theChart);
  1240.         } else
  1241.         {
  1242.             NonFlickerPanel nonflickerpanel = new NonFlickerPanel(new BorderLayout());
  1243.             nonflickerpanel.add("Center", theChart);
  1244.             add("Center", nonflickerpanel);
  1245.         }
  1246.         theChart.setAutomaticRepaintOn(false);
  1247.         int i = 1;
  1248.         int j = 0;
  1249.         Double adouble[] = getDoubleValues(getParameter(prefix + "sampleValues"));
  1250.         if(adouble != null)
  1251.         {
  1252.             j = adouble.length;
  1253.             String s2 = getParameter(prefix + "sampleCount");
  1254.             if(s2 != null)
  1255.                 try
  1256.                 {
  1257.                     j = Integer.parseInt(s2);
  1258.                 }
  1259.                 catch(NumberFormatException numberformatexception)
  1260.                 {
  1261.                     System.out.println("Invalid sampleCount: " + s2);
  1262.                 }
  1263.             theChart.setSeriesCount(i);
  1264.             theChart.setSampleCount(j);
  1265.             initParameter("sampleValues", getParameter(prefix + "sampleValues"));
  1266.         }
  1267.         if(adouble == null)
  1268.         {
  1269.             String s3 = getParameter(prefix + "seriesCount");
  1270.             if(s3 != null)
  1271.                 try
  1272.                 {
  1273.                     i = Math.max(1, Integer.parseInt(s3));
  1274.                 }
  1275.                 catch(NumberFormatException numberformatexception1)
  1276.                 {
  1277.                     System.out.println("Invalid seriesCount: " + s3);
  1278.                 }
  1279.             s3 = getParameter(prefix + "sampleCount");
  1280.             if(s3 != null)
  1281.             {
  1282.                 try
  1283.                 {
  1284.                     j = Integer.parseInt(s3);
  1285.                 }
  1286.                 catch(NumberFormatException numberformatexception2)
  1287.                 {
  1288.                     System.out.println("Invalid sampleCount: " + s3);
  1289.                 }
  1290.             } else
  1291.             {
  1292.                 for(int k = 0; k < i; k++)
  1293.                 {
  1294.                     Double adouble1[] = getDoubleValues(getParameter(prefix + "sampleValues_" + k));
  1295.                     if(adouble1 == null)
  1296.                         adouble1 = getDoubleValues(getParameter(prefix + "series" + k + "_values"));
  1297.                     if(adouble1 != null)
  1298.                         j = Math.max(j, adouble1.length);
  1299.                 }
  1300.             }
  1301.             theChart.setSeriesCount(i);
  1302.             theChart.setSampleCount(j);
  1303.             for(int l = 0; l < i; l++)
  1304.             {
  1305.                 String s5 = getParameter(prefix + "sampleValues_" + l);
  1306.                 if(s5 == null)
  1307.                     s5 = getParameter(prefix + "series" + l + "_values");
  1308.                 initParameter("sampleValues_" + l, s5);
  1309.             }
  1310.         }
  1311.         String s4 = getParameter(prefix + "chartTitle");
  1312.         if(s4 != null && s4.trim().length() > 0)
  1313.             initParameter("chartTitle", s4);
  1314.         else
  1315.             initParameter("chartTitle", getParameter(prefix + "title"));
  1316.         initParameter("sampleColors", getParameter(prefix + "sampleColors"));
  1317.         initParameter("legendColors", getParameter(prefix + "legendColors"));
  1318.         initParameter("valueLabelsOn", getParameter(prefix + "valueLabelsOn"));
  1319.         initParameter("legendOn", getParameter(prefix + "legendOn"));
  1320.         initParameter("labelDelimiter", getParameter(prefix + "labelDelimiter"));
  1321.         initParameter("sampleLabels", getParameter(prefix + "sampleLabels"));
  1322.         initParameter("seriesLabels", getParameter(prefix + "seriesLabels"));
  1323.         initParameter("sampleLabelColors", getParameter(prefix + "sampleLabelColors"));
  1324.         initParameter("seriesLabelColors", getParameter(prefix + "seriesLabelColors"));
  1325.         initParameter("legendPosition", getParameter(prefix + "legendPosition"));
  1326.         initParameter("automaticRefreshTime", getParameter(prefix + "automaticRefreshTime"));
  1327.         initParameter("background", getParameter(prefix + "background"));
  1328.         initParameter("foreground", getParameter(prefix + "foreground"));
  1329.         initParameter("chartBackground", getParameter(prefix + "chartBackground"));
  1330.         initParameter("chartForeground", getParameter(prefix + "chartForeground"));
  1331.         initParameter("titleFont", getParameter(prefix + "titleFont"));
  1332.         initParameter("font", getParameter(prefix + "font"));
  1333.         initParameter("legendFont", getParameter(prefix + "legendFont"));
  1334.         initParameter("3DModeOn", getParameter(prefix + "3DModeOn"));
  1335.         initParameter("3DDepth", getParameter(prefix + "3DDepth"));
  1336.         initParameter("legendLabels", getParameter(prefix + "legendLabels"));
  1337.         initParameter("graphInsets", getParameter(prefix + "graphInsets"));
  1338.         initParameter("rangeDecimalCount", getParameter(prefix + "rangeDecimalCount"));
  1339.         initParameter("rangeDecimalCount_2", getParameter(prefix + "rangeDecimalCount_2"));
  1340.         initParameter("valueLinesOn", getParameter(prefix + "valueLinesOn"));
  1341.         initParameter("maxValueLineCount", getParameter(prefix + "maxValueLineCount"));
  1342.         initParameter("sampleAxisRange", getParameter(prefix + "sampleAxisRange"));
  1343.         initParameter("defaultGridLinesOn", getParameter(prefix + "defaultGridLinesOn"));
  1344.         initParameter("gridLines", getParameter(prefix + "gridLines"));
  1345.         initParameter("gridLinesColor", getParameter(prefix + "gridLinesColor"));
  1346.         initParameter("defaultGridLinesColor", getParameter(prefix + "defaultGridLinesColor"));
  1347.         initParameter("gridLineColors", getParameter(prefix + "gridLineColors"));
  1348.         initParameter("valueLinesColor", getParameter(prefix + "valueLinesColor"));
  1349.         initParameter("rangeLabelsOff", getParameter(prefix + "rangeLabelsOff"));
  1350.         initParameter("rangeLabelFont", getParameter(prefix + "rangeLabelFont"));
  1351.         initParameter("rangeLabelPrefix", getParameter(prefix + "rangeLabelPrefix"));
  1352.         initParameter("rangeLabelPostfix", getParameter(prefix + "rangeLabelPostfix"));
  1353.         initParameter("sampleAxisLabel", getParameter(prefix + "sampleAxisLabel"));
  1354.         initParameter("rangeAxisLabel", getParameter(prefix + "rangeAxisLabel"));
  1355.         initParameter("rangeAxisLabel_2", getParameter(prefix + "rangeAxisLabel_2"));
  1356.         initParameter("sampleAxisLabelFont", getParameter(prefix + "sampleAxisLabelFont"));
  1357.         initParameter("rangeAxisLabelFont", getParameter(prefix + "rangeAxisLabelFont"));
  1358.         initParameter("visibleSamples", getParameter(prefix + "visibleSamples"));
  1359.         initParameter("rangeAxisLabelAngle", getParameter(prefix + "rangeAxisLabelAngle"));
  1360.         initParameter("rangeAxisLabelAngle_2", getParameter(prefix + "rangeAxisLabelAngle_2"));
  1361.         initParameter("sampleAxisLabelAngle", getParameter(prefix + "sampleAxisLabelAngle"));
  1362.         initParameter("valueLabelAngle", getParameter(prefix + "valueLabelAngle"));
  1363.         initParameter("barLabelAngle", getParameter(prefix + "barLabelAngle"));
  1364.         initParameter("sampleLabelAngle", getParameter(prefix + "sampleLabelAngle"));
  1365.         initParameter("rangePosition", getParameter(prefix + "rangePosition"));
  1366.         initParameter("rangePosition_2", getParameter(prefix + "rangePosition_2"));
  1367.         initParameter("rangeAdjusterPosition", getParameter(prefix + "rangeAdjusterPosition"));
  1368.         initParameter("rangeAdjusterPosition_2", getParameter(prefix + "rangeAdjusterPosition_2"));
  1369.         initParameter("rangeColor", getParameter(prefix + "rangeColor"));
  1370.         initParameter("rangeColor_2", getParameter(prefix + "rangeColor_2"));
  1371.         initParameter("rangeAdjusted_1", getParameter(prefix + "rangeAdjusted_1"));
  1372.         initParameter("rangeAdjusted_2", getParameter(prefix + "rangeAdjusted_2"));
  1373.         initParameter("sampleDecimalCount", getParameter(prefix + "sampleDecimalCount"));
  1374.         initParameter("valueLabelPrefix", getParameter(prefix + "valueLabelPrefix"));
  1375.         initParameter("valueLabelPostfix", getParameter(prefix + "valueLabelPostfix"));
  1376.         initParameter("printAsBitmap", getParameter(prefix + "printAsBitmap"));
  1377.         initParameter("floatingLabelFont", getParameter(prefix + "floatingLabelFont"));
  1378.         initParameter("floatingOnLegendOff", getParameter(prefix + "floatingOnLegendOff"));
  1379.         for(int i1 = 0; i1 < i; i1++)
  1380.         {
  1381.             initParameter("valueLabelPrefix_" + i1, getParameter(prefix + "valueLabelPrefix_" + i1));
  1382.             initParameter("valueLabelPostfix_" + i1, getParameter(prefix + "valueLabelPostfix_" + i1));
  1383.             initParameter("seriesRange_" + i1, getParameter(prefix + "seriesRange_" + i1));
  1384.             initParameter("valueLabelsOn_" + i1, getParameter(prefix + "valueLabelsOn_" + i1));
  1385.             initParameter("sampleDecimalCount_" + i1, getParameter(prefix + "sampleDecimalCount_" + i1));
  1386.         }
  1387.         initParameter("urltarget", getParameter(prefix + "sample_urltarget"));
  1388.         for(int j1 = 0; j1 < j; j1++)
  1389.         {
  1390.             initParameter("url_" + j1, getParameter(prefix + "sample" + j1 + "_url"));
  1391.             initParameter("urltarget_" + j1, getParameter(prefix + "sample" + j1 + "_urltarget"));
  1392.         }
  1393.         initParameter("url", getParameter(prefix + "url"));
  1394.         setParameter("urltarget", "_self");
  1395.         initParameter("urltarget", getParameter(prefix + "urltarget"));
  1396.         int k1 = Math.max(i, j);
  1397.         for(int l1 = 0; l1 < k1; l1++)
  1398.         {
  1399.             initParameter("url_" + l1, getParameter(prefix + "url_" + l1));
  1400.             initParameter("urltarget_" + l1, getParameter(prefix + "urltarget_" + l1));
  1401.         }
  1402.         for(int i2 = 0; i2 < i; i2++)
  1403.         {
  1404.             for(int j2 = 0; j2 < j; j2++)
  1405.             {
  1406.                 String s7 = "url_" + i2 + "_" + j2;
  1407.                 initParameter(s7, getParameter(prefix + s7));
  1408.                 s7 = "urltarget_" + i2 + "_" + j2;
  1409.                 initParameter(s7, getParameter(prefix + s7));
  1410.             }
  1411.         }
  1412.         k1 = 0;
  1413.         targets = new Hashtable();
  1414.         for(String s6 = getParameter(prefix + "targetValueLine_0"); s6 != null && s6.length() > 0; s6 = getParameter(prefix + "targetValueLine_" + k1))
  1415.         {
  1416.             initParameter("targetValueLine_" + k1, s6);
  1417.             k1++;
  1418.         }
  1419.         String as[] = theChart.getLegendLabels();
  1420.         if(as != null)
  1421.         {
  1422.             for(int k2 = 0; k2 < as.length; k2++)
  1423.             {
  1424.                 String s8 = getParameter(prefix + "legendImage_" + k2);
  1425.                 initParameter("legendImage_" + k2, s8);
  1426.             }
  1427.         }
  1428.         theChart.setAutomaticRepaintOn(true);
  1429.     }
  1430.     protected Font createFont(String s, String s1, int i, int j)
  1431.     {
  1432.         StringTokenizer stringtokenizer = new StringTokenizer(s, ",");
  1433.         String s2 = s1;
  1434.         int k = Math.max(0, j);
  1435.         int l = i;
  1436.         if(stringtokenizer.hasMoreTokens())
  1437.             s2 = stringtokenizer.nextToken();
  1438.         if(stringtokenizer.hasMoreTokens())
  1439.             l = getFontType(stringtokenizer.nextToken());
  1440.         if(stringtokenizer.hasMoreTokens())
  1441.             try
  1442.             {
  1443.                 k = Integer.parseInt(stringtokenizer.nextToken().trim());
  1444.             }
  1445.             catch(NumberFormatException numberformatexception)
  1446.             {
  1447.                 k = 12;
  1448.             }
  1449.         return new Font(s2, l, k);
  1450.     }
  1451.     public void print(Graphics g)
  1452.     {
  1453.         theChart.print(g);
  1454.     }
  1455.     private String createURLParam(String s, int i, int j)
  1456.     {
  1457.         String s1 = s;
  1458.         if(i >= 0)
  1459.             s1 = s1 + "_" + i;
  1460.         if(j >= 0)
  1461.             s1 = s1 + "_" + j;
  1462.         return s1;
  1463.     }
  1464.     /**
  1465.      * @deprecated Method init is deprecated
  1466.      */
  1467.     protected void init(Chart chart)
  1468.     {
  1469.         theChart = chart;
  1470.         init();
  1471.     }
  1472.     /**
  1473.      * @deprecated Method setParameter is deprecated
  1474.      */
  1475.     protected void setParameter(Chart chart, String s, String s1)
  1476.     {
  1477.         theChart = chart;
  1478.         setParameter(s, s1);
  1479.     }
  1480.     public Chart theChart;
  1481.     protected Vector overlayChartApplets;
  1482.     private String prefix;
  1483.     private double rangeStep[];
  1484.     private int automaticRefreshTime;
  1485.     private Thread refreshThread;
  1486.     protected String labelDelimiter;
  1487.     private Hashtable targets;
  1488.     private Hashtable urlList;
  1489.     private Hashtable urlTargetList;
  1490.     private static Cursor HAND_CURSOR;
  1491.     private static Cursor POINT_CURSOR;
  1492.     private int lastSelectedSample;
  1493.     private int lastSelectedSeries;
  1494.     private long lastSelectedTime;
  1495.     private static final int DOUBLE_CLICK_TIME = 350;
  1496.     private Applet parentApplet;
  1497. }