Right/left scroll fixes, java=Java remove reduntant passage

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352175 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2002-03-10 16:15:04 +00:00
parent fbe3d5c704
commit 67d791280a
1 changed files with 48 additions and 43 deletions

View File

@ -6,6 +6,7 @@
<title>Record Generator HOWTO</title> <title>Record Generator HOWTO</title>
<authors> <authors>
<person email="glens@apache.org" name="Glen Stampoultzis" id="glens"/> <person email="glens@apache.org" name="Glen Stampoultzis" id="glens"/>
<person email="acoliver@apache.org" name="Andrew C. Oliver" id="acoliver"/>
</authors> </authors>
</header> </header>
<body> <body>
@ -13,13 +14,13 @@
<s2 title="History"> <s2 title="History">
<p> <p>
The record generator was born from my frustration with translating The record generator was born from frustration with translating
the Excel records to Java classes. Doing this manually is a time the Excel records to Java classes. Doing this manually is a time
consuming process. It's also very easy to make mistakes. consuming process. It's also very easy to make mistakes.
</p> </p>
<p> <p>
I wanted something that would take the defintition of what a A utility was needed to take the defintition of what a
record looked like and do all the boring stuff for me. Thus the record looked like and do all the boring stuff. Thus the
record generator was born. record generator was born.
</p> </p>
</s2> </s2>
@ -29,7 +30,7 @@
The record generator takes XML as input and produced the following The record generator takes XML as input and produced the following
output: output:
<ul> <ul>
<li>A java file capabile of decoding and encoding the record.</li> <li>A Java file capabile of decoding and encoding the record.</li>
<li>A test class with provides a fill-in-the-blanks implementation of a test case <li>A test class with provides a fill-in-the-blanks implementation of a test case
for ensuring the record operates as designed.</li> for ensuring the record operates as designed.</li>
</ul> </ul>
@ -45,8 +46,9 @@
The records themselves have the following general layout: The records themselves have the following general layout:
</p> </p>
<source><![CDATA[ <source><![CDATA[
<record id="0x1032" name="Frame" package="org.apache.poi.hssf.record"> <record id="0x1032" name="Frame" package="org.apache.poi.hssf.record">
<description>The frame record indicates whether there is a border around the displayed text of a chart.</description> <description>The frame record indicates whether there is a border
around the displayed text of a chart.</description>
<author>Glen Stampoultzis (glens at apache.org)</author> <author>Glen Stampoultzis (glens at apache.org)</author>
<fields> <fields>
<field type="int" size="2" name="border type"> <field type="int" size="2" name="border type">
@ -54,54 +56,57 @@
<const name="shadow" value="1" description="rectangle with shadow"/> <const name="shadow" value="1" description="rectangle with shadow"/>
</field> </field>
<field type="int" size="2" name="options"> <field type="int" size="2" name="options">
<bit number="0" name="auto size" description="excel calculates the size automatically if true"/> <bit number="0" name="auto size"
<bit number="1" name="auto position" description="excel calculates the position automatically"/> description="excel calculates the size automatically if true"/>
<bit number="1" name="auto position"
description="excel calculates the position automatically"/>
</field> </field>
</fields> </fields>
</record> </record>
]]></source> ]]></source>
<p> <p>
Currently the type can be of type int, float or string. The 'int' type covers bytes, shorts and Currently the type can be of type int, float or string. The 'int'
integers which is selected using a size of 1, 2 or 4. type covers bytes, shorts and integers which is selected using a
An additional type called varword is used to represent a array of word values where the first short size of 1, 2 or 4. An additional type called varword is used to
is the length of the array. represent a array of word values where the first short is the length
The string type generation is only partially implemented. If choosing string you must select a size of the array. The string type generation is only partially
of 'var'. implemented. If choosing string you must select a size of 'var'.
</p> </p>
<p> <p>
The Java records are regenerated each time the record generator is run, however the test stubs are The Java records are regenerated each time the record generator is
only created if the test stub does not already exist. What this means is that you may change run, however the test stubs are only created if the test stub does
test stubs but not the generated records. not already exist. What this means is that you may change test
stubs but not the generated records.
</p> </p>
</s2> </s2>
<s2 title="How it Works"> <s2 title="How it Works">
<p> <p>
The record generation works by taking an XML file and styling it using XLST. Given that The record generation works by taking an XML file and styling it
XSLT is a little limited in some ways it was necessary to add a little Java code to the mix. using XLST. Given that XSLT is a little limited in some ways it was
This would probably have been better off done as javascript and may well be migrated in the necessary to add a little Java code to the mix.
near future. Since the current Java code was written as a proof of concept it's a little
lacking in commenting and structure. Since this is converted to Javascript this should no
longer be a problem.
</p> </p>
<p> <p>
See record.xsl, record_test.xsl, FieldIterator.java, RecordUtil.java, RecordGenerator.java See record.xsl, record_test.xsl, FieldIterator.java,
RecordUtil.java, RecordGenerator.java
</p> </p>
</s2> </s2>
<s2 title="Limitations"> <s2 title="Limitations">
<p> <p>
The record generator does not handle all possible record types and is not ment to. Sometimes it's The record generator does not handle all possible record types and
going to make more sense to generate the records manually. The main point of this thing is to is not ment to. Sometimes it's going to make more sense to generate
make the easy stuff simple. the records manually. The main point of this thing is to make the
easy stuff simple.
</p> </p>
<p> <p>
Currently the record generator is optimized to create Excel records. It could be adapted to create Currently the record generator is optimized to create Excel records.
Word records with a little poking around. It could be adapted to create Word records with a little poking
around.
</p> </p>
<p> <p>
Currently the the XSL file that generates the record calls out to java objects. This would have been Currently the the XSL file that generates the record calls out to
better done as Javascript inside the XSL file itself. The java code for the record generation is Java objects. This would have been better done as Javascript inside
currently quite messy with minimal comments. Sorry, I wrote it as a proof-of-concept and just went the XSL file itself. The Java code for the record generation is
too far. currently quite messy with minimal comments.
</p> </p>
</s2> </s2>
</s1> </s1>