Check out our Angular Book Series.

The Flex Show - Creating Flex Components - Episode 3: Dealing with the DataProvider

This is the third episode of our video series on creating Flex Components. This is a series of screencasts designed to teach you how to make use of the component architecture in Flex.

In this episode we start coding and implement code for the dataProvider.

For some reason, Captivate is not syncing the audio and video properly. I'm trying to see if I can fix it and get a better version up here. Sorry.

You can View it online right here.

Sponsored By

Register and Download our No Cost Developer Editions today



Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
John's Gravatar The view it online link for episode 3 launches episode 2.
# Posted By John | 5/4/09 9:18 PM
Jeffry Houser's Gravatar So sorry, that was my typo.

Should be fixed now
# Posted By Jeffry Houser | 5/5/09 1:17 PM
Gareth Arch's Gravatar Hey Jeffrey,
Thanks for checking out my FlexDateUtils. I added a contact form to my site (Wordpress didn't seem to have a default one on install, so I never got around to adding one), so now anyone and everyone can contact is slightly annoying when you can't contact the site owner easily. I've scoured the web several times trying to find a means, rather than comments, to contact a site's owner. Enjoy the library. I actually need to add a swc eventually to make it a little easier for everyone to use it...dropping it into libs instead of having to mimic the directory structure of the library.

BTW, the site is actually Flex OOP, not flex coop :)
# Posted By Gareth Arch | 7/28/09 12:14 PM
Jeffry Houser's Gravatar Gareth,

The library has been very nice to me as I've been working on this series and the Flextras commercial Calendar component.

Did I screw up the site name in the screencast? I see it is correct in the show notes. If so, sorry about that. I'll post a retraction about that in a future episode.

Thanks for listening. And thanks for the library.
# Posted By Jeffry Houser | 8/3/09 7:24 PM
Attila Uhljar's Gravatar Awesome tutorial! And as luck would have it, I just happen to need a calendar component.

I haven't watched Episode 4 yet so these may be already fixed, but I've noticed a couple of potential bugs during this episode (#3):

1. In commitProperties when you're building the lookup table (dataProviderDictionary) you do not wipe out the old values. This could lead to garbage accumulating in the lookup table. It could be fixed by simply starting with creating a new dictionary before you start the DP processing.
Also, shouldn't we wipe out the DP cache if the newly set data provider is null?

2. Again, in commitProperties() the loop through the days of the month should start with '1'. In the demo you forgot to initialize it explicitely so it'll probably start with '0'. This is not a big deal, however, because your end condition is correct (.e.g. day <= daysInMonth), but distracting somewhat.

3. The key generation as described (i.e. year+month+day concatenated) is ambiguous, for example "2009113" could be a result of 11/03/2009 or 01/13/2009. Use a separator character (e.g. 2009-11-3) to make it unambiguous.
While we are at it, the key generation logic should be extracted into a method to avoid duplicating the logic all over the place. This way you need to fix it only once. :)

Thanks for the excellent work guys, I am very impressed that you did not simply pick some half-trivial toy component but something with real potential value.

Is the full source available somewhere by any chance?

Thanks again!
# Posted By Attila Uhljar | 8/4/09 7:09 PM
Jeffry Houser's Gravatar Attila,

I appreciate you watching and listening.

This series is designed to teach the process of building a component. Some of the thing you mention I'd consider "Bullet Proofing" type of actions which probably won't make it into the show.

You bring up valid points, though. I'll address each one.

1. The reason for not rebuilding the lookup table each time is because, I assume, that people will be cycling through months. I view the dataProviderDictionary as an internal cache of processed data.

2. Without looking in depth, I bet your right on this one.

3. Good catch here too on key ambiguity. Extracting the key generation logic is a fair point, but probably will not end up in the show. We'll have to see how it unfolds over remaining episodes.

The full source is not available anywhere. But, if you send us an e-mail I can see about posting it somewhere. Use the contact form on this site.

A more polished / feature rich Calendar component should be added to the Flextras line before the end of the year.
# Posted By Jeffry Houser | 8/4/09 7:28 PM
All content Copyright 2007, 2008, 2009, DotComIt, unless otherwise specified. May not be used without permission.
BlogCFC was created by Raymond Camden. This blog is running version
Adobe, the Adobe logo, Flex, Flex Builder, and Captivate are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. Adobe is not responsible for the content in any way.
This site part of the DotComIt Brain Trust