1 package net.systemeD.controls {
2 import mx.controls.Label;
3 import mx.controls.listClasses.*;
4 import flash.display.DisplayObject;
5 import mx.controls.Image;
6 import mx.controls.Text;
9 * The DataGridWarningField is a custom Label component that highlights values containing semicolons.
10 * It does so using colour and a warning icon. Simply use in place of a standard Label component, or use
11 * as a custom itemRenderer for a DataGridColumn.
13 * @see PromptingTextInputWarning
16 public class DataGridWarningField extends Text {
18 private var _image:Image;
19 [Embed(source="../../../embedded/warning.png")] private var warningIcon:Class;
20 private var _whiteList:Array = ["source","collection_times","service_times","smoking_hours","opening_hours"];
22 function DataGridWarningField():void {
24 setStyle('paddingLeft',2);
27 override protected function createChildren():void {
28 super.createChildren();
30 _image.source = warningIcon;
33 addChild(DisplayObject(_image));
36 override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
37 super.updateDisplayList(unscaledWidth, unscaledHeight);
39 if (data.value && (_whiteList.indexOf(data.key)==-1) && (data.value.indexOf(';')>-1)) {
40 setStyle('color',0xFF0000);
42 _image.x = width -_image.width -5;
43 _image.y = height-_image.height-3;
44 _image.toolTip = "The tag contains more than one value - please check";
45 textField.width = width-_image.width-5;