[moodle] / contrib / plugins / grade / report / visual / flare_visualization / Button.as Repository:

Diff of /contrib/plugins/grade/report/visual/flare_visualization/Button.as

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Tue Jul 15 03:27:17 2008 WST revision 1.3, Thu Jul 24 15:31:44 2008 WST

By dservos:

CONTRIB-497 *Added new visualization, Grade Distribution *Fixed some minor bugs *Made abstract visualization class for creating visualizations by making classes witch extend it. *Made visual_settings.php witch takes a visualization class and truns it in to XML witch flex can read in. *Made flex visualization application read in XML formated settings as well as tab formated data from moodle and combind them to make a custom visualization. *Made flex visualization application read and use langue strings from moodle. *Added printer firendly tab TODO: *Add more visualizations *Refactor some of the flex/actionscript code *More douctenation *More UI functions for the flex application

# Line 30  Line 30 
30                  private var upColor:uint = 0x9999FF;                  private var upColor:uint = 0x9999FF;
31          private var overColor:uint = 0xBABAFF;          private var overColor:uint = 0xBABAFF;
32          private var downColor:uint = 0xBBBBFF;          private var downColor:uint = 0xBBBBFF;
33          private var fmt:TextFormat = new TextFormat("mono",12,0,null,null,null,null,null,"center");          private var fmt:TextFormat = new TextFormat("monospace", 12, 0, null, null, null, null, null, "center");
34          private var buttonText:String;          private var buttonText:String;
35            private var alphaValue:Number = 0.6;
36    
37          public var props:Object = new Object();          public var props:Object = new Object();
38    
39                  public function Button(text:String) {                  public function Button(text:String, settings:XMLList = null) {
40                            if(settings != null) {
41                                    upColor = parseInt(settings.bgcolor, 16);
42                                    overColor = upColor + 0x212100;
43                                    downColor = upColor + 0x222200;
44                                    alphaValue = settings.alpha;
45    
46                                    fmt = new TextFormat(settings.text.font, settings.text.size, 0, null, null, null, null, null, "center");
47    
48                                    downState = new ButtonDisplayState(text, fmt, downColor, alphaValue, settings.line);
49                            overState = new ButtonDisplayState(text, fmt, overColor, alphaValue, settings.line);
50                            upState = new ButtonDisplayState(text, fmt, upColor, alphaValue, settings.line);
51                            } else {
52                                    downState = new ButtonDisplayState(text, fmt, downColor, alphaValue);
53                            overState = new ButtonDisplayState(text, fmt, overColor, alphaValue);
54                            upState = new ButtonDisplayState(text, fmt, upColor, alphaValue);
55                            }
56    
57                          buttonText = text;                          buttonText = text;
                         downState = new ButtonDisplayState(text, fmt, downColor);  
                 overState = new ButtonDisplayState(text, fmt, overColor);  
                 upState = new ButtonDisplayState(text, fmt, upColor);  
58                  hitTestState = upState;                  hitTestState = upState;
59                  useHandCursor = true;                  useHandCursor = true;
60                  }                  }
# Line 71  Line 86 
86          private var buttonText:String;          private var buttonText:String;
87          private var fmt:TextFormat;          private var fmt:TextFormat;
88          private var ts:TextSprite;          private var ts:TextSprite;
89            private var alphaValue:Number
90            private var lineSettings:XMLList;
91    
92          public function ButtonDisplayState(text:String, fmt:TextFormat, bgColor:uint) {          public function ButtonDisplayState(text:String, fmt:TextFormat, bgColor:uint = 0x9999FF, alphaValue:Number = 0.6, lineSettings:XMLList = null) {
93                  this.bgColor = bgColor;                  this.bgColor = bgColor;
94                  buttonText = text;                  buttonText = text;
95                  this.fmt = fmt;                  this.fmt = fmt;
96                  this.ts = new TextSprite(text, fmt);                  this.ts = new TextSprite(text, fmt);
97                    this.alphaValue = alphaValue;
98                    this.lineSettings = lineSettings;
99    
100                  var tf:TextField = ts.textField;                  var tf:TextField = ts.textField;
101    
# Line 89  Line 108 
108      }      }
109    
110      private function draw():void {      private function draw():void {
111                  graphics.beginFill(bgColor, 0.6);                  graphics.beginFill(bgColor, alphaValue);
112    
113            if(lineSettings == null) {
114          graphics.lineStyle(1, 0x4444FF, 0.3, true);          graphics.lineStyle(1, 0x4444FF, 0.3, true);
115            } else {
116                    graphics.lineStyle(lineSettings.size, parseInt(lineSettings.color, 16), lineSettings.alpha, true);
117            }
118    
119          graphics.drawRoundRect(0, 0, w, h, 10, 10);          graphics.drawRoundRect(0, 0, w, h, 10, 10);
120          graphics.endFill();          graphics.endFill();
121          }          }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7