[#HDCOOKBOOK-37] Support custom feature and allow user

advertisement
[HDCOOKBOOK-37] Support custom feature and allow user-defined binary
format for it Created: 07/Jan/08 Updated: 29/Jan/08 Resolved: 29/Jan/08
Status:
Project:
Component/s:
Affects
Version/s:
Fix Version/s:
Resolved
hdcookbook
www
current
Type:
Reporter:
Resolution:
Labels:
Remaining
Estimate:
Time Spent:
Original
Estimate:
Environment:
Improvement
chihiro_saito
Fixed
None
Not Specified
Attachments:
webrev.zip
Issuezilla Id:
milestone 1
Priority:
Assignee:
Votes:
Critical
chihiro_saito
0
Not Specified
Not Specified
Operating System: All
Platform: All
37
Description
Currently GRIN includes a partial support for a user defined feature, partly
because the hdcookbook menu xlet doesn't use this. Meanwhile Javelin confirmed
that having this support will be helpful.
Likewise, the binary file converter doesn't support user defined feature.
Instead of trying to define a default format for a custom feature, it's been
agreed that we should add a hook to the converter so that the custom feature can
provide it's own reader/writer routine.
We'll probably update the user defined modifier and command to be able to
provide it's own reader/writer routine as well.
Comments
Comment by chihiro_saito [ 15/Jan/08 ]
The commit for this is currently under review. As a heads-up, possible changes
include:
1. Three new interfaces are defined,
ExtensionsParser, for parsing text-based GRIN file,
ExtensionsWriter, for writing out extensions in binary format,
ExtensionsReader, for reading in extensions in binary.
Those who are using custom extensions should implement these classes.
grin/jdktools/library/src/com/hdcookbook/grin/io/text/ExtensionsParser.java
grin/jdktools/library/src/com/hdcookbook/grin/io/binary/ExtensionsWriter.java
grin/library/src/com/hdcookbook/grin/io/binary/ExtensionsReader.java
2. An abstract factory class, ExtensionsBuilderFactory, is also defined, and it
returns an instance of ExtensionsParser and ExtensionsWriter. This should also
be implemented by those who're using custom extensions.
3. grin/jdktools/library/src/com/hdcookbook/grin/io/ShowBuilder.java have
methods to set/get ExtensionsBuilderFactory instance and ExtensionsReader
instance. GrinViewer, MosaicBuilder, or other SE-based show building tools set
the ExtensionsBuilderFactory or ExtensionsReader instances to the ShowBuilder
after getting class name from a command line etc and instantiating it using
reflection.
Later on, ShowParser checks with the ShowBuilder instance for the
ExtensionsParser in it's constructor. Those who are constructing
GrinBinaryWriter or GrinBinaryReader checks with the ShowBuilder to pass the
right handler in the binary reader/writer constructors.
4. GrinViewer takes -extensions_factory and -extensions_reader command line
parameters, to get the handler impl from the user.
5. For MenuXlet, a new directory
grin/xlets/tools/src/com/hdcookbook/bookmenu/menu is created. All SE based
handler impl, including impl of three interfaces (note, ExtensionsReader here is
for grinviewer only and returns fake versions of Modifier/Command) and
ExtensionsBuilderFactory lives here.
6. The original class for handling extension, ExtensionsBuilder, is deleted.
The getter method at Director.java is also deleted. This causes updates to
various Director subclasses throughout the project.
7. ExtensionsBuilder.takeMosaicHint(...) method got moved to
SEShow.takeMosaicHint(). A new class,
grin/jdktools/library/src/com/hdcookbook/grin/MosaicHint.java, is added to save
the mosaic info. I don't like having this class public but can't think of a
better way now. grin/jdktools/mosaic/ classes are updated to work with the new
extensions handlers as well as mosaic hints from SEShow.
8. Changed Show.java to allow null director at it's constructor.
9. Updated SEShowVisitor related methods. SEShow.acceptFeature now calls a new
method SESShowVisitor.visitUserDefinedFeature(feature). The impl of this method
in SEDoubleUseChecker just adds the feature and accpets the part if the feture
is a modifier. TranslatorHelper checks X and Y if the values are not Int.MAX_VALUE.
10. grin/samples/CustomFeature is added, for a custom extension, an Oval
feature. GrinViewer worked with both the binary and the text based file and
shows the oval.
11. For Ryan example, I updated it to have ExtensionParser impl but didn't add
impl for ExtensionsReader, which is needed for displaying binary-based grin
show. Felt that the text based grin support is enough here.
12. Three new methods are added to GrinDataInputStream and GrinDataOutputStream,
to write out and read in reference (index number) of Feature/Segment/RCHandler.
As agreed, I haven't put in a mechanism for dividing up constructors from data
reading in this commit, meanwhile.
Comment by chihiro_saito [ 17/Jan/08 ]
Created an attachment (id=1)
Webrev for the fix.
Comment by chihiro_saito [ 17/Jan/08 ]
Fix committed at r169.
Comment by chihiro_saito [ 29/Jan/08 ]

o

Issue 20 has been marked as a duplicate of this issue. ***
Generated at Wed Feb 10 04:48:21 UTC 2016 using JIRA 6.2.3#6260sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.
Download