asproject 0.1.89 → 0.1.92

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module AsProject
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 90
5
+ TINY = 93
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -14,6 +14,10 @@ module AsProject
14
14
  @user = create_user
15
15
  end
16
16
 
17
+ def mxmlc
18
+ return @user.mxmlc
19
+ end
20
+
17
21
  def flash_player_home
18
22
  return @user.flash_player_home
19
23
  end
@@ -242,6 +246,10 @@ module AsProject
242
246
  @flash_log_file_name = 'flashlog.txt'
243
247
  end
244
248
 
249
+ def mxmlc
250
+ return 'mxmlc'
251
+ end
252
+
245
253
  def remote_file_task(name, task)
246
254
  return UnixRemoteFileTask.new(name, self) do |t|
247
255
  if(task.unix_url.nil?)
@@ -427,6 +435,10 @@ EOF
427
435
  end
428
436
  end
429
437
 
438
+ def mxmlc
439
+ return 'mxmlc.exe'
440
+ end
441
+
430
442
  def home
431
443
  usr = super
432
444
  if(usr.index "My Documents")
@@ -478,6 +490,10 @@ EOF
478
490
  return File.join("#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}", 'Application Data', 'Macromedia', 'Flash Player', 'Logs', 'flashlog.txt')
479
491
  end
480
492
 
493
+ def mxmlc
494
+ return 'mxmlc'
495
+ end
496
+
481
497
  def remote_file_task(name, task)
482
498
  return CygwinRemoteFileTask.new(name, self) do |t|
483
499
  if(task.win_url.nil?)
@@ -33,7 +33,8 @@ module AsProject
33
33
  @theme = []
34
34
  @runtime_shared_libraries = []
35
35
  @incremental = false
36
- @target = 'mxmlc'
36
+ path_finder = PathFinder.new
37
+ @target = path_finder.mxmlc
37
38
  @name = name
38
39
  yield self if block_given?
39
40
  define
@@ -66,7 +67,11 @@ module AsProject
66
67
  end
67
68
 
68
69
  def execute(cmd, args)
70
+ begin
69
71
  sh(%{#{cmd} #{args}})
72
+ rescue
73
+ puts 'There was an error executing mxmlc, please make sure mxmlc is in your class path and can be executed from the same environment this rake task was run from'
74
+ end
70
75
  end
71
76
 
72
77
  def sp
@@ -6,7 +6,7 @@ module AsProject
6
6
  attr_accessor :replace_all, :ignore_all
7
7
  @@ASPROJECT_FILE_NAME = 'AsProject'
8
8
  @@RENDER_IGNORE_FILES = ['asclass_config.rb', 'SWFMillTemplate.erb']
9
- @@BINARY_EXTENSIONS = ['.jpg', '.png', '.gif', '.doc', '.xls', '.exe']
9
+ @@BINARY_EXTENSIONS = ['.jpg', '.png', '.gif', '.doc', '.xls', '.exe', '.swf', 'fla', '.psd']
10
10
 
11
11
  def initialize
12
12
  @replace_all = false
@@ -44,10 +44,14 @@ module AsProject
44
44
  return created_files
45
45
  end
46
46
 
47
+ def b(path)
48
+ (is_binary?(path)) ? 'b' : ''
49
+ end
50
+
47
51
  def copy_file(from, to, render=false)
48
52
  if(write_file?(to))
49
53
  content = nil
50
- File.open(from, 'r') do |f|
54
+ File.open(from, 'r' + b(from)) do |f|
51
55
  content = f.read
52
56
  end
53
57
  if(render && should_render?(from))
@@ -59,7 +63,7 @@ module AsProject
59
63
  end
60
64
  end
61
65
  FileUtils.makedirs(File.dirname(to))
62
- File.open(to, 'w') do |f|
66
+ File.open(to, 'w' + b(to)) do |f|
63
67
  f.write(content)
64
68
  end
65
69
  return to
@@ -177,5 +181,38 @@ EOF
177
181
  end
178
182
  return false
179
183
  end
184
+
185
+ =begin
186
+ Found this code for binary inspection here:
187
+ http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/44940
188
+ it's not 100%, but better than what I'm doing with extensions.
189
+ This should be tested and inserted above
190
+ if it works.
191
+
192
+ NON_ASCII_PRINTABLE = /[^\x20-\x7e\s]/
193
+
194
+ def nonbinary?(io, forbidden, size = 1024)
195
+ while buf = io.read(size)
196
+ return false if forbidden =~ buf
197
+ end
198
+ true
199
+ end
200
+
201
+ # usage: ruby this_script.rb filename ...
202
+ ARGV.each do |fn|
203
+ begin
204
+ open(fn) do |f|
205
+ if nonbinary?(f, NON_ASCII_PRINTABLE)
206
+ puts "#{fn}: ascii printable"
207
+ else
208
+ puts "#{fn}: binary"
209
+ end
210
+ end
211
+ rescue
212
+ puts "#$0: #$!"
213
+ end
214
+ end
215
+ =end
216
+
180
217
  end
181
218
  end
@@ -60,6 +60,8 @@ end
60
60
  ############################################
61
61
  # Compile your Application using HAMTASC
62
62
 
63
+ task :compile_tests => [:compile_skin]
64
+
63
65
  AsProject::MTASC.new(:compile_tests) do |t|
64
66
  t.input = '<%= project_name %>Runner'
65
67
  t.version = 8
@@ -123,6 +123,9 @@ package asunit.framework {
123
123
  try {
124
124
  var manager:Class = getDefinitionByName("mx.managers.LayoutManager") as Class;
125
125
  layoutManager = manager["getInstance"]();
126
+ if(!layoutManager.hasOwnProperty("resetAll")) {
127
+ throw new Error("TestCase :: mx.managers.LayoutManager missing resetAll method");
128
+ }
126
129
  }
127
130
  catch(e:Error) {
128
131
  layoutManager = new Object();
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: asproject
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.89
7
- date: 2007-03-25 00:00:00 -07:00
6
+ version: 0.1.92
7
+ date: 2007-04-11 00:00:00 -07:00
8
8
  summary: AsProject is a tool set that simplifies the process of beginning and growing a new ActionScript project.
9
9
  require_paths:
10
10
  - lib
@@ -224,7 +224,6 @@ files:
224
224
  - templates/asproject/asunit3/project/lib/asunit
225
225
  - templates/asproject/asunit3/project/lib/asunit/asunit
226
226
  - templates/asproject/asunit3/project/lib/asunit/AsUnitTestRunner.as
227
- - templates/asproject/asunit3/project/lib/asunit/mx
228
227
  - templates/asproject/asunit3/project/lib/asunit/asunit/errors
229
228
  - templates/asproject/asunit3/project/lib/asunit/asunit/framework
230
229
  - templates/asproject/asunit3/project/lib/asunit/asunit/runner
@@ -255,8 +254,6 @@ files:
255
254
  - templates/asproject/asunit3/project/lib/asunit/asunit/util/ArrayIterator.as
256
255
  - templates/asproject/asunit3/project/lib/asunit/asunit/util/Iterator.as
257
256
  - templates/asproject/asunit3/project/lib/asunit/asunit/util/Properties.as
258
- - templates/asproject/asunit3/project/lib/asunit/mx/managers
259
- - templates/asproject/asunit3/project/lib/asunit/mx/managers/LayoutManager.as
260
257
  - templates/asproject/config/project
261
258
  - templates/asproject/config/project/config
262
259
  - templates/asproject/config/project/config/asclass_config.rb
@@ -276,13 +273,8 @@ files:
276
273
  - templates/asproject/as3/project/bin/.crap_file
277
274
  - templates/asproject/as3/project/lib/.crap_file
278
275
  - templates/asproject/as3/project/test/.crap_file
279
- - templates/asproject/fb2as/project/.actionScriptProperties
280
276
  - templates/asproject/fb2as/project/.crap_file
281
- - templates/asproject/fb2as/project/.project
282
- - templates/asproject/fb2as/project/.settings
283
277
  - templates/asproject/fdt/project/.as2_classpath
284
- - templates/asproject/fdt/project/.project
285
- - templates/asproject/fdt/project/.settings
286
278
  - templates/asproject/mxml/.crap_file
287
279
  test_files: []
288
280
 
@@ -1,945 +0,0 @@
1
- ////////////////////////////////////////////////////////////////////////////////
2
- //
3
- // Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
4
- // All Rights Reserved. The following is Source Code and is subject to all
5
- // restrictions on such code as contained in the End User License Agreement
6
- // accompanying this product.
7
- //
8
- ////////////////////////////////////////////////////////////////////////////////
9
-
10
- package mx.managers
11
- {
12
-
13
- import flash.display.Stage;
14
- import flash.events.Event;
15
- import flash.events.EventDispatcher;
16
- import mx.core.Application;
17
- import mx.core.UIComponent;
18
- import mx.core.mx_internal;
19
- import mx.events.FlexEvent;
20
- import mx.managers.layoutClasses.PriorityQueue;
21
-
22
- use namespace mx_internal;
23
-
24
- /**
25
- * The LayoutManager is the engine behind
26
- * Flex's measurement and layout strategy.
27
- * Layout is performed in three phases; commit, measurement, and layout.
28
- *
29
- * <p>Each phase is distinct from the others and all UIComponents of
30
- * one phase are processed prior to moving on to the next phase.
31
- * During the processing of UIComponents in a phase, requests for
32
- * UIComponents to get re-processed by some phase may occur.
33
- * These requests are queued and are only processed
34
- * during the next run of the phase.</p>
35
- *
36
- * <p>The <b>commit</b> phase begins with a call to
37
- * <code>validateProperties()</code>, which walks through a list
38
- * (sorted by nesting level) of objects calling each object's
39
- * <a href="../core/UIComponent.html#validateProperties()">
40
- * <code>validateProperties()</code></a>method.</p>
41
- *
42
- * <p>The objects in the list are processed by nesting order,
43
- * with the <b>most</b> deeply nested object accessed first.
44
- * This can also be referred to as bottom-up inside-out ordering.</p>
45
- *
46
- * <p>This phase allows components whose contents depend on property
47
- * settings to configure themselves prior to the measurement
48
- * and the layout phases.
49
- * For the sake of performance, sometimes a component's property setter
50
- * method does not do all the work to update to the new property value.
51
- * Instead, the property setter calls the <code>invalidateProperties()</code>
52
- * method, deferring the work until this phase runs.
53
- * This prevents unnecessary work if the property is set multiple times.</p>
54
- *
55
- * <p>The <b>measurement</b> phase begins with a call to
56
- * <code>validateSize()</code>, which walks through a list
57
- * (sorted by nesting level) of objects calling each object's
58
- * <a href="../core/UIComponent.html#validateSize()"><code>validateSize()</code></a>
59
- * method to determine if the object has changed in size.</p>
60
- *
61
- * <p>If an object's <a href="../core/UIComponent.html#invalidateSize()">
62
- * <code>invalidateSize()</code></a> method was previously called,
63
- * then the <code>validateSize()</code> method is called.
64
- * If the size or position of the object was changed as a result of the
65
- * <code>validateSize()</code> call, then the object's
66
- * <a href="../core/UIComponent.html#invalidateDisplayList()">
67
- * <code>invalidateDisplayList()</code></a> method is called, thus adding
68
- * the object to the processing queue for the next run of the layout phase.
69
- * Additionally, the object's parent is marked for both measurement
70
- * and layout phases, by calling
71
- * <a href="../core/UIComponent.html#invalidateSize()">
72
- * <code>invalidateSize()</code></a> and
73
- * <a href="../core/UIComponent.html#invalidateDisplayList()">
74
- * <code>invalidateDisplayList()</code></a> respectively.</p>
75
- *
76
- * <p>The objects in the list are processed by nesting order,
77
- * with the <b>most</b> deeply nested object accessed first.
78
- * This can also be referred to as bottom-up inside-out ordering.</p>
79
- *
80
- * <p>The <b>layout</b> phase begins with a call to the
81
- * <code>validateDisplayList()</code> method, which walks through a list
82
- * (reverse sorted by nesting level) of objects calling each object's
83
- * <a href="../core/UIComponent.html#validateDisplayList()">
84
- * <code>validateDisplayList()</code></a> method to request the object to size
85
- * and position all components contained within it (i.e. its children).</p>
86
- *
87
- * <p>If an object's <a href="../core/UIComponent.html#invalidateDisplayList()">
88
- * <code>invalidateDisplayList()</code></a> method was previously called,
89
- * then <code>validateDisplayList()</code> method for the object is called.</p>
90
- *
91
- * <p>The objects in the list are processed in reversed nesting order,
92
- * with the <b>least</b> deeply nested object accessed first.
93
- * This can also be referred to as top-down or outside-in ordering.</p>
94
- *
95
- * <p>In general, components do not override the <code>validateProperties()</code>,
96
- * <code>validateSize()</code>, or <code>validateDisplayList()</code> methods.
97
- * In the case of UIComponents, most components override the
98
- * <code>commitProperties()</code>, <code>measure()</code>, or
99
- * <code>updateDisplayList()</code> methods, which are called
100
- * by the <code>validateProperties()</code>,
101
- * <code>validateSize()</code>, or
102
- * <code>validateDisplayList()</code> methods, respectively.</p>
103
- *
104
- * <p>At application startup, a single instance of the LayoutManager is created
105
- * and stored in the <code>UIComponent.layoutManager</code> property.
106
- * All components are expected to use that instance.
107
- * If you do not have access to the UIComponent object,
108
- * you can also access the LayoutManager using the static
109
- * <code>LayoutManager.getInstance()</code> method.</p>
110
- */
111
- public class LayoutManager extends EventDispatcher
112
- {
113
-
114
- //--------------------------------------------------------------------------
115
- //
116
- // Class variables
117
- //
118
- //--------------------------------------------------------------------------
119
-
120
- /**
121
- * @private
122
- * The sole instance of this singleton class.
123
- */
124
- private static var instance:LayoutManager;
125
-
126
- //--------------------------------------------------------------------------
127
- //
128
- // Class methods
129
- //
130
- //--------------------------------------------------------------------------
131
-
132
- /**
133
- * Returns the sole instance of this singleton class,
134
- * creating it if it does not already exist.
135
- */
136
- public static function getInstance():LayoutManager
137
- {
138
- if (!instance)
139
- instance = new LayoutManager();
140
-
141
- return instance;
142
- }
143
-
144
- //--------------------------------------------------------------------------
145
- //
146
- // Constructor
147
- //
148
- //--------------------------------------------------------------------------
149
-
150
- /**
151
- * Constructor.
152
- */
153
- public function LayoutManager()
154
- {
155
- super();
156
- }
157
-
158
- //--------------------------------------------------------------------------
159
- //
160
- // Variables
161
- //
162
- //--------------------------------------------------------------------------
163
-
164
- /**
165
- * @private
166
- * A queue of objects that need to dispatch updateComplete events
167
- * when invalidation processing is complete
168
- */
169
- private var updateCompleteQueue:PriorityQueue = new PriorityQueue();
170
-
171
- /**
172
- * @private
173
- * A queue of objects to be processed during the first phase
174
- * of invalidation processing, when an ILayoutManagerClient has
175
- * its validateProperties() method called (which in a UIComponent
176
- * calls commitProperties()).
177
- * Objects are added to this queue by invalidateProperties()
178
- * and removed by validateProperties().
179
- */
180
- private var invalidatePropertiesQueue:PriorityQueue = new PriorityQueue();
181
-
182
- /**
183
- * @private
184
- * A flag indicating whether there are objects
185
- * in the invalidatePropertiesQueue.
186
- * It is set true by invalidateProperties()
187
- * and set false by validateProperties().
188
- */
189
- private var invalidatePropertiesFlag:Boolean = false;
190
-
191
- // flag when in validateClient to check the properties queue again
192
- private var invalidateClientPropertiesFlag:Boolean = false;
193
-
194
- /**
195
- * @private
196
- * A queue of objects to be processed during the second phase
197
- * of invalidation processing, when an ILayoutManagerClient has
198
- * its validateSize() method called (which in a UIComponent
199
- * calls measure()).
200
- * Objects are added to this queue by invalidateSize().
201
- * and removed by validateSize().
202
- */
203
- private var invalidateSizeQueue:PriorityQueue = new PriorityQueue();
204
-
205
- /**
206
- * @private
207
- * A flag indicating whether there are objects
208
- * in the invalidateSizeQueue.
209
- * It is set true by invalidateSize()
210
- * and set false by validateSize().
211
- */
212
- private var invalidateSizeFlag:Boolean = false;
213
-
214
- // flag when in validateClient to check the size queue again
215
- private var invalidateClientSizeFlag:Boolean = false;
216
-
217
- /**
218
- * @private
219
- * A queue of objects to be processed during the third phase
220
- * of invalidation processing, when an ILayoutManagerClient has
221
- * its validateDisplayList() method called (which in a
222
- * UIComponent calls updateDisplayList()).
223
- * Objects are added to this queue by invalidateDisplayList()
224
- * and removed by validateDisplayList().
225
- */
226
- private var invalidateDisplayListQueue:PriorityQueue = new PriorityQueue();
227
-
228
- /**
229
- * @private
230
- * A flag indicating whether there are objects
231
- * in the invalidateDisplayListQueue.
232
- * It is set true by invalidateDisplayList()
233
- * and set false by validateDisplayList().
234
- */
235
- private var invalidateDisplayListFlag:Boolean = false;
236
-
237
- /**
238
- * @private
239
- */
240
- private var callLaterObject:UIComponent;
241
-
242
- /**
243
- * @private
244
- */
245
- private var callLaterPending:Boolean = false;
246
-
247
- /**
248
- * @private
249
- */
250
- private var originalFrameRate:Number;
251
-
252
- /**
253
- * @private
254
- * used in validateClient to quickly estimate whether we have to
255
- * search the queues again
256
- */
257
- private var targetLevel:int = int.MAX_VALUE;
258
-
259
- //--------------------------------------------------------------------------
260
- //
261
- // Properties
262
- //
263
- //--------------------------------------------------------------------------
264
-
265
- //----------------------------------
266
- // usePhasedInstantiation
267
- //----------------------------------
268
-
269
- /**
270
- * @private
271
- * Storage for the usePhasedInstantiation property.
272
- */
273
- private var _usePhasedInstantiation:Boolean = false;
274
-
275
- /**
276
- * A flag that indicates whether the LayoutManager allows screen updates
277
- * between phases.
278
- * If <code>true</code>, measurement and layout are done in phases, one phase
279
- * per screen update.
280
- * All components have their <code>validateProperties()</code>
281
- * and <code>commitProperties()</code> methods
282
- * called until all their properties are validated.
283
- * The screen will then be updated.
284
- *
285
- * <p>Then all components will have their <code>validateSize()</code>
286
- * and <code>measure()</code>
287
- * methods called until all components have been measured, then the screen
288
- * will be updated again. </p>
289
- *
290
- * <p>Finally, all components will have their
291
- * <code>validateDisplayList()</code> and
292
- * <code>updateDisplayList()</code> methods called until all components
293
- * have been validated, and the screen will be updated again.
294
- * If in the validation of one phase, an earlier phase gets invalidated,
295
- * the LayoutManager starts over.
296
- * This is more efficient when large numbers of components
297
- * are being created an initialized. The framework is responsible for setting
298
- * this property.</p>
299
- *
300
- * <p>If <code>false</code>, all three phases are completed before the screen is updated.</p>
301
- */
302
- public function get usePhasedInstantiation():Boolean
303
- {
304
- return _usePhasedInstantiation;
305
- }
306
-
307
- /**
308
- * @private
309
- */
310
- public function set usePhasedInstantiation(value:Boolean):void
311
- {
312
- if (_usePhasedInstantiation != value)
313
- {
314
- _usePhasedInstantiation = value;
315
-
316
- // While we're doing phased instantiation, temporarily increase
317
- // the frame rate. That will cause the enterFrame and render
318
- // events to fire more promptly, which improves performance.
319
- var stage:Stage = SystemManager.topLevelSystemManagers[0].stage;
320
- if (value)
321
- {
322
- originalFrameRate = stage.frameRate;
323
- stage.frameRate = 1000;
324
- }
325
- else
326
- {
327
- stage.frameRate = originalFrameRate;
328
- }
329
- }
330
- }
331
-
332
- //--------------------------------------------------------------------------
333
- //
334
- // Methods: Invalidation
335
- //
336
- //--------------------------------------------------------------------------
337
-
338
- /**
339
- * Adds an object to the list of components that want their
340
- * <code>validateProperties()</code> method called.
341
- * A component should call this method when a property changes.
342
- * Typically, a property setter method
343
- * stores a the new value in a temporary variable and calls
344
- * the <code>invalidateProperties()</code> method
345
- * so that its <code>validateProperties()</code>
346
- * and <code>commitProperties()</code> methods are called
347
- * later, when the new value will actually be applied to the component and/or
348
- * its children. The advantage of this strategy is that often, more than one
349
- * property is changed at a time and the properties may interact with each
350
- * other, or repeat some code as they are applied, or need to be applied in
351
- * a specific order. This strategy allows the most efficient method of
352
- * applying new property values.
353
- *
354
- * @param obj The object whose property changed.
355
- */
356
- public function invalidateProperties(obj:ILayoutManagerClient ):void
357
- {
358
- if (!invalidatePropertiesFlag && Application.application.systemManager)
359
- {
360
- invalidatePropertiesFlag = true;
361
-
362
- if (!callLaterPending)
363
- {
364
- if (!callLaterObject)
365
- {
366
- callLaterObject = new UIComponent();
367
- callLaterObject.systemManager =
368
- Application.application.systemManager;
369
- callLaterObject.callLater(waitAFrame);
370
- }
371
- else
372
- {
373
- callLaterObject.callLater(doPhasedInstantiation);
374
- }
375
-
376
- callLaterPending = true;
377
- }
378
- }
379
-
380
- // trace("LayoutManager adding " + Object(obj) + " to invalidatePropertiesQueue");
381
-
382
- if (targetLevel <= obj.nestLevel)
383
- invalidateClientPropertiesFlag = true;
384
-
385
- invalidatePropertiesQueue.addObject(obj, obj.nestLevel);
386
-
387
- // trace("LayoutManager added " + Object(obj) + " to invalidatePropertiesQueue");
388
- }
389
-
390
- /**
391
- * Adds an object to the list of components that want their
392
- * <code>validateSize()</code> method called.
393
- * Called when an object's size changes.
394
- *
395
- * <p>An object's size can change for two reasons:</p>
396
- *
397
- * <ol>
398
- * <li>The content of the object changes. For example, the size of a
399
- * button changes when its <code>label</code> is changed.</li>
400
- * <li>A script explicitly changes one of the following properties:
401
- * <code>minWidth</code>, <code>minHeight</code>,
402
- * <code>explicitWidth</code>, <code>explicitHeight</code>,
403
- * <code>maxWidth</code>, or <code>maxHeight</code>.</li>
404
- * </ol>
405
- *
406
- * <p>When the first condition occurs, it's necessary to recalculate
407
- * the measurements for the object.
408
- * When the second occurs, it's not necessary to recalculate the
409
- * measurements because the new size of the object is known.
410
- * However, it's necessary to remeasure and relayout the object's
411
- * parent.</p>
412
- *
413
- * @param obj The object whose size changed.
414
- */
415
- public function invalidateSize(obj:ILayoutManagerClient ):void
416
- {
417
- if (!invalidateSizeFlag && Application.application.systemManager)
418
- {
419
- invalidateSizeFlag = true;
420
-
421
- if (!callLaterPending)
422
- {
423
- if (!callLaterObject)
424
- {
425
- callLaterObject = new UIComponent();
426
- callLaterObject.systemManager =
427
- Application.application.systemManager;
428
- callLaterObject.callLater(waitAFrame);
429
- }
430
- else
431
- {
432
- callLaterObject.callLater(doPhasedInstantiation);
433
- }
434
-
435
- callLaterPending = true;
436
- }
437
- }
438
-
439
- // trace("LayoutManager adding " + Object(obj) + " to invalidateSizeQueue");
440
-
441
- if (targetLevel <= obj.nestLevel)
442
- invalidateClientSizeFlag = true;
443
-
444
- invalidateSizeQueue.addObject(obj, obj.nestLevel);
445
-
446
- // trace("LayoutManager added " + Object(obj) + " to invalidateSizeQueue");
447
- }
448
-
449
- /**
450
- * Called when a component changes in some way that its layout and/or visuals
451
- * need to be changed.
452
- * In that case, it is necessary to run the component's layout algorithm,
453
- * even if the component's size hasn't changed. For example, when a new child component
454
- * is added, or a style property changes or the component has been given
455
- * a new size by its parent.
456
- *
457
- * @param obj The object that changed.
458
- */
459
- public function invalidateDisplayList(obj:ILayoutManagerClient ):void
460
- {
461
- if (!invalidateDisplayListFlag && Application.application.systemManager)
462
- {
463
- invalidateDisplayListFlag = true;
464
-
465
- if (!callLaterPending)
466
- {
467
- if (!callLaterObject)
468
- {
469
- callLaterObject = new UIComponent();
470
- callLaterObject.systemManager =
471
- Application.application.systemManager;
472
- callLaterObject.callLater(waitAFrame);
473
- }
474
- else
475
- {
476
- callLaterObject.callLater(doPhasedInstantiation);
477
- }
478
-
479
- callLaterPending = true;
480
- }
481
- }
482
-
483
- // trace("LayoutManager adding " + Object(obj) + " to invalidateDisplayListQueue");
484
-
485
- invalidateDisplayListQueue.addObject(obj, obj.nestLevel);
486
-
487
- // trace("LayoutManager added " + Object(obj) + " to invalidateDisplayListQueue");
488
- }
489
-
490
- //--------------------------------------------------------------------------
491
- //
492
- // Methods: Commitment, measurement, layout, and drawing
493
- //
494
- //--------------------------------------------------------------------------
495
-
496
- /**
497
- * Validates all components whose properties have changed and have called
498
- * the <code>invalidateProperties()</code> method.
499
- * It calls the <code>validateProperties()</code> method on those components
500
- * and will call <code>validateProperties()</code> on any other components that are
501
- * invalidated while validating other components.
502
- */
503
- private function validateProperties():void
504
- {
505
- // trace("--- LayoutManager: validateProperties --->");
506
-
507
- // Keep traversing the invalidatePropertiesQueue until we've reached the end.
508
- // More elements may get added to the queue while we're in this loop, or a
509
- // a recursive call to this function may remove elements from the queue while
510
- // we're in this loop.
511
- var obj:ILayoutManagerClient = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallest());
512
- while (obj)
513
- {
514
- // trace("LayoutManager calling validateProperties() on " + Object(obj) + " " + DisplayObject(obj).width + " " + DisplayObject(obj).height);
515
-
516
- obj.validateProperties();
517
- if (!obj.updateCompletePendingFlag)
518
- updateCompleteQueue.addObject(obj, obj.nestLevel);
519
-
520
- // Once we start, don't stop.
521
- obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallest());
522
- }
523
-
524
- if (invalidatePropertiesQueue.isEmpty())
525
- {
526
- // trace("Properties Queue is empty");
527
-
528
- invalidatePropertiesFlag = false;
529
- }
530
-
531
- // trace("<--- LayoutManager: validateProperties ---");
532
- }
533
-
534
- /**
535
- * Validates all components whose properties have changed and have called
536
- * the <code>invalidateSize()</code> method.
537
- * It calls the <code>validateSize()</code> method on those components
538
- * and will call the <code>validateSize()</code> method
539
- * on any other components that are
540
- * invalidated while validating other components.
541
- * The </code>validateSize()</code> method starts with
542
- * the most deeply nested child in the tree of display objects
543
- */
544
- private function validateSize():void
545
- {
546
- // trace("--- LayoutManager: validateSize --->");
547
-
548
- var obj:ILayoutManagerClient = ILayoutManagerClient(invalidateSizeQueue.removeLargest());
549
- while (obj)
550
- {
551
- // trace("LayoutManager calling validateSize() on " + Object(obj));
552
-
553
- obj.validateSize();
554
- if (!obj.updateCompletePendingFlag)
555
- updateCompleteQueue.addObject(obj, obj.nestLevel);
556
-
557
- // trace("LayoutManager validateSize: " + Object(obj) + " " + IFlexDisplayObject(obj).measuredWidth + " " + IFlexDisplayObject(obj).measuredHeight);
558
-
559
- obj = ILayoutManagerClient(invalidateSizeQueue.removeLargest());
560
- }
561
-
562
- if (invalidateSizeQueue.isEmpty())
563
- {
564
- // trace("Measurement Queue is empty");
565
-
566
- invalidateSizeFlag = false;
567
- }
568
-
569
- // trace("<--- LayoutManager: validateSize ---");
570
- }
571
-
572
- /**
573
- * Validates all components whose properties have changed and have called
574
- * the <code>invalidateDisplayList()</code> method.
575
- * It calls <code>validateDisplayList()</code> method on those components
576
- * and will call the <code>validateDisplayList()</code> method
577
- * on any other components that are
578
- * invalidated while validating other components.
579
- * The <code>validateDisplayList()</code> method starts with
580
- * the least deeply nested child in the tree of display objects
581
- *
582
- */
583
- private function validateDisplayList():void
584
- {
585
-
586
- // trace("--- LayoutManager: validateDisplayList --->");
587
-
588
- var obj:ILayoutManagerClient = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallest());
589
- while (obj)
590
- {
591
- // trace("LayoutManager calling validateDisplayList on " + Object(obj) + " " + DisplayObject(obj).width + " " + DisplayObject(obj).height);
592
-
593
- obj.validateDisplayList();
594
- if (!obj.updateCompletePendingFlag)
595
- updateCompleteQueue.addObject(obj, obj.nestLevel);
596
-
597
- // trace("LayoutManager return from validateDisplayList on " + Object(obj) + " " + DisplayObject(obj).width + " " + DisplayObject(obj).height);
598
-
599
- // Once we start, don't stop.
600
- obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallest());
601
- }
602
-
603
-
604
- if (invalidateDisplayListQueue.isEmpty())
605
- {
606
- // trace("Layout Queue is empty");
607
-
608
- invalidateDisplayListFlag = false;
609
- }
610
-
611
- // trace("<--- LayoutManager: validateDisplayList ---");
612
- }
613
-
614
- /**
615
- * @private
616
- */
617
- private function doPhasedInstantiation():void
618
- {
619
- // trace(">>DoPhasedInstantation");
620
-
621
- // If phasing, do only one phase: validateProperties(),
622
- // validateSize(), or validateDisplayList().
623
- if (usePhasedInstantiation)
624
- {
625
- if (invalidatePropertiesFlag)
626
- {
627
- validateProperties();
628
-
629
- // The Preloader listens for this event.
630
- Application.application.dispatchEvent(
631
- new Event("validatePropertiesComplete"));
632
- }
633
-
634
- else if (invalidateSizeFlag)
635
- {
636
- validateSize();
637
-
638
- // The Preloader listens for this event.
639
- Application.application.dispatchEvent(
640
- new Event("validateSizeComplete"));
641
- }
642
-
643
- else if (invalidateDisplayListFlag)
644
- {
645
- validateDisplayList();
646
-
647
- // The Preloader listens for this event.
648
- Application.application.dispatchEvent(
649
- new Event("validateDisplayListComplete"));
650
- }
651
- }
652
-
653
- // Otherwise, do one pass of all three phases.
654
- else
655
- {
656
- if (invalidatePropertiesFlag)
657
- validateProperties();
658
-
659
- if (invalidateSizeFlag)
660
- validateSize();
661
-
662
- if (invalidateDisplayListFlag)
663
- validateDisplayList();
664
- }
665
-
666
- //// trace("invalidatePropertiesFlag " + invalidatePropertiesFlag);
667
- //// trace("invalidateSizeFlag " + invalidateSizeFlag);
668
- //// trace("invalidateDisplayListFlag " + invalidateDisplayListFlag);
669
-
670
- if (invalidatePropertiesFlag ||
671
- invalidateSizeFlag ||
672
- invalidateDisplayListFlag)
673
- {
674
- callLaterObject.callLater(doPhasedInstantiation);
675
- }
676
- else
677
- {
678
- usePhasedInstantiation = false;
679
-
680
- callLaterPending = false;
681
-
682
- var obj:ILayoutManagerClient = ILayoutManagerClient(updateCompleteQueue.removeLargest());
683
- while (obj)
684
- {
685
- if (!obj.initialized && obj.processedDescriptors)
686
- obj.initialized = true;
687
- obj.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE));
688
- obj.updateCompletePendingFlag = false;
689
- obj = ILayoutManagerClient(updateCompleteQueue.removeLargest());
690
- }
691
-
692
- // trace("updateComplete");
693
-
694
- dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE));
695
- }
696
-
697
- // trace("<<DoPhasedInstantation");
698
- }
699
-
700
- /**
701
- * When properties are changed, components generally do not apply those changes immediately.
702
- * Instead the components usually call one of the LayoutManager's invalidate methods and
703
- * apply the properties at a later time. The actual property you set can be read back
704
- * immediately, but if the property affects other properties in the component or its
705
- * children or parents, those other properties may not be immediately updated. To
706
- * guarantee that the values are updated, you can call the <code>validateNow()</code> method.
707
- * It updates all properties in all components before returning.
708
- * Call this method only when necessary as it is a computationally intensive call.
709
- */
710
- public function validateNow():void
711
- {
712
- if (!usePhasedInstantiation)
713
- {
714
- var infiniteLoopGuard:int = 0;
715
- while (callLaterPending && infiniteLoopGuard++ < 100)
716
- doPhasedInstantiation();
717
- }
718
- }
719
-
720
- /**
721
- * When properties are changed, components generally do not apply those changes immediately.
722
- * Instead the components usually call one of the LayoutManager's invalidate methods and
723
- * apply the properties at a later time. The actual property you set can be read back
724
- * immediately, but if the property affects other properties in the component or its
725
- * children or parents, those other properties may not be immediately updated.
726
- *
727
- * <p>To guarantee that the values are updated,
728
- * you can call the <code>validateClient()</code> method.
729
- * It updates all properties in all components whose nest level is greater than or equal
730
- * to the target component before returning.
731
- * Call this method only when necessary as it is a computationally intensive call.</p>
732
- *
733
- * @param target The component passed in is used to test which components
734
- * should be validated. All components contained by this component will have their
735
- * <code>validateProperties()</code>, <code>commitProperties()</code>,
736
- * <code>validateSize()</code>, <code>measure()</code>,
737
- * <code>validateDisplayList()</code>,
738
- * and <code>updateDisplayList()</code> methods called.
739
- *
740
- * @param skipDisplayList If <code>true</code>,
741
- * does not call the <code>validateDisplayList()</code>
742
- * and <code>updateDisplayList()</code> methods.
743
- */
744
- public function validateClient(target:ILayoutManagerClient , skipDisplayList:Boolean = false):void
745
- {
746
- var obj:ILayoutManagerClient;
747
- var i:int = 0;
748
- var done:Boolean = false;
749
- var oldTargetLevel:int = targetLevel;
750
-
751
- // the theory here is that most things that get validated are deep in the tree
752
- // and so there won't be nested calls to validateClient. However if there is,
753
- // we don't want to have a more sophisticated scheme of keeping track
754
- // of dirty flags at each level that is being validated, but we definitely
755
- // do not want to keep scanning the queues unless we're pretty sure that
756
- // something might be dirty so we just say that if something got dirty
757
- // during this call at a deeper nesting than the first call to validateClient
758
- // then we'll scan the queues. So we only change targetLevel if we're the
759
- // outer call to validateClient and only that call restores it.
760
- if (targetLevel == int.MAX_VALUE)
761
- targetLevel = target.nestLevel;
762
-
763
- // trace("--- LayoutManager: validateClient ---> target = " + target);
764
-
765
- while (!done)
766
- {
767
- // assume we won't find anything
768
- done = true;
769
-
770
- // Keep traversing the invalidatePropertiesQueue until we've reached the end.
771
- // More elements may get added to the queue while we're in this loop, or a
772
- // a recursive call to this function may remove elements from the queue while
773
- // we're in this loop.
774
- obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target));
775
- while (obj)
776
- {
777
- // trace("LayoutManager calling validateProperties() on " + Object(obj) + " " + DisplayObject(obj).width + " " + DisplayObject(obj).height);
778
-
779
- obj.validateProperties();
780
- if (!obj.updateCompletePendingFlag)
781
- updateCompleteQueue.addObject(obj, obj.nestLevel);
782
-
783
- // Once we start, don't stop.
784
- obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target));
785
- }
786
-
787
- if (invalidatePropertiesQueue.isEmpty())
788
- {
789
- // trace("Properties Queue is empty");
790
-
791
- invalidatePropertiesFlag = false;
792
- invalidateClientPropertiesFlag = false;
793
- }
794
-
795
- // trace("--- LayoutManager: validateSize --->");
796
-
797
- obj = ILayoutManagerClient(invalidateSizeQueue.removeLargestChild(target));
798
- while (obj)
799
- {
800
- // trace("LayoutManager calling validateSize() on " + Object(obj));
801
-
802
- obj.validateSize();
803
- if (!obj.updateCompletePendingFlag)
804
- updateCompleteQueue.addObject(obj, obj.nestLevel);
805
-
806
- // trace("LayoutManager validateSize: " + Object(obj) + " " + IFlexDisplayObject(obj).measuredWidth + " " + IFlexDisplayObject(obj).measuredHeight);
807
-
808
- if (invalidateClientPropertiesFlag)
809
- {
810
- // did any properties get invalidated while validating size?
811
- obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target));
812
- if (obj)
813
- {
814
- // re-queue it. we'll pull it at the beginning of the loop
815
- invalidatePropertiesQueue.addObject(obj, obj.nestLevel);
816
- done = false;
817
- break;
818
- }
819
- }
820
-
821
- obj = ILayoutManagerClient(invalidateSizeQueue.removeLargestChild(target));
822
- }
823
-
824
- if (invalidateSizeQueue.isEmpty())
825
- {
826
- // trace("Measurement Queue is empty");
827
-
828
- invalidateSizeFlag = false;
829
- invalidateClientSizeFlag = false;
830
- }
831
-
832
- if (!skipDisplayList)
833
- {
834
- // trace("--- LayoutManager: validateDisplayList --->");
835
-
836
- obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallestChild(target));
837
- while (obj)
838
- {
839
- // trace("LayoutManager calling validateDisplayList on " + Object(obj) + " " + DisplayObject(obj).width + " " + DisplayObject(obj).height);
840
-
841
- obj.validateDisplayList();
842
- if (!obj.updateCompletePendingFlag)
843
- updateCompleteQueue.addObject(obj, obj.nestLevel);
844
-
845
- // trace("LayoutManager return from validateDisplayList on " + Object(obj) + " " + DisplayObject(obj).width + " " + DisplayObject(obj).height);
846
-
847
- if (invalidateClientPropertiesFlag)
848
- {
849
- // did any properties get invalidated while validating size?
850
- obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target));
851
- if (obj)
852
- {
853
- // re-queue it. we'll pull it at the beginning of the loop
854
- invalidatePropertiesQueue.addObject(obj, obj.nestLevel);
855
- done = false;
856
- break;
857
- }
858
- }
859
-
860
- if (invalidateClientSizeFlag)
861
- {
862
- obj = ILayoutManagerClient(invalidateSizeQueue.removeLargestChild(target));
863
- if (obj)
864
- {
865
- // re-queue it. we'll pull it at the beginning of the loop
866
- invalidateSizeQueue.addObject(obj, obj.nestLevel);
867
- done = false;
868
- break;
869
- }
870
- }
871
-
872
- // Once we start, don't stop.
873
- obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallestChild(target));
874
- }
875
-
876
-
877
- if (invalidateDisplayListQueue.isEmpty())
878
- {
879
- // trace("Layout Queue is empty");
880
-
881
- invalidateDisplayListFlag = false;
882
- }
883
- }
884
- }
885
-
886
- if (oldTargetLevel == int.MAX_VALUE)
887
- {
888
- targetLevel = int.MAX_VALUE;
889
- if (!skipDisplayList)
890
- {
891
- obj = ILayoutManagerClient(updateCompleteQueue.removeLargestChild(target));
892
- while (obj)
893
- {
894
- if (!obj.initialized)
895
- obj.initialized = true;
896
- obj.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE));
897
- obj.updateCompletePendingFlag = false;
898
- obj = ILayoutManagerClient(updateCompleteQueue.removeLargestChild(target));
899
- }
900
- }
901
- }
902
-
903
- // trace("<--- LayoutManager: validateClient --- target = " + target);
904
- }
905
-
906
- /**
907
- * Returns <code>true</code> if there are components that need validating;
908
- * <code>false</code> if all components have been validated.
909
- */
910
- public function isInvalid():Boolean
911
- {
912
- return invalidatePropertiesFlag ||
913
- invalidateSizeFlag ||
914
- invalidateDisplayListFlag;
915
- }
916
-
917
- /**
918
- * @private
919
- * callLater() is called immediately after an object is created.
920
- * We really want to wait one more frame before starting in.
921
- */
922
- private function waitAFrame():void
923
- {
924
- //// trace(">>LayoutManager:WaitAFrame");
925
-
926
- callLaterObject.callLater(doPhasedInstantiation);
927
-
928
- //// trace("<<LayoutManager:WaitAFrame");
929
- }
930
-
931
- // METHOD ADDED BY ASUNIT
932
- // This method prevents the LayoutManager from
933
- // validating entities for whom tearDown has already been called...
934
- public function resetAll():void {
935
- invalidatePropertiesQueue = new PriorityQueue();
936
- invalidateSizeQueue = new PriorityQueue();
937
- invalidateDisplayListQueue = new PriorityQueue();
938
-
939
- invalidatePropertiesFlag = false;
940
- invalidateClientSizeFlag = false;
941
- invalidateDisplayListFlag = false;
942
- }
943
- }
944
-
945
- }
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <actionScriptProperties version="1" mainApplicationPath="OtherProjectRunner.as">
3
- <compiler additionalCompilerArguments="--default-size 1000 500 --default-background-color 0xffffff" copyDependentFiles="false" generateAccessible="false" strict="true" warn="true" htmlGenerate="false" htmlPlayerVersionCheck="true" htmlPlayerVersion="9.0.0" htmlExpressInstall="true" htmlHistoryManagement="true" outputFolderPath="bin" sourceFolderPath="src">
4
- <compilerSourcePath>
5
- <compilerSourcePathEntry kind="1" path="/<%=project_name%>/test"/>
6
- <compilerSourcePathEntry kind="1" path="/<%=project_name%>/lib/asunit"/>
7
- </compilerSourcePath>
8
- <libraryPath>
9
- <libraryPathEntry kind="3" path="${FRAMEWORKS}/libs/playerglobal.swc" linkType="2"/>
10
- <libraryPathEntry kind="3" path="${FRAMEWORKS}/libs/utilities.swc" linkType="1"/>
11
- <libraryPathEntry kind="3" path="${FRAMEWORKS}/libs/flex.swc" linkType="1" sourcepath="${FRAMEWORKS}/source"/>
12
- </libraryPath>
13
- <sourceAttachmentPath>
14
- <sourceAttachmentPathEntry kind="3" path="${FRAMEWORKS}/libs/flex.swc" sourcepath="${FRAMEWORKS}/source"/>
15
- </sourceAttachmentPath>
16
- </compiler>
17
- <applications>
18
- <application path="<%=project_name%>.as"/>
19
- <application path="<%=project_name%>Runner.as"/>
20
- </applications>
21
- </actionScriptProperties>
@@ -1,29 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name><%=project_name%></name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- <buildCommand>
9
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
10
- <arguments>
11
- </arguments>
12
- </buildCommand>
13
- </buildSpec>
14
- <natures>
15
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
16
- </natures>
17
- <linkedResources>
18
- <link>
19
- <name>[source path] test</name>
20
- <type>2</type>
21
- <location>/<%=project_name%>/test</location>
22
- </link>
23
- <link>
24
- <name>[source path] asunit</name>
25
- <type>2</type>
26
- <location>/<%=project_name%>/lib/asunit</location>
27
- </link>
28
- </linkedResources>
29
- </projectDescription>
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name><%=project_name%></name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- <buildCommand>
9
- <name>com.pf.fdt.IncrementalProjectBuilder1</name>
10
- <arguments>
11
- </arguments>
12
- </buildCommand>
13
- </buildSpec>
14
- <natures>
15
- <nature>com.pf.fdt.FlashNature</nature>
16
- </natures>
17
- <linkedResources>
18
- </linkedResources>
19
- </projectDescription>