Pattern for plugins, archiving, and dynamic document data model?
Pattern for plugins, archiving, and dynamic document data model?
- Subject: Pattern for plugins, archiving, and dynamic document data model?
- From: "l.m.orchard" <email@hidden>
- Date: Thu, 30 Aug 2001 09:58:17 -0400
Okay, hopefully this makes sense. I am working on an outline editor
which supports plugins. The model is basically a tree, with arbitrary
data hung off the tree nodes. Out of the box, the outline editor has a
title and notes hung off each tree node.
Now, I want to allow plugins to introduce new classes of data to hang
off each node. For instance, I want to write a to-do item plugin which
adds things like completion progress, task due date, hours anticipated,
etc. This plugin would supply a new model class for the data, and a new
panel to add to the outline item inspector.
The big wrinkle I have in all of this is that, if someone does not have
the plugin, I would like the saved document to still be handled
gracefully. That is, you will see the title and notes if you do not
have the to-do item plugin, and when you save, the original to-do item
data will be preserved (if possible). I think I can do the first, but
I'm not sure about the second.
What I have in mind is to store all the extended data in a dictionary of
dictionaries. The first level of the dictionary will be keyed on
outline tree node objects, and the second will be keyed on the plugin
identifier. So, this is maintaining the extended data objects
separately from the main document tree. Then, when I save, I will
archive the document tree first, and then the extension dictionary.
I'm hoping that this will allow some sane handling of the documents when
the plugins are not present. Am I crazy with this idea, or...?
--
Leslie Michael Orchard <email@hidden>
ICQ: 492905 (home) 11082089 (work)
"...see you space cowboy..."