// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
package com.lowagie.text.pdf;
import com.lowagie.text.*;
import com.lowagie.text.exceptions.*;
import com.lowagie.text.pdf.interfaces.PdfViewerPreferences;
import com.lowagie.text.pdf.internal.PdfViewerPreferencesImp;
import java.io.*;
import java.net.URL;
import java.security.Key;
import java.security.MessageDigest;
import java.security.cert.Certificate;
import java.util.*;
import java.util.zip.InflaterInputStream;
import org.bouncycastle.cms.*;
// Referenced classes of package com.lowagie.text.pdf:
// PRTokeniser, RandomAccessFileOrArray, PdfEncryption, PdfObject,
// PdfDictionary, PRIndirectReference, PdfReaderInstance, PRAcroForm,
// PdfArray, PdfName, PdfString, PdfNumber,
// PdfIndirectReference, PdfNull, PdfBoolean, PRStream,
// IntHashtable, PdfLiteral, LZWDecoder, AcroFields,
// PdfEncodings, BaseFont, PdfNameTree, PdfAnnotation,
// SequenceList, PdfWriter
public class PdfReader
implements PdfViewerPreferences
{
static class PageRefs
{
private PdfReader reader;
private IntHashtable refsp;
private ArrayList refsn;
private ArrayList pageInh;
private int lastPageRead;
private int sizep;
private boolean keepPages;
int size()
{
if (refsn != null)
return refsn.size();
else
return sizep;
}
void readPages()
throws IOException
{
if (refsn != null)
{
return;
} else
{
refsp = null;
refsn = new ArrayList();
pageInh = new ArrayList();
iteratePages((PRIndirectReference)reader.catalog.get(PdfName.PAGES));
pageInh = null;
reader.rootPages.put(PdfName.COUNT, new PdfNumber(refsn.size()));
return;
}
}
void reReadPages()
throws IOException
{
refsn = null;
readPages();
}
public PdfDictionary getPageN(int i)
{
PRIndirectReference prindirectreference = getPageOrigRef(i);
return (PdfDictionary)PdfReader.getPdfObject(prindirectreference);
}
public PdfDictionary getPageNRelease(int i)
{
PdfDictionary pdfdictionary = getPageN(i);
releasePage(i);
return pdfdictionary;
}
public PRIndirectReference getPageOrigRefRelease(int i)
{
PRIndirectReference prindirectreference = getPageOrigRef(i);
releasePage(i);
return prindirectreference;
}
public PRIndirectReference getPageOrigRef(int i)
{
if (--i < 0 || i >= size())
return null;
if (refsn != null)
return (PRIndirectReference)refsn.get(i);
int j;
PRIndirectReference prindirectreference;
j = refsp.get(i);
if (j != 0)
break MISSING_BLOCK_LABEL_115;
prindirectreference = getSinglePage(i);
if (reader.lastXrefPartial == -1)
lastPageRead = -1;
else
lastPageRead = i;
reader.lastXrefPartial = -1;
refsp.put(i, prindirectreference.getNumber());
if (keepPages)
lastPageRead = -1;
return prindirectreference;
if (lastPageRead != i)
lastPageRead = -1;
if (keepPages)
lastPageRead = -1;
return new PRIndirectReference(reader, j);
Exception exception;
exception;
throw new ExceptionConverter(exception);
}
void keepPages()
{
if (refsp == null || keepPages)
{
return;
} else
{
keepPages = true;
refsp.clear();
return;
}
}
public void releasePage(int i)
{
if (refsp == null)
return;
if (--i < 0 || i >= size())
return;
if (i != lastPageRead)
{
return;
} else
{
lastPageRead = -1;
reader.lastXrefPartial = refsp.get(i);
reader.releaseLastXrefPartial();
refsp.remove(i);
return;
}
}
public void resetReleasePage()
{
if (refsp == null)
{
return;
} else
{
lastPageRead = -1;
return;
}
}
void insertPage(int i, PRIndirectReference prindirectreference)
{
i--;
if (refsn != null)
{
if (i >= refsn.size())
refsn.add(prindirectreference);
else
refsn.add(i, prindirectreference);
} else
{
sizep++;
lastPageRead = -1;
if (i >= size())
{
refsp.put(size(), prindirectreference.getNumber());
} else
{
IntHashtable inthashtable = new IntHashtable((refsp.size() + 1) * 2);
IntHashtable.Entry entry;
int j;
for (Iterator iterator = refsp.getEntryIterator(); iterator.hasNext(); inthashtable.put(j < i ? j : j + 1, entry.getValue()))
{
entry = (IntHashtable.Entry)iterator.next();
j = entry.getKey();
}
inthashtable.put(i, prindirectreference.getNumber());
refsp = inthashtable;
}
}
}
private void pushPageAttributes(PdfDictionary pdfdictionary)
{
PdfDictionary pdfdictionary1 = new PdfDictionary();
if (!pageInh.isEmpty())
pdfdictionary1.putAll((PdfDictionary)pageInh.get(pageInh.size() - 1));
for (int i = 0; i < PdfReader.pageInhCandidates.length; i++)
{
PdfObject pdfobject = pdfdictionary.get(PdfReader.pageInhCandidates[i]);
if (pdfobject != null)
pdfdictionary1.put(PdfReader.pageInhCandidates[i], pdfobject);
}
pageInh.add(pdfdictionary1);
}
private void popPageAttributes()
{
pageInh.remove(pageInh.size() - 1);
}
private void iteratePages(PRIndirectReference prindirectreference)
throws IOException
{
PdfDictionary pdfdictionary = (PdfDictionary)PdfReader.getPdfObject(prindirectreference);
PdfArray pdfarray = pdfdictionary.getAsArray(PdfName.KIDS);
if (pdfarray == null)
{
pdfdictionary.put(PdfName.TYPE, PdfName.PAGE);
PdfDictionary pdfdictionary1 = (PdfDictionary)pageInh.get(pageInh.size() - 1);
Iterator iterator = pdfdictionary1.getKeys().iterator();
do
{
if (!iterator.hasNext())
break;
PdfName pdfname = (PdfName)iterator.next();
if (pdfdictionary.get(pdfname) == null)
pdfdictionary.put(pdfname, pdfdictionary1.get(pdfname));
} while (true);
if (pdfdictionary.get(PdfName.MEDIABOX) == null)
{
PdfArray pdfarray1 = new PdfArray(new float[] {
0.0F, 0.0F, PageSize.LETTER.getRight(), PageSize.LETTER.getTop()
});
pdfdictionary.put(PdfName.MEDIABOX, pdfarray1);
}
refsn.add(prindirectreference);
} else
{
pdfdictionary.put(PdfName.TYPE, PdfName.PAGES);
pushPageAttributes(pdfdictionary);
int i = 0;
do
{
if (i >= pdfarray.size())
break;
PdfObject pdfobject = pdfarray.getPdfObject(i);
if (!pdfobject.isIndirect())
{
for (; i < pdfarray.size(); pdfarray.remove(i));
break;
}
iteratePages((PRIndirectReference)pdfobject);
i++;
} while (true);
popPageAttributes();
}
}
protected PRIndirectReference getSinglePage(int i)
{
PdfDictionary pdfdictionary;
PdfDictionary pdfdictionary1;
int j;
pdfdictionary = new PdfDictionary();
pdfdictionary1 = reader.rootPages;
j = 0;
_L2:
for (int k = 0; k < PdfReader.pageInhCandidates.length; k++)
{
PdfObject pdfobject = pdfdictionary1.get(PdfReader.pageInhCandidates[k]);
if (pdfobject != null)
pdfdictionary.put(PdfReader.pageInhCandidates[k], pdfobject);
}
PdfArray pdfarray = (PdfArray)PdfReader.getPdfObjectRelease(pdfdictionary1.get(PdfName.KIDS));
java.util.ListIterator listiterator = pdfarray.listIterator();
do
{
int i1;
if (listiterator.hasNext())
{
label0:
{
PRIndirectReference prindirectreference = (PRIndirectReference)listiterator.next();
PdfDictionary pdfdictionary2 = (PdfDictionary)PdfReader.getPdfObject(prindirectreference);
int l = reader.lastXrefPartial;
PdfObject pdfobject1 = PdfReader.getPdfObjectRelease(pdfdictionary2.get(Pdf
jfreechart-1.0.13-demo-all
5星 · 超过95%的资源 需积分: 0 38 浏览量
更新于2010-11-16
收藏 5.2MB RAR 举报
《JFreeChart 1.0.13图表样式全方位演示》
JFreeChart是一个流行的Java库,用于生成高质量的二维图表。它支持多种图表类型,包括柱状图、饼图、线图、面积图、散点图、甘特图以及更复杂的组合图表等。在“jfreechart-1.0.13-demo-all”这个压缩包中,包含了JFreeChart库1.0.13版本的所有图表样式的示例,是学习和理解JFreeChart功能的强大资源。
一、JFreeChart基本概念
1. 图表类型:JFreeChart支持的图表类型广泛,每个类型都有其特定的应用场景,例如柱状图用于比较类别之间的数值,饼图展示各部分占整体的比例,线图则适合展示数据随时间的变化趋势。
二、JFreeChart的使用
2. 创建图表:使用JFreeChart创建图表主要涉及以下几个步骤:创建Dataset(数据集)、构建ChartFactory(图表工厂)、设置Chart(图表)属性,最后将图表绘制到Graphics2D对象上,如Swing组件的Graphics2D实例。
三、图表样式
3. 数据集:Dataset是图表的数据源,可以是简单的数组、列表或者复杂的表格数据。JFreeChart提供了多种Dataset实现,如CategoryDataset(分类数据集)、TimeSeriesCollection(时间序列集合)等。
4. 图表工厂:通过ChartFactory类,我们可以快速生成不同类型的图表,只需传入相应的数据集和图表标题等信息即可。
5. 图表定制:JFreeChart允许对图表的各个元素进行深度定制,如颜色、字体、线条样式、填充图案、标签等。此外,还可以调整图例的位置、形状和大小,以及坐标轴的刻度、标签和网格线。
四、示例应用
6. Demo应用:压缩包中的“jfreechart-1.0.13-demo-all.jar”文件包含了一个运行时的Demo程序,展示了JFreeChart的各种图表和样式。用户可以通过这个Demo直观地了解每个图表类型的效果,并参考其代码实现自己的图表。
五、性能与优化
7. 性能考虑:尽管JFreeChart功能强大,但在处理大量数据或复杂图表时,需要注意性能优化,如合理选择数据结构、减少不必要的计算和绘制操作等。
六、与其他技术的集成
8. 集成应用:JFreeChart可无缝集成到Java Swing和JavaFX应用中,也可以通过Servlet或JSP在Web环境中生成动态图表。此外,还能与报表工具如iReport、BIRT等结合,增强报表的可视化效果。
通过深入研究“jfreechart-1.0.13-demo-all”这个压缩包中的示例,开发者不仅可以掌握JFreeChart的基本用法,还能了解到如何根据实际需求定制和美化图表,从而提升应用的用户体验和视觉吸引力。无论你是Java开发者,还是数据分析人员,JFreeChart都是一个值得学习和利用的强大工具。
MengXuer
- 粉丝: 0
- 资源: 1