关于Flex Summit的一些: http://www.spoon.as/2011/flex-summit-live-updates-day-2/
邮件列表: http://incubator.apache.org/flex/mailing-lists.html
I am pleased to announce that Flex as been accepted into the Apache Incubator. With weekends and holidays, I suspect that it will still be several days before we get up and running with mailing lists, bug base, source control, etc, so we continue to appreciate your patience. However, I’m really looking forward to 2012 and beyond, and I hope you are too.
-Alex
http://blogs.adobe.com/flex/2011/12/a-great-ending-to-2011.html
Apache上Flex的主页已经准备完毕: http://incubator.apache.org/projects/flex.html
2011的最后一天,外面飘着雪花。 房子里很热, 外面很冷。
这一年其实没有太多变化。
收音机里的电池还能用, 每天晚上都能听一会儿947。
好久不见。
乌鲁木齐也没有太多改变, 冬天还是老样子,阴沉,灰白。
见了一些同学好友,想跟他们好好叙叙旧, 结果他们把我放倒,再放倒,直到我记不清这是哪一年,直到我莫名其妙的醒来,醒来又醉过去。
这真不是个随便的地方, 想来不一定能来, 想走还不一定能走, 因为他们太能喝了。
回了学校两次, 边边角角都有太多回忆, 甜的酸的竟然都统统变成苦的了,
直到我到了红胡,看到那破桥上零散的关于爱或是理想的碎碎念,哦, 其实大家曾经历过,或深或浅,谁没从红湖的冰上走过?
【谁会像我一样,在此浪漫的回忆】 悲伤的又不止我一个, 我去!有些人往墙上写,往树上刻,如果当年土操场边边上的杨树还在,那该有多少故事可看。
除此之外,还有人往心里刻,这种人是最SB的。
于是后来我又去自习室睡了一觉, 大学里除了宿舍之外,可以睡觉的地方很多。自习室便是其中之一。我想通过小睡一把来烫平那年的痕迹,结果我翻来覆去睡不着。
算了,时间是把杀猪刀,还是交给时间吧。
走走,咱们奔赴下一个酒桌!
他们毕了业,买了房,结了婚,有了幸福的家,贤惠的妻,我看的羡慕,我看的嫉妒。
他们的幸福像一束刺眼的光, 我睁不开眼, 不可久留, 所以我一个地方只睡一次,第二天酒醒就闪。
不是哥不留恋你们, 只是怕被你们的幸福刺伤。
新工作,一份有人情味的工作。
不过每天班车上的时间很多,于是一直在路上做梦。
6月到8月, 基本上都在找工作, 面试,十几家公司之后,手里有了主动权。
从家里回来之后感觉下一个拐点马上来到, 于是顺其自然的等待,就算我不动, 时间也会动。
于是我听着收音机,看看书,打打坐。
There is a datagrid displaying users:
And this datagrid is editable , we can modify username directly, by default, Flex will use TextInput as the item editor.
I want to display some error mesg in a datagrid ItemEditor when use input is invalidate.
So I add a listener to the item edit complete Event:
/** * validate user input, revert the original value if necessary. */ protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void { if(event.dataField != "Name") { // chech the field; return; } var input:String = (datagirdTest.itemEditorInstance as TextInput).text; // get the user input data. if(input == null || input == "") { event.preventDefault(); // prevent default behavior (datagirdTest.itemEditorInstance as TextInput).text = (event.itemRenderer.data as XML).Name;// Undo: revert the original data by the selected item. Alert.show(errorMesg); return; } }
It can work correctly, but our client think we should not change user input directly. so I comment off the undo line:
/** * validate user input, revert the original value if necessary. */ protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void { if(event.dataField != "Name") { // chech the field; return; } var input:String = (datagirdTest.itemEditorInstance as TextInput).text; // get the user input data. if(input == null || input == "") { event.preventDefault(); // prevent default behavior //HERE: (datagirdTest.itemEditorInstance as TextInput).text = (event.itemRenderer.data as XML).Name;// Undo: revert the original data by the selected item. Alert.show(errorMesg); return; } }
Unfortunately, because of ‘Alert’, itemEditComplete Event will dispatch many times, so there’ll be many alert in the UI.
So, I want to display the error message in the item editor , like this:
and here is the handler:
/** * validate user input. */ protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void { if(event.dataField != "Name") { // check the field; return; } var editor:TextInput = datagirdTest.itemEditorInstance as TextInput; var input:String = editor.text; // get the user input data. if(input == null || input == "") { // event.preventDefault(); // prevent default behavior event.stopImmediatePropagation(); editor.errorString = "User name cannot be empty!"; trace("Error"); // datagirdTest.destroyItemEditor(); }else { editor.errorString = null; } }
Now I can display the error mesg as the above screen capture, but if the user want to reload the data or sort the column, the editor will stay there until I call datagrid.destroyItemEditor(), but:
“This method closes an item editor currently open on an item renderer. You typically only call this method from within the event listener for the itemEditEnd
event, after you have already called the preventDefault()
method to prevent the default event listener from executing.” http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/DataGrid.html#destroyItemEditor()
so, How can I display the error message in this way?
We need replace all method.
use RegEx or split&jion;
We can use the following two methods:
private function testFlexStringReplaceAll():void { var strSource:String = "Li_guo_Liang.com"; trace(strSource + " - " + replaceAllBySplit(strSource, "_", "")); trace(strSource + " - " + replaceAllByRegex(strSource, "_", "")); } /** * Repalce all by split and join; */ public static function replaceAllBySplit(strSource:String, strReplaceFrom:String, strRepalceTo:String):String { return strSource == null ? null : strSource.split(strReplaceFrom).join(strRepalceTo); } /** * Replace all by RegEx; */ public static function replaceAllByRegex(strSource:String, strReplaceFrom:String, strRepalceTo:String):String { return strSource == null ? null : strSource.replace(new RegExp(strReplaceFrom, 'g'), strRepalceTo); }
TraceLog:
Li_guo_Liang.com – LiguoLiang.com
Li_guo_Liang.com – LiguoLiang.com
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.