Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Heterogeneous list with no common property
Heterogeneous list with no common property [message #1060618] Mon, 27 May 2013 06:59
kon f is currently offline kon f
Messages: 33
Registered: March 2012
Member
Hey,

I'm trying to implement a list storing different types. The gallery examples presents a running implementation. I copied the example and adjusted it for my requirements that slightly differ. My sub types do not have any attributes in common. So my base type does not contain any property, as it is for IChildElement interface. IChildElement contains the StringValue property that is inherited to all subtypes and used to shown in the UI (table).

@GenerateImpl
public interface Base extends IModelElement {
    ModelElementType TYPE = new ModelElementType(Empty.class);
}


Text, Image and Pdf extend Base.

@Type(base = Base.class, possible = { Text.class, Image.class, Pdf.class })
@XmlListBinding
(
   path = "description", 
   mappings = 
   {
       @XmlListBinding.Mapping(element = "text", type = Text.class),
       @XmlListBinding.Mapping(element = "image", type = Image.class), 
       @XmlListBinding.Mapping(element = "pdf", type = Pdf.class)
   }
)
    
ListProperty PROP_DESCRIPTION = new ListProperty(TYPE, "Description");
    
ModelElementList<Empty> getDescription();


The table that shows the types in the UI just executes the toString() method from java.lang.Object and prints the memory address from org.eclipse.sapphire.ui.renderers.swt.DefaultListPropertyEditorRenderer$TableRow. Is there a straightforward way I could provide a label/content provider? I provided editing support in the detail area, but it would be nice if the user could directly change one property of a certain subtype in the table (that I would had to define per type e.g. for Image the URI and for Text the content). Is that possible?

Thank you!

Kon
Previous Topic:Advise for the use of Sapphire with present schema file
Next Topic: Element ordering not according to XSD (with several files)
Goto Forum:
  


Current Time: Tue May 28 03:21:25 EDT 2013

Powered by FUDForum. Page generated in 0.01557 seconds