LineChartApplet.java
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:11k
源码类别:
OA系统
开发平台:
Java
- // Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2002-12-03 18:43:23
- // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
- // Decompiler options: packimports(3)
- // Source File Name: LineChartApplet.java
- package cn.com.fcsoft.chart;
- import java.awt.Component;
- import java.io.PrintStream;
- import java.util.StringTokenizer;
- import java.util.Vector;
- // Referenced classes of package com.objectplanet.chart:
- // ChartApplet, LineChart, Chart
- public class LineChartApplet extends ChartApplet
- {
- private int[] getStyleValues(String s)
- {
- int ai[] = null;
- if(s != null)
- {
- StringTokenizer stringtokenizer = new StringTokenizer(s, ",");
- ai = new int[stringtokenizer.countTokens()];
- for(int i = 0; i < ai.length; i++)
- {
- String s1 = stringtokenizer.nextToken().trim().toLowerCase();
- if(s1.equals("circle"))
- ai[i] = 0;
- else
- if(s1.equals("circle_opaque"))
- ai[i] = 1;
- else
- if(s1.equals("circle_filled"))
- ai[i] = 2;
- else
- if(s1.equals("square"))
- ai[i] = 3;
- else
- if(s1.equals("square_opaque"))
- ai[i] = 4;
- else
- if(s1.equals("square_filled"))
- ai[i] = 5;
- else
- if(s1.equals("diamond"))
- ai[i] = 6;
- else
- if(s1.equals("diamond_opaque"))
- ai[i] = 7;
- else
- if(s1.equals("diamond_filled"))
- {
- ai[i] = 8;
- } else
- {
- ai[i] = 0;
- System.out.println("Invalid sampleHighlightStyle: " + s1);
- }
- }
- }
- return ai;
- }
- public LineChartApplet()
- {
- }
- protected Chart createChart(String s)
- {
- if(s == null || s.equals(""))
- s = "cn.com.fcsoft.chart.LineChart";
- try
- {
- Class class1 = Class.forName(s);
- LineChart linechart = (LineChart)class1.newInstance();
- linechart.setRange(0, 100D);
- return linechart;
- }
- catch(ClassNotFoundException _ex)
- {
- System.out.println("Class not found: " + s);
- }
- catch(InstantiationException _ex)
- {
- System.out.println("Could not create an instance of the class: " + s);
- }
- catch(IllegalAccessException _ex)
- {
- System.out.println("Illegal access, could not create an instance of class: " + s);
- }
- catch(ClassCastException _ex)
- {
- System.out.println("The class " + s + ", does not extend from com.objectplanet.chart.LineChart");
- }
- return new LineChart(1, 1, 100D);
- }
- private void initParameter(String s, String s1)
- {
- if(s1 != null)
- setParameter(s, s1);
- }
- public void setParameter(String s, String s1)
- {
- if(s == null)
- return;
- s = s.toLowerCase();
- if(s.equals("valuelabelstyle"))
- {
- chart.setValueLabelStyle(0);
- if(s1 != null)
- if(s1.equals("point"))
- chart.setValueLabelStyle(1);
- else
- if(s1.equals("floating"))
- chart.setValueLabelStyle(2);
- } else
- if(s.equals("samplelabelson"))
- chart.setSampleLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
- else
- if(s.equals("samplelabelstyle"))
- {
- chart.setSampleLabelStyle(3);
- if(s1 != null && s1.trim().toLowerCase().equals("floating"))
- chart.setSampleLabelStyle(2);
- } else
- if(s.equals("serieslabelson"))
- chart.setSeriesLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
- else
- if(s.equals("autolabelspacingon"))
- chart.setAutoLabelSpacingOn(s1 != null && s1.toLowerCase().equals("true"));
- else
- if(s.equals("serieslineoff"))
- {
- if(s1 != null && s1.trim().toLowerCase().equals("true"))
- chart.setSeriesLineOn(false);
- else
- if(s1 != null && s1.trim().length() > 0)
- {
- chart.setSeriesLineOn(true);
- Double adouble[] = ChartApplet.getDoubleValues(s1);
- int j = chart.getSeriesCount();
- for(int k1 = 0; k1 < adouble.length; k1++)
- if(adouble[k1] != null && adouble[k1].intValue() >= 0 && adouble[k1].intValue() < j)
- chart.setSeriesLineOn(adouble[k1].intValue(), false);
- } else
- {
- chart.setSeriesLineOn(true);
- }
- } else
- if(s.equals("connectedlineson"))
- {
- chart.setConnectedLinesOn(-1, false);
- if(s1 != null && s1.trim().toLowerCase().equals("true"))
- chart.setConnectedLinesOn(-1, true);
- else
- if(s1 != null && s1.trim().length() > 0)
- {
- Double adouble1[] = ChartApplet.getDoubleValues(s1);
- int k = chart.getSeriesCount();
- for(int l1 = 0; l1 < adouble1.length; l1++)
- if(adouble1[l1] != null && adouble1[l1].intValue() >= 0 && adouble1[l1].intValue() < k)
- chart.setConnectedLinesOn(adouble1[l1].intValue(), true);
- }
- } else
- if(s.equals("linewidth"))
- {
- if(s1 != null && s1.trim().length() > 0)
- {
- Double adouble2[] = ChartApplet.getDoubleValues(s1);
- if(adouble2.length == 1 && chart.getSeriesCount() > 1)
- {
- chart.setLineWidth(-1, adouble2[0].intValue());
- } else
- {
- for(int l = 0; l < adouble2.length; l++)
- chart.setLineWidth(l, adouble2[l].intValue());
- }
- } else
- {
- chart.setLineWidth(-1, 2);
- }
- } else
- if(s.equals("stackedon"))
- chart.setStackedOn(s1 != null && s1.toLowerCase().equals("true"));
- else
- if(s.equals("samplehighlighton"))
- {
- boolean aflag[] = getBooleanValues(s1);
- int i1 = chart.getSeriesCount();
- for(int i2 = 0; i2 < i1; i2++)
- if(aflag != null && aflag.length > 0)
- chart.setSampleHighlightOn(i2, aflag[i2 % aflag.length]);
- else
- chart.setSampleHighlightOn(i2, false);
- } else
- if(s.equals("samplehighlightstyle"))
- {
- int ai[] = getStyleValues(s1);
- int j1 = chart.getSeriesCount();
- for(int j2 = 0; j2 < j1; j2++)
- {
- int l2 = chart.getSampleHighlightSize(j2);
- int j3 = 0;
- if(ai != null && ai.length > 0)
- j3 = ai[j2 % ai.length];
- chart.setSampleHighlightStyle(j2, j3, l2);
- }
- } else
- if(s.equals("samplehighlightsize"))
- {
- int i = chart.getSeriesCount();
- Double adouble3[] = ChartApplet.getDoubleValues(s1);
- for(int k2 = 0; k2 < i; k2++)
- {
- int i3 = chart.getSampleHighlightStyle(k2);
- int k3 = 6;
- if(adouble3 != null && adouble3[k2 % adouble3.length] != null)
- k3 = adouble3[k2 % adouble3.length].intValue();
- chart.setSampleHighlightStyle(k2, i3, k3);
- }
- } else
- {
- super.setParameter(s, s1);
- }
- }
- protected void refresh()
- {
- chart.repaint();
- }
- private boolean[] getBooleanValues(String s)
- {
- boolean aflag[] = null;
- if(s != null)
- {
- StringTokenizer stringtokenizer = new StringTokenizer(s, ",");
- aflag = new boolean[stringtokenizer.countTokens()];
- for(int i = 0; i < aflag.length; i++)
- aflag[i] = stringtokenizer.nextToken().trim().toLowerCase().equals("true");
- }
- return aflag;
- }
- public void init()
- {
- chart = (LineChart)super.theChart;
- super.init();
- String s = getParameterPrefix();
- initParameter("valueLabelFont", getParameter(s + "valueLabelFont"));
- initParameter("valueLabelStyle", getParameter(s + "valueLabelStyle"));
- initParameter("sampleDecimalCount", getParameter(s + "sampleDecimalCount"));
- initParameter("sampleLabelsOn", getParameter(s + "sampleLabelsOn"));
- initParameter("sampleLabelStyle", getParameter(s + "sampleLabelStyle"));
- initParameter("sampleLabelFont", getParameter(s + "sampleLabelFont"));
- initParameter("seriesLabelsOn", getParameter(s + "seriesLabelsOn"));
- initParameter("seriesLabels", getParameter(s + "seriesLabels"));
- initParameter("autoLabelSpacingOn", getParameter(s + "autoLabelSpacingOn"));
- initParameter("seriesLineOff", getParameter(s + "seriesLineOff"));
- initParameter("connectedLinesOn", getParameter(s + "connectedLinesOn"));
- initParameter("lineWidth", getParameter(s + "lineWidth"));
- initParameter("stackedOn", getParameter(s + "stackedOn"));
- initParameter("sampleHighlightOn", getParameter(s + "sampleHighlightOn"));
- initParameter("sampleHighlightStyle", getParameter(s + "sampleHighlightStyle"));
- initParameter("sampleHighlightSize", getParameter(s + "sampleHighlightSize"));
- initParameter("sampleScrollerOn", getParameter(s + "sampleScrollerOn"));
- String s1 = getParameter(s + "overlay");
- initParameter(s + "overlay", getParameter(s + "overlay"));
- int i = s1 == null ? 0 : 1;
- for(String s2 = getParameter(s + "overlay" + i); s2 != null; s2 = getParameter(s + "overlay" + i))
- {
- initParameter(s + "overlay" + i, getParameter(s + "overlay" + i));
- i++;
- }
- setRangeParameters(true);
- for(int j = 0; j < super.overlayChartApplets.size(); j++)
- {
- ChartApplet chartapplet = (ChartApplet)super.overlayChartApplets.elementAt(j);
- if(chartapplet != null)
- chartapplet.setRangeParameters(false);
- }
- chart.setAutomaticRepaintOn(true);
- }
- public LineChart chart;
- }