Merge branch 'master' into history
[potlatch2.git] / net / systemeD / controls / DataGridWarningField.as
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  
7         public class DataGridWarningField extends Label {
8
9                 private var _image:Image;
10                 [Embed(source="../../../embedded/warning.png")] private var warningIcon:Class;
11
12                 function DataGridWarningField():void {
13                         super();
14                         setStyle('paddingLeft',2);
15                 }
16
17                 override protected function createChildren():void {
18                         super.createChildren();
19                         _image = new Image();
20                         _image.source = warningIcon;
21                         _image.width = 16;
22                         _image.height = 16;
23                         addChild(DisplayObject(_image));
24                 }
25
26                 override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
27                         super.updateDisplayList(unscaledWidth, unscaledHeight);
28  
29                         if (data.value && data.value.indexOf(';')>-1) {
30                                 setStyle('color',0xFF0000);
31                                 _image.visible=true;
32                                 _image.x = width -_image.width -5;
33                                 _image.y = height-_image.height-3;
34                                 _image.toolTip = "The tag contains more than one value - please check";
35                                 textField.width = width-_image.width-5;
36                         } else {
37                                 setStyle('color',0);
38                                 _image.visible=false;
39                         }
40                 }
41         }
42 }