should have been submitted with r683081

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@683093 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-08-06 03:06:18 +00:00
parent 3c755ee68c
commit 2988701bd6
2 changed files with 902 additions and 917 deletions

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -16,7 +15,6 @@
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.usermodel; package org.apache.poi.hssf.usermodel;
import java.util.ArrayList; import java.util.ArrayList;
@ -56,7 +54,7 @@ import org.apache.poi.hssf.record.PlotAreaRecord;
import org.apache.poi.hssf.record.PlotGrowthRecord; import org.apache.poi.hssf.record.PlotGrowthRecord;
import org.apache.poi.hssf.record.PrintSetupRecord; import org.apache.poi.hssf.record.PrintSetupRecord;
import org.apache.poi.hssf.record.ProtectRecord; import org.apache.poi.hssf.record.ProtectRecord;
import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.RecordBase;
import org.apache.poi.hssf.record.SCLRecord; import org.apache.poi.hssf.record.SCLRecord;
import org.apache.poi.hssf.record.SeriesIndexRecord; import org.apache.poi.hssf.record.SeriesIndexRecord;
import org.apache.poi.hssf.record.SeriesRecord; import org.apache.poi.hssf.record.SeriesRecord;
@ -76,8 +74,7 @@ import org.apache.poi.hssf.record.formula.Area3DPtg;
* *
* @author Glen Stampoultzis (glens at apache.org) * @author Glen Stampoultzis (glens at apache.org)
*/ */
public class HSSFChart public final class HSSFChart {
{
private ChartRecord chartRecord; private ChartRecord chartRecord;
private LegendRecord legendRecord; private LegendRecord legendRecord;
@ -177,7 +174,7 @@ public class HSSFChart
// Find records of interest // Find records of interest
List records = sheet.getSheet().getRecords(); List records = sheet.getSheet().getRecords();
for(Iterator it = records.iterator(); it.hasNext();) { for(Iterator it = records.iterator(); it.hasNext();) {
Record r = (Record)it.next(); RecordBase r = (RecordBase)it.next();
if(r instanceof ChartRecord) { if(r instanceof ChartRecord) {
lastChart = new HSSFChart((ChartRecord)r); lastChart = new HSSFChart((ChartRecord)r);
@ -945,7 +942,7 @@ public class HSSFChart
private SeriesRecord series; private SeriesRecord series;
private SeriesTextRecord seriesTitleText; private SeriesTextRecord seriesTitleText;
private HSSFSeries(SeriesRecord series) { /* package */ HSSFSeries(SeriesRecord series) {
this.series = series; this.series = series;
} }

View File

@ -14,26 +14,18 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.hssf.usermodel; package org.apache.poi.hssf.usermodel;
import java.io.File;
import java.io.FileInputStream;
import org.apache.poi.hssf.record.SeriesRecord;
import junit.framework.TestCase; import junit.framework.TestCase;
public class TestHSSFChart extends TestCase { import org.apache.poi.hssf.HSSFTestDataSamples;
private String dirName; import org.apache.poi.hssf.record.SeriesRecord;
protected void setUp() throws Exception { public final class TestHSSFChart extends TestCase {
dirName = System.getProperty("HSSF.testdata.path");
}
public void testSingleChart() throws Exception { public void testSingleChart() throws Exception {
HSSFWorkbook wb = new HSSFWorkbook( HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithChart.xls");
new FileInputStream(new File(dirName, "WithChart.xls"))
);
HSSFSheet s1 = wb.getSheetAt(0); HSSFSheet s1 = wb.getSheetAt(0);
HSSFSheet s2 = wb.getSheetAt(1); HSSFSheet s2 = wb.getSheetAt(1);
@ -62,9 +54,7 @@ public class TestHSSFChart extends TestCase {
} }
public void testTwoCharts() throws Exception { public void testTwoCharts() throws Exception {
HSSFWorkbook wb = new HSSFWorkbook( HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithTwoCharts.xls");
new FileInputStream(new File(dirName, "WithTwoCharts.xls"))
);
HSSFSheet s1 = wb.getSheetAt(0); HSSFSheet s1 = wb.getSheetAt(0);
HSSFSheet s2 = wb.getSheetAt(1); HSSFSheet s2 = wb.getSheetAt(1);
@ -96,9 +86,7 @@ public class TestHSSFChart extends TestCase {
} }
public void testThreeCharts() throws Exception { public void testThreeCharts() throws Exception {
HSSFWorkbook wb = new HSSFWorkbook( HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithThreeCharts.xls");
new FileInputStream(new File(dirName, "WithThreeCharts.xls"))
);
HSSFSheet s1 = wb.getSheetAt(0); HSSFSheet s1 = wb.getSheetAt(0);
HSSFSheet s2 = wb.getSheetAt(1); HSSFSheet s2 = wb.getSheetAt(1);