logo

So You Are Interested in Flex Then?!

ScreenShot003Yesterday I stole a an hour or two away from the usual stuff to spend some time working on the Domino/Flex Accounts database. What I'm trying to do is get it to the point where I'm happy to release the code to you all. It's just a bit too messy at the moment. It was a case of learn-as-you-go, which really shows and I want to retrofit some better practices I've learnt since.

The reason it's been so long since I talked about Flex is that I got the feeling you weren't interested. Then I decided to stop caring so much what I think it is you're interested in and just write about what I want to.

Then I happened to notice while searching the web that Google Suggestions brought up "codestore flex" when I typed in codestore (see image above).

Now, I don't know how many Googles for the same query have to happen before it to becomes a suggested query, but I'll assume it's quite a few and hence that a few of you are interested in Domino and Flex. Seems a safe assumption to me.

So Flex will be something I'll be talking about more and more from now on. Like it or lump it.

An Example of Why I Love Flex

My intention is to squeeze in as many different tips/tricks to the accounts demo as I can - making it somewhere you can turn to in a kind of "How did Jake do that ...?" kind of moment.

At the same time I wanted to "sex it up" a little. To that end I added some effects to make the "update form" slide in and out of view when you double click an entry in the view.

To do this is so, so simple. Here's the simplified MXML code in use (bits missed out for obvious reasons):

<mx:Resize id="slideFormUp" heightTo="210" duration="900" />
<mx:Resize id="slideFormDown" heightTo="0" duration="700" />
    
<mx:Panel>
        <mx:AdvancedDataGrid dataProvider="{documents}">
                <mx:doubleClick>
                        <![CDATA[
                                frmUpdate.visible = true;
                        ]]>
                </mx:doubleClick>
        </mx:AdvancedDataGrid>
                                
        <mx:Form id="frmUpdate" 
                hideEffect="slideFormDown" showEffect="slideFormUp"
                width="100%" visible="false" height="0">
                        <!-- Form items here -->
        </mx:Form>
</mx:Panel>

What's going on here then?

Well, the AdvancedDataGrid ("view") and the Form both live inside a Panel and share it's vertical space. At first the form is hidden (height=0px and visible=false). The view takes up the full height of the parent panel container.

The view has a doubleClick event handler defined. When you double click a row the form's visible property is set to true. This won't show the form by itself though, as it has a height of 0px. This is where the form's showEffect property kicks in. This points to the <mx:Resize> object with the ID specified.

The resize object tells the form to increase its height to 210px over a duration of 900ms. The resize effect kicks in automagically when the object it's tied to has it's visible property changed to true. The opposite is true of the hideEffect and the other resize object you can see.

So, all you need to is say visible = true/false and the effects run on their own! How cool/simple is that?

What I love is how elegant and predictable the code is. Things just work how you'd expect them to. Hence Flex is a very productive environment to work in. I rarely find myself spending any amount of time trying to figure out what's going

You can see the effect in use by clicking the screenshot below:

ScreenShot005

Ease Off On the Effects

You could be forgiven for thinking the slide in out/effect is merely pointless eye candy. I'd beg to differ though. Used sparingly and in the right places, visual cues like this can help the user see when something has changed on screen. Simply turning the form on/off could mean its existence is over-looked by the user. Just make sure you don't make it take that long to scroll up that you end up annoying the user so much they become less productive.

While it's simple to add effects like this, the hard part is knowing when to ease off ('scuse the pun!) on them. Don't go throwing them in all over the place for the sake of it! Sometimes, less is most definitely more.

Comments

  1. I am definitely still interested. I was getting very fired up about it but the project I was pitching for didn't fly. I think that biggest reason was the "current climate" but interestingly one of the reasons cited by the customer that flex would present a business risk because it was such a new technology. It is interesting that "flex builder"s being dropped in favour of "flash builder" for the next release.

    The proof of concept that I was able to put together ( with the help of your examples ) was much better than anything I have managed to do in xpages in the same time frame.

    It is definitely horses for courses and flex is not always the right answer but if your app is mostly about presenting data and using charts it is a very compelling product

    I would love to do more with it but just at minute that would e a luxury. I was gutted though as I had hoped to present the project at UKLUG

    Sean

  2. Hi Jake,

    Yes please.

    I also echo the sentiments that Sean's made above.

    XPages has left me a little cold and non-plussed. Flex appears to offers the same and more without having to rip your app apart just to wedge in a sexy widget.

    And until they've sorted out that ghastly developer ide interface, I won't be revisiting it.

    I take it that this is totally x-browser compatible?

    thanks,

    al

  3. Jake - very interested - like all things new its about finding a good place to start (at the beginning..) - anyway - any advice? Thanks.

  4. Hi Jake,

    Yes please.

    I'm still as interested as from the beginning

    Your ideas and comments always welcome ;)

  5. I would like to get a look at code behind the accounts database. I look forward to your Flex posts.

  6. Jake, I'm VERY interested in what you are doing, and eagley waiting for your Demo database, which should give me a good starter for ten. I'm always looking for alternative ways of interfacing to Domino.

    • avatar
    • John C
    • Fri 28 Aug 2009 05:37 AM

    Hi Jake,

    I'd like to echo everyone else here. VERY VERY interested in FLEX & Domino. Your site is pretty much my first point of call on a daily basis. Keep up the great work and keep posting about things you want to.

    I enjoy reading everything you post, both technical and personal. Your tips & technical articles have saved my behind many times.

    • avatar
    • Jake Howlett
    • Fri 28 Aug 2009 07:26 AM

    Thanks all. Good to see some interest out there. You won't be disappointed! Lots more to come. Accounts db download not far off either.

  7. Me too. Like what I saw and put together a demo for my customer. My issue, was the data I was going against, something around 50k records... (users don't beleive in archiving and feel all data is relevant) seems to take a while to load a data grid to then use for charts and graphs.

    Another friend of mine who also does flex, told me about some data server kinda thing... but since the app was so slow, lost momentum and haven't gotten back to it or taken the time to figure out a solution. So any thoughts on working with speed for large data sets and the data grid would be a huge help.

    But I really like what I have seen on here and look forward to learning more about it. Good work.

    • avatar
    • Jake Howlett
    • Fri 28 Aug 2009 08:17 AM

    Hi Troy. Performance of Flex datagrids with large datasets is a commonly-discussed issue out there.

    Loading 50k records in to anything is probably going to be slow though. Flex or no Flex. Probably time to look at pagination and find some other way of delivering "summary data" to use in the charts.

    It's a topic I'll try and remember to cover at some point though.

    Jake

  8. Me too. It is because of your blog that I got interested in Flex.

    • avatar
    • Rob
    • Mon 31 Aug 2009 11:18 AM

    I read this book years ago: "What You Think of Me is None of My Business". The title alone says it all, don't you think?

    And yes, I'm really interested in the intersection between Domino and Flex. You hang out on the bleeding edge so we don't have to.

    Thanks,

    Rob:-]

  9. keep it coming. good info. just won my first big flex project. not a Domino project but should help me with Domino projects in the future.

    • avatar
    • farooq
    • Fri 25 Sep 2009 09:41 AM

    Hi,

    I also find you code very useful. It really help me a lot but i fall into a problem i am using same code you write above at this page but when i double click on datagrid item. then form show from up to bottom. while as you show on your demo it comes from bottom to up.

    Please suggest what should i do to resolve this issue. Thanks.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Fri 28 Aug 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content