• Русская Версия
  • Constantiner

Constantiner's blog

RIA: Adobe Flex, Adobe AIR, Flash-platform, ActionScript, MXML, Microsoft Silverlight, WPF, Sun JavaFX
  • Home
  • Contact
  • Log in

Making custom layout for solar planets list with Flex 4

As you know, Flex 4 introduces architecture which allows to separate containers (including data containers and lists) and their layouts. I’ve decided to invest some time in these new features and to create some cool layout. Investigating layouts deeper I’ve realized their power is limited… only by your own imagination :) Why not create some kind of List control which represents planets from our Solar System? In their natural layout with orbits, Sun, rotation etc. It will be much more funny than just usual list even with custom item renderers. Something like the following:

Solar Planet List with a custom layout

Solar Planet List with a custom layout

Ok, no problem. First, you need the right manuals, tutorials and samples. Lets start with Evtim Georgiev’s blog with a lot of great hints and code. For example, these layouts are truly incentive (sources are available through context menu). Evtim is also an author of tutorial on layouts on Adobe Developer Connection. You also need to be familiar with Spark item renderers which are the essential part of many custom layouts.

As in Evtim’s sample I’ve decided to illustrate the possibility of layout switching using states. So the List code will be as the following:

XML:

<s:states>
    <mx:State name="radial"/>
    <mx:State name="tile"/>
    <mx:State name="list"/>
</s:states>
<s:List borderVisible="false"
    dataProvider="{new PlanetsData()}"
    itemRenderer="com.riapriority.planetlist.renderer.SolarPlanetRendererImplementation"
    itemRenderer.list="com.riapriority.planetlist.renderer.PlanetDetailsRenderer"
    itemRenderer.tile="com.riapriority.planetlist.renderer.SimplePlanetRenderer">
    <s:layout>
        <layout:SolarPlanetLayout />
    </s:layout>
    <s:layout.tile>
        <s:TileLayout columnWidth="130"
            horizontalAlign="center"
            rowHeight="150"
            verticalAlign="bottom"/>
    </s:layout.tile>
    <s:layout.list>
        <s:VerticalLayout horizontalAlign="contentJustify"/>
    </s:layout.list>
</s:List>

As we can see in this implementation all the interaction with the List will be absolutely transparent for the application as if it looks very traditional way.

As far as the first draft was finished I’ve decided to add some additional features like possibility of different Solar layout representations ("flat” one and another one for relative sizes and distances). Using Evtim’s sample and great explanation of new features from Chet Haase new book Flex 4 Fun, I’ve added some animations and transitions. You can see the final application here. The sources are also available through context menu. And you can check out the code using Subversion from the Google Code page.

Ok finally what I learnt? Flex 4 is really cool framework which allows to create really impressive applications much more easier and enjoyable. The conception of parts separation and loosely coupling is in the heart of new architectural changes. This architecture lets perform unit testing much more effective. If you walk through the sources you can see tests of my custom layout. You don’t need to create UI objects and can use Mocks easily.

By the way I recommend you the latest version (release candidate of 1.0) of ASMock which is really usable now (together with FlexUnit 4) comparing with the first versions we wrote about a year ago. I plan to write a dedicated post about it in future. And it is very pity I can’t found a way to run tests with custom runner using Flex Mojos. This is the reason why tests are disabled in POM but you can run them using Flash Builder.

Another great tool which helped me a lot is SourceMate. It really extends the possibilities of Flash Builder and must have tool when you work with metatags. By the way you can buy SourceMate online easily from any location in the world which has an internet connection. As we know Flash Builder is not that kind of product :(

And the last tool which extends Eclipse for Flex development is Flexformatter. If you share your code with team or just everybody it really helps. At least it helps me :)

Ok. Feel free to leave some comments with suggestions how to improve this demo. Maybe we can do it better together :)

Bookmark this article at …

  • By Konstantin Kovalev
  • May 25th, 2010
  • Posted in Flex, Flash Platform
  • 14171 views
  • 6 feedbacks »
  English (US)  
  Tags: asmock, flex, flex 4, flexunit, layouts, renderers, source code

Adobe encourages software piracy

Ok, the first version of the post title was even more tough, something like “Adobe, burn in hell!” or so. But finally I got easy and decided to choose something more journalistic.

The thing I want to talk about is buying Adobe products. Comparing different Flex development tools I’ve found there is no absolute winner. And I’ve decided to buy Flash Builder 4. The trial period will expire but project development should go on.

So as far as I moved to the small country in the Eastern Europe calling Montenegro, there is no chance to find any local resellers. Anyway nor Adobe neither Google knows nothing about. It is not so easy to buy something here and this is a reason I prefer online stores. I hadn’t any problems with buying software online with my credit card. A couple of clicks and my license is in my GMail account. Buying soft from Apple’s AppStore is the same story — just a couple of clicks.

But Adobe is something different. Their way to sell products is new word on the market. If Adobe deals the same way with partners I can understand why Steve Jobs finally rejected Adobe’s attempts to cooperate. Ok lets return to the Adobe store. First I can’t find any relevant countries at all. No Montenegro. No even Serbia. What should I do? I’ve decided to register some account with USA address. A long Flash preloader, then a couple of Flash runtime exceptions and finally The Form. Filled address etc and then continue. Another exception and infinite progress sign… That’s cool for me. Great product!

Finally I’ve received an email and realized the registration process successfully finished. Without any email verification. God bless Adobe developers: they didn’t ask my credit card number during registration. Because I can misprint my email address easily, right?

Ok. Lets go further. When I tried to pay using PayPal I’ve got another infinite progress sign. The second attempt gave me a message my PayPal address and Adobe Store address isn’t match. So I should sit in the same place all my life if I deal with Adobe. Great to know.

Then I tried to use my credit card directly. And verification process begins. The first stage passed. Then I got a message my card will be verified within one business day.

A little lyrical digression here. When I tried to choose the exact version of Flash Builder to buy I’ve decided to buy cheeper version. But maybe the ugly navigation of Adobe Store is great thing for Adobe to deal with the first time visitors. While I tried to find version comparison etc. I’ve decided to buy Premium version. It was a kind of impulse.

But when I got an email message with information that I should wait I finally got regretted that I didn’t choose cheeper version. I’ve almost canceled my order but finally decided to finish the deal as is. Three hours later I received an email with the message:

We appreciate your recent order; however, we regret that we are unable to process the transaction at this time.

As far as I can understand they didn’t like my credit card. Apple likes it, eBay likes it, JetBrains likes it, a lot of other software vendors likes it. But Adobe is something different.

THe interesting thing about is the message contained a cynical advice:

Or, you can find a reseller (www.adobe.com/buy) that will be able to help you with your order.

Should I talk you there is no option for Montenegro nor online neither offline? The only thing I need is to buy license key online. It is so simple. A lot of companies offer it.

As far as I can search I’m not the only person with the same kind of difficulties. Abdul Quabiz, the famous Flex developer from India, has the same problems repeatedly.

And now please answer the simple question: what should client do if he can’t buy a piece of software? Maybe it is true? Maybe Adobe encourages software piracy?

P.S. It seems to be I’ll choose Realaxy ActionScript Editor which is developing here in Montenegro. They’ll release private beta at the end of next week. It will be something special! More news about are coming… :D

Update: I’ve added issues in Adobe Labs Ideas for possibility to buy products online from every location in the world. One for Flash Builder, one for Flash Catalyst and the last for Flash Professional. You can find more ideas I want you to vote in my dedicated post.

Bookmark this article at …

  • By Konstantin Kovalev
  • April 16th, 2010
  • Posted in Flex Builder, Adobe
  • 27192 views
  • 6 feedbacks »
  English (US)  
  Tags: adobe, flash builder, piracy

The friendly Adobe Community Help replacement for Flash Builder

As we wrote recently a lot of people doesn’t like new brand Adobe Community Help in Flash Builder. And there is popular issue on Adobe Labs Ideas about it. As for me personally I can understand Adobe with this new universal AIR based solution for all the CS5 products. But universality in product line parts can be not so obvious for users. Adobe Photoshop, Adobe Flash Catalyst and even Adobe Flash Professional are mostly designer’s solutions. Doesn’t consider the fact that Adobe Catalyst is Eclipse based tool. For designers it doesn’t matter.

But Flash Builder is definitely developer’s tool. And is obviously Eclipse based. Is an Eclipse plug-in to be precise. And Flex/ActionScript developers with Flash Builder are not a kind of spheric cows in vacuum. They can use other Eclipse based tools the same time. Adobe pretends to attract Java developers in Flex development as the most probable auditorium. And a lot of Java guys uses JDT. Which is Eclipse plug-in too. There are a lot of useful plug-ins for every day using in process of server/client development. Believe me.

And all the plug-ins have universal help system which is common on Eclipse platform. Not using that help system is the same as creating, for example, your own Address Book for your application on Mac OS X (as Microsoft with their Entourage done). It is VERY inconvenient and confusing. Because Eclipse help system has all that you need: TOC, search, bookmarks, hyperlinks, possibility to open in external browser and even online search.

But Adobe implemented their own tool. Why?

Anyway very talented developer from Ukraine Rostislav Siryk aka Rost (manager and cofounder of Ukrainian Adobe Flash Platform User Group) run new project on Google Code to solve that issue. Let me introduce FFBD (Friendly Flash Builder Docs) to make Flash Builder docs usable in Eclipse. It is an Adobe AIR client to import Flash Builder documentations from Adobe Community Help into native Eclipse help system. The first version is now available for testing.

And of course as far as project is open sourced all kinds of participation are welcome. You can test it and provide feedback. You can help with ideas and coding. Or just write out a couple of lines about the tool in your blog to spread the news.

For now there is a couple of open issues aka TODOs for our friendly FFBD. Maybe someone has some useful thoughts about?

Anyway meet FFBD and lets make it worth alternative!

Bookmark this article at …

  • By Konstantin Kovalev
  • April 15th, 2010
  • Posted in Flex, Flex Builder, News, Adobe, Utilities
  • 8507 views
  • 2 feedbacks »
  English (US)  
  Tags: adobe, adobe community help, flash builder, news, open source

Flash is not 99% unique

The situation in web applications and RIA fields is changing. We can see a lot of HTML5 guys whose growing army relies on its openness and believes in resolving of all the current HTML5’s problems in the closest future. In other hand Silverlight copies all the Flash killer features (both existing and forthcoming) without any problem. And the last trump card of Flash is penetration.

But there is a couple of new hard nuts to crack on the market. I mean iPhone and iPad. Which generates the most internet traffic among mobile devices in the US. And Steve Jobs is also HTML5 guy. So now we have two mobile platforms which Flash couldn’t reach. Ever. No penetration at all. Ever. Adobe can do nothing about it. Ever :(

And now I can hear some sound in the air. Some kind of bell to change something from Adobe. What is that <skipped> HTML5 with poor JavaScript etc? It is an open source standard. Maybe it is better for Adobe to become standard too? Not only de facto but de jure? To be a part of W3C? To allow third parties to have a part in specifications etc? I don’t know. But it has to change.

Flash is not 99% unique. It was. But something changed :(

Bookmark this article at …

  • By Konstantin Kovalev
  • April 9th, 2010
  • Posted in Adobe, Flash Platform
  • 14518 views
  • 5 feedbacks »
  English (US)  
  Tags: adobe, flash platform, flash player, thoughts

Filtering Flex project's services-config.xml with Flex mojos

The problem

It is very often if we need to parametrize some options in services-config.xml of our Flex project to insert values depending on build process target. Let me explain it by example.

Imagine we have an application which use both secured and unsecured AMF channels. Lets use https for user related operations (log in, forget password, registration etc.). And http for other queries.

So we should define additional channel in our services-config.xml:

XML:

<channels>
        <channel-definition id="channel-amf"
                            class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
                      class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>
 
       <channel-definition id="channel-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
           <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
           <properties>
               <add-no-cache-headers>false</add-no-cache-headers>
           </properties>
       </channel-definition>
    </channels>

But there is a problem on a client side. If Flex application can extract server port from enclosing HTML page’s URL (it is performed automatically by Flex) but there is impossible on a client to determine port for https. So we can hardcode it:

XML:

<channel-definition id="channel-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
           <endpoint url="https://{server.name}:443/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
           <properties>
               <add-no-cache-headers>false</add-no-cache-headers>
           </properties>
       </channel-definition>

But there is still an other sort of problem. If we are talking about our channel-amf channel there is no problem with port at all in any environment. Lets imagine we debug our application with BlazeDS on a local Tomcat server on a port 8080. And we use default port 80 in production (with Apache’s mod_proxy or so). All the AMF queries with such parametrized port will be valid.

But if we’ll use Tomcat’s 8443 port for secure AMF channel (our channel-secure-amf) in local test environment and usual 443 in production we can’t hardcode that port in services-config.xml. At least in version control system.

The solution

The solution is supposed using Maven and Flex Mojos for the client side of our Flex project. Lets place our services-config.xml and remoting-config.xml under src/main/resources. It is default location for remoting configs if we use Flex mojos to not define it in POM explicitly.

Now we should introduce port parameter in our services-config.xml to be filtered:

XML:

<channels>
        <channel-definition id="channel-amf"
                            class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
                      class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>
 
       <channel-definition id="channel-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
           <endpoint url="https://{server.name}:${https.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
           <properties>
               <add-no-cache-headers>false</add-no-cache-headers>
           </properties>
       </channel-definition>
    </channels>

We should replace ${https.port} while building with appropriate value depending on our target. We’ll use Maven profiles to replace with local or production profile. Lets add the following to the profiles section of our settings.xml:

XML:

<profile>
          <id>local</id>
          <activation>
              <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
              <https.port>8443</https.port>
          </properties>
      </profile>

And on a build server for production build we’ll use something like the following:

XML:

<profile>
          <id>production</id>
          <activation>
              <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
              <https.port>443</https.port>
          </properties>
      </profile>

Ok. Lets try to add filtering capabilities into our POM:

XML:

<resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/services-config.xml</include>
                </includes>
            </resource>
        </resources>

And then run our build with local profile:

Code:

mvn clean install -P local

The result is:

Code:

[ERROR] Token '{https.port}' in 'services-config.xml' was not replaced. Either supply a value to this token with a JVM option or remove it from the configuration.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error compiling!
[INFO] ------------------------------------------------------------------------

As we see the port isn’t replaced. It is very strange. If we’ll continue our investigations we’ll discover that our resulting services-config.xml in ${project.basedir}/target/classes is successfully filtered. But didn’t considered at all while building :(

Ok. Now we know what shall we do to get things done. We should define our build configuration inside services section:

XML:

<services>${project.build.outputDirectory}/services-config.xml</services>

So now Maven will filter our resources first and then will use filtered resources while building Flex application.

And in conclusion we should talk about Flash/Flex Builder. How to use the right services-config.xml there? No sweat! Just point ${project.basedir}/target/classes/services-config.xml in the compiler options. That’s all for now :)

Alternatives

Another way is loading services-config.xml at runtime as we described earlier. So you can use one version in local environment and an other in production.

Bookmark this article at …

  • By Konstantin Kovalev
  • April 1st, 2010
  • Posted in Flex, Tips and tricks
  • 4736 views
  • Send feedback »
  English (US)  
  Tags: blazeds, flex, flex mojos, maven, tips
1 2 3 4 >>
  • Constantiner's blog

  • Blog about Rich Internet Applications (RIA) world (Adobe Flex/AIR/Flash, Microsoft Silverlight/WPF, Sun JavaFX) and even more...

  • About Me

    Konstantin Kovalev
    Remote RIA developer, consultant on contract basis, freelancer.

    Location: Dobrota, Montenegro (Crna Gora)

    Specialization: Adobe Flex, Adobe AIR, Flash platform, server side Java.

    Russian version is also available in Google Translate.

    View Konstantin Kovalev's profile on LinkedIn

    Konstantin Kovalev on Google
  • September 2010
    Sun Mon Tue Wed Thu Fri Sat
     << <   > >>
          1 2 3 4
    5 6 7 8 9 10 11
    12 13 14 15 16 17 18
    19 20 21 22 23 24 25
    26 27 28 29 30    
    • Recently
    • Archives
    • Categories
    • Latest comments
  • Search




  • Categories

    • All
    • Adobe
      • Adobe AIR
      • Flash Platform
      • Flex
        • Flex Builder
    • Eclipse
    • Links
    • Microsoft
      • Silverlight
      • WPF
    • News
    • RIA
    • Sun
      • Java
        • J2EE
        • JavaFX
    • Tips and tricks
    • Utilities
  • Archives

    • May 2010 (1)
    • April 2010 (4)
    • March 2010 (1)
    • February 2010 (2)
    • January 2010 (1)
    • November 2009 (1)
    • May 2009 (1)
    • April 2009 (1)
    • February 2009 (2)
    • May 2008 (1)
    • February 2008 (2)
    • October 2007 (1)
    • More...
  • FriendConnect

  • Want to hire a Flex-developer from Russia?

    Google Groups Beta
    ruflexjobs
    Visit this group
  • XML Feeds

    • RSS 2.0: Posts, Comments
    • Atom: Posts, Comments
    What is RSS?
  • Aggregation

    Aggregated by MXNA
  • User tools

    • Login
    • Register
    • Admin
  • Who's Online?

    • Guest Users: 9
  • Social Networking

    Konstantin Kovalev
  • Stats

    This blog has 20 posts and 94 comments spanning a range from 09/24/07 to 05/25/10. The total number of words in all posts is 19,683 and the total number of views for individual posts is 1,051,548.

    Most comments

    • A big mistake: Flex Builder is now Flash Builder (32)
    • Truncate Labels in percent width containers (11)
    • Halleluiah! Flash Mocks near you! (11)
    • Adobe encourages software piracy (6)
    • Making custom layout for solar planets list with Flex 4 (6)

    Most views

    • A big mistake: Flex Builder is now Flash Builder (53,187)
    • Halleluiah! Flash Mocks near you! (44,762)
    • Generating get/set methods (31,218)
    • Adobe encourages software piracy (27,192)
    • Debugging event handlers in MXML gotchas (25,794)
    • Truncate Labels in percent width containers (23,545)
    • Solved: change username in IntelliJ IDEA on Mac (17,095)
    • Flex 3 beta 2 announce (16,937)
    • Flex Developer Remoting Edition (16,073)
    • Flash is not 99% unique (14,518)
    • More...

    Most words

    • Filtering Flex project's services-config.xml with Flex mojos (919)
    • A big mistake: Flex Builder is now Flash Builder (811)
    • Buzz about iFlash (808)
    • Adobe encourages software piracy (761)
    • Making custom layout for solar planets list with Flex 4 (674)
    • More...
  • Tag cloud

    actionscript adobe adobe community help apple asmock blazeds eclipse events flash flash builder flash platform flash player flashgamm flex flex 4 flex builder flex mojos flexunit games google ide ideas intellij idea ipad iphone java jira jobs labs layouts links maven me mocks news open source piracy renderers ria source code thoughts tips unit testing

  • Contents

    • Making custom layout for solar planets list with Flex 4
    • Adobe encourages software piracy
    • The friendly Adobe Community Help replacement for Flash Builder
    • Flash is not 99% unique
    • Filtering Flex project's services-config.xml with Flex mojos
    • Meet Adobe Labs Ideas
    • Buzz about iFlash
    • Solved: change username in IntelliJ IDEA on Mac
    • Dynamically loaded BlazeDS configuration in Flex applications
    • Flash GAMM Ukraine
    • A big mistake: Flex Builder is now Flash Builder
    • The simple things why I prefer to develop Java than Flex
    • Adobe JIRA: please vote!
    • Halleluiah! Flash Mocks near you!
    • Flex Developer Remoting Edition
    • Truncate Labels in percent width containers
    • Debugging event handlers in MXML gotchas
    • Flex 3 beta 2 family is out!
    • Generating get/set methods
    • Flex 3 beta 2 announce
  • Recent comments

    • runescape gold on A big mistake: Flex Builder is now Flash Builder
    • Konstantin Kovalev on Making custom layout for solar planets list with Flex 4
    • Bill White on Making custom layout for solar planets list with Flex 4
    • Chad Wilson on A big mistake: Flex Builder is now Flash Builder
    • Wouter VdB on The friendly Adobe Community Help replacement for Flash Builder
    • Vertex on Making custom layout for solar planets list with Flex 4
    • Constantiner's blog on Adobe encourages software piracy
    • Constantiner's blog on Meet Adobe Labs Ideas
    • Konstantin Kovalev on Making custom layout for solar planets list with Flex 4
    • Tink on Making custom layout for solar planets list with Flex 4
    • Elite Hussar on Making custom layout for solar planets list with Flex 4
    • Constantiner's blog on Adobe encourages software piracy
    • Constantiner's blog on Halleluiah! Flash Mocks near you!
    • poorkid on A big mistake: Flex Builder is now Flash Builder
    • William Mitchell on Dynamically loaded BlazeDS configuration in Flex applications
    • Konstantin Kovalev on Adobe encourages software piracy
    • Gaspy on Adobe encourages software piracy
    • Konstantin Kovalev on Adobe encourages software piracy
    • Sanariam on Adobe encourages software piracy
    • adampasz on The friendly Adobe Community Help replacement for Flash Builder
  • Weather

    Fair
    21°C
    Tivat, Montenegro
    Feels like: 21°C
    Wind: ESE 2 km/h
    Today's high: 29°C
    Today's low: 17°C
    Sunrise: 6:12 AM
    Sunset: 7:17 PM
    More...

powered by b2evolution free blog software


Contact | Powered by b2evolution
Credits: Foppe Hemminga | multiple blogs | web hosts