Radio button renderer in a datagrid

Using a radio button as a data grid cell renderer is an example of a more complex usage of data grid cell renderers. This is one way to achive this in a not very complicated way: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ public var dp:XML = <users> <user> <name>one</name> <main>true</main> </user> <user> <name>two</name> <main>false</main> </user> <user> <name>tre</name> <main>false</main> </user> </users>; ]]> </mx:Script> <mx:VBox> <mx:DataGrid dataProvider="{dp.user}" width="400"> <mx:columns> <mx:DataGridColumn headerText="Name" dataField="name"/> <mx:DataGridColumn headerText="Main"> <mx:itemRenderer> <mx:Component> <mx:HBox horizontalAlign="center"> <mx:Script> <!...

August 29, 2009 · len

Fixing dateChooser position and size

As described here, the dateChooser positioning algorithm does not account for the overall size of the window and this results in some clipping of the dateChooser window for the DateField. Take a look at frameworks/projects/framework/src/mx/controls/DateField.as displayDropdown function. I’m trying here to provide a partial fix. The ideea: trap the open event and reposition/resize the dateChooser. This can be done just by adding an event listener to the DropdownEven.OPEN event. to avoid problems if the dropdown appears on top of the dropdown button I had to move the code inside a derived class to access the textInput object....

January 29, 2009 · len

A few notes on flex objects

For a java developer starting to work with flex seems quite easy. However since most people will never read the hole manuals, probably also because of this easiness I’ve decided to write some things about flex objects which are not immediately obvious from a java developer point of view. The flex objects are hashes This is the most interesting aspect of a flex Object from my point of view and if you see things in this way then the following might seem a bit more clear:...

January 26, 2009 · len

Propagating model changes to a DataGrid

Flex offers a nice way to represent data in a model and configure this model as a data source for a DataGrid or other visual components (ComboBox, AdvancedDataGrid, etc.). This allows for a quick start but sometimes deadends when a change to the model is not propagated to the view. I am trying here to explain a few aspects related to this. The first model [Bindable] private var dataSource1:ArrayCollection = new ArrayCollection([ {col1:'1A', col2: '1B'}, {col1:'2A', col2: '2B'} ]); The DataGrid...

January 16, 2009 · len

Blogosfera v2.0

\function getParam(name) { var index = document.URL.indexOf('?'); var params = new Array(); if ( index != -1 ) { var nameValuePairs=document.URL.substring(index+1,document.URL.length).split('&'); for ( var i=0; i<nameValuePairs.length; i++ ) { nameVal = nameValuePairs[i].split('='); params[nameVal[0]] = nameVal[1]; } } return unescape(params[name]); } var flashvars = { nodeId: getParam(“nodeId”), splash: “Incarc date despre 5000 bloguri\ncâteva momente…”, aboutURL: “http://www.len.ro/work/articles/blogosfera-v2.0/"}; var params = { wmode: “opaque”}; var attributes = {}; swfobject.embedSWF(“http://www.len.ro/hidden/hartaBlogosferei/hartaBlogosferei.swf", “hartaBlogosferei”, “590”, “590”, “9....

September 3, 2008 · len

Working with namespaces

First when you start working with XML in flex you are completely wondered about how easy the xpath like syntax is used. However some botlenecks might occur. One of them is using namespaces. Consider the following example: <?xml version="1.0" encoding="UTF-8"?><report version="3.2.15" xmlns="http://www.len.ro/report"> <item name="user">len</item></report> First approach is to do something like: var myXML:XML = XML(event.result);trace("XML: " + myXML.item.@name); you will see nothing and start wondering what you are doing wrong. Some time later you realize it’s namespace related and you try (according to flex doc) to do this:...

June 16, 2008 · len

Locale files

When using flex and java in parallel the localization mechanism might be clear. One aspect which is not clear is the encoding of the properties files: Flex locale files encoding: UTF-8 Java locale files encoding: ISO-8859-1 Convertor script: ..$ cat fixUTF.sh #!/bin/bash TMP=iconv.tmp if [ "!$2" == "!rev" ]; then iconv -t ISO_8859-1 -f UTF-8 -o $TMP $1else iconv -f ISO_8859-1 -t UTF-8 -o $TMP $1fimv $TMP $1

May 13, 2008 · len

Logging

In the code just add trace(…) calls as you would add printf of System.out.println calls The plugin first you will need the debugger version of the plugin. In ubuntu the plugin can be found in /usr/lib/firefox/plugins which is usualy a link in /etc/alternatives which links to the actual plugin. root@black:/home/len# ls -l /usr/lib/firefox/plugins/total 8628lrwxrwxrwx 1 root root 37 2008-04-27 22:43 flashplugin-alternative.so -> /etc/alternatives/firefox-flashpluginroot@black:/home/len# ls -l /etc/alternatives/firefox-flashplugin lrwxrwxrwx 1 root root 99 2008-05-01 17:33 /etc/alternatives/firefox-flashplugin -> /phantom/linux/Adobe_Flex_Builder_Linux/Player/linux/install_flash_player_9_linux/libflashplayer....

May 8, 2008 · len

Which server side for a Flex app

Context choose the server-side technology for a flex application java based Randoms flex supports HttpService, WebService or RemoteObject first thought: HttpService -> ServletDispatcher -> Service -> Java -> DB -> XML -> HttpService. NO: we are in the future, something like that must already exist, I would have done that 5 years ago except for Flex which didn’t existed then RemoteObject requires a special server side application such as BlazeDS seems simple enough and I like that you only have a few xml files to define your services which you associate with your java classes seems the only choice if you need real-time messaging which is not the case here RemoteObject communication uses a binary communication protocol which is bad if client technology is going to change and is difficult to sniff/debug and/or test without the server....

April 21, 2008 · len

Which technology for your next webapp?

I am faced with a new web project for which I have to choose the technology to use it. Five years ago I was in the same position and I chose Tapestry. It proved to be a very good choice (1, 2, 3) and I am still able to modify and adapt that code without much difficulty. However now there are so many rich web interfaces which I cannot ignore....

April 8, 2008 · len