Hi everybody,
I am currently working on a small vector graphics editor (sort of) and facing a code design question, wondering how it would be solved in an elegant and straightforward manner.
If anyone has a good idea how to solve this, or knows a good link or a piece of open source code dealing with a similar setup, I would be really happy.
Basically, the status quo is as follows
- a stage holding all elements, knowing which elements are selected
- it is possible to select multiple elements
- each element may have child elements (which cannot be selected separately but may have their own properties)
What I want to do implement is a property toolbar which allows changing properties of selected elements.
Of course, different element types have different properties - the toolbar should display the intersection of selected element types.
I have spent a lot of time thinking about this and thought about several approaches, none of which seems to be really elegant/straigtforward. I thought about using maps or reflection, but would prefer to have a typesafe solution without casts. I suspect I might be missing an obvious solution here or a cool pattern I do not know... At first go, what would be your idea for approaching this?
Thank you very much for any inspiration with this.