This project has moved. For the latest updates, please go here.

Abstract Elements

Feb 27, 2014 at 4:47 PM
I am writing a configuration file which handles the layouts of identity cards (which might change over time).

To do this, I basically need three different types of "Shape" - Rectangle, Text and Image, all of which have common attributes (eg. Top, Left, Width, Height, Name, Order) and which have additional attributes specific to their implementation.

I've created an abstract type (Shape) and derived Rectangle, Text and Image from it.

Effectively, I then want to be able to specify something like this:
<card name="Pre2014">
    <design> <!--ShapeCollection-->
         <rectangle top="1" left="2" height="250" width="350" name="rectBackground" order="1" backgroundColour="Green" />
         <image name"imageLogo" order="2" type="Logo" ... />
         <text name="textName" order="3" textValue="Name" ... />
As far as I can see, though, I can't create a collection of an abstract object; have I missed something?
Sep 12, 2014 at 9:48 PM
Hmm... I understand the principal in code, but I think it gets a little more complicated in the configuration/schema part of it. I'll look at it a bit more, but it might need to use the brute force "Has Custom Child Elements" property.