Created
May 15, 2012 15:03
-
-
Save liekkas/2702460 to your computer and use it in GitHub Desktop.
FLEX:Matrix Component Body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import mx.containers.VBox; | |
/*************************************************************\ | |
* 矩阵组件,原来的那个不方面实时操作, | |
* * item能按告警级别排序 | |
* * 新上来一条告警更实时更新,并重新排序 | |
* * 实时添加、删除item | |
* | |
* @author liekkas.zeng | |
* @since 2012-5-10 20:48:48 | |
\*************************************************************/ | |
public class Matrix2 extends VBox | |
{ | |
protected var rowMap:Object = new Object(); | |
/** | |
* 允许空行存在 | |
* */ | |
public var allowEmptyRow:Boolean; | |
protected var _dataXML:XML; | |
public function set dataXML(value:XML):void | |
{ | |
_dataXML = value; | |
parse(value); | |
} | |
protected function parse(xml:XML):void | |
{ | |
for each(var x:XML in xml.children()) | |
{ | |
var row:MatrixRow = new MatrixRow(); | |
row.dataXML = x; | |
row.allowEmptyRow = allowEmptyRow; | |
var key:String = String(x.@id); | |
rowMap[key] = row; | |
this.addChild(row); | |
} | |
} | |
public function Matrix2() | |
{ | |
super(); | |
this.percentHeight = 100; | |
this.percentWidth = 100; | |
this.setStyle("horizontalGap",1); | |
this.setStyle("verticalGap",1); | |
} | |
public function update(item:Object):void | |
{ | |
var id:String = item['pid']; | |
var mr:MatrixRow = rowMap[id]; | |
mr.update(item); | |
} | |
public function more(flag:Boolean):void | |
{ | |
for(var key:String in rowMap) | |
{ | |
MatrixRow(rowMap[key]).more(flag); | |
} | |
} | |
public function addItem(item:Object):void | |
{ | |
var id:String = item['pid']; | |
var mr:MatrixRow = rowMap[id]; | |
mr.addItem(item); | |
} | |
public function delItem(item:Object):void | |
{ | |
var id:String = item['pid']; | |
var mr:MatrixRow = rowMap[id]; | |
mr.delItem(item); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment