Hi,
 
I didn't receive Lachlan's reply earlier (I'm obviously not receiving 
everything from the group :/)
 
So I'll reply to both of you here, ok?
 
Tracy:
 
I realise that the XML class is a dom, but that doesn't allow me to have TYPED 
entities, does it? Also with classes I can include validation code, etc. in the 
getters/setters.
I can't do this with the XML class, can I?
 
-----------
 
Lachlan:
 
Yes, I am trying to unmarshal the XML into custom classes as you say.
A bit of background wouldn't hurt ...
 
The XML describes a "document" where each line is EITHER some text, OR (up to 
3) graphics, OR a barcode, or a couple of other entities.
It's all XML, nodes and attributes, but not very regular.
 
A line/node could look like:
 
<text alignment="centred" font="A" charheight="2" emphasis="b">Name: <field 
key="fullname"/></text>
 
OR
 
<graphics valign="middle">
    <image alignment="left">vicdpi.jpg</image>
    <image alignment="right">sunset.jpg</image>
</graphics>
 
OR
 
<barcode type="code128" alignment="centred" height="16"><field 
key="pin"/></barcode>
 
So that each line needs a different customItemRenderer. Since the document is 
discretely line-based in structure, I thought a 1-column datagrid suited it 
well.
I tried dynamically rendering elements (in form structures) thru AS, but that 
proved to be pretty messy ... I could go back to it, but I'd rather not.
 
Yeah, I figured ICollectionView but I'm not actually sure how to assign it ... 
I've discovered Aral Balkan's notes on "Designing Data Models", that might 
clear it up for me.
 
Cheers
John
 
 

-----Original Message-----
From: Tracy Spratt [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 5 December 2006 8:12 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Class-based model as a dataprovider






John, can you use the XML class? It already IS a dom.  



Tracy




  _____  


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Lachlan 
Cotter
Sent: Sunday, December 03, 2006 11:08 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Class-based model as a dataprovider



Hi John,



Sorry if I missed the point but I'm not entirely clear on what you're trying to 
do here. Do you want to unmarshal your XML into an object graph of custom 
classes? I don't understand how the multiple renderers comes into it. What is 
the XML describing? Is it a result set or something less regular?



With regard to point 2, I think anything can be a dataProvider if it implements 
one of the accepted interfaces. IList, ICollectionView etc.



Cheers,

Lach





On 04/12/2006, at 11:57 AM, John Mazzocchi wrote:





Hi, I need a hand here ...

I have an app which reads an XML file, shoves everything into an 
XMLListCollection and then renders the collection to a one-column datagrid. 
Each row of the datagrid uses a (state-based) customItemRenderer [don't get me 
started on the problems I've had with ViewStack-based approach].

Anyway, it seems to work fairly well ... but I've now been asked to take a 
slightly different approach. The XML needs to be shoved into an Object Model (a 
custom DOM), so that the same data can have multiple renderers/converters 
created in the future (not just "renderToScreen")... renderToPDF, renderToCSV, 
etc. Now there are notes in the PDF docs on creating a Class-based model ... I 
figure I'm gonna create an array of Objects, each one typed as they need to be, 
you know Bool, Text, Graphics, customSetOfAttribs, whatever ... custom addItem 
and removeItem functions which use templates for each Object type.

1. Any comments on my methodology?

2. How do I assign an ActionScript class as a dataprovider (for a datagrid)?

Thanks.

Cheers
John







 



This email and any files transmitted with it may be confidential and are 
intended solely for the use of the individual or entity to whom they are 
addressed. This email may contain personal information of individuals, and be 
subject to Commonwealth and/or State privacy laws in Australia. This email is 
also subject to copyright. If you are not the intended recipient, you must not 
read, print, store, copy, forward or use this email for any reason, in 
accordance with privacy and copyright laws. If you have received this email in 
error, please notify the sender by return email, and delete this email from 
your inbox. 

Reply via email to