Version#1.0#(May#14,#2009)#
It!is!important!to!know!what!is!affected!during!the!Invalidation!phase!when!we!call!
these!methods.!The!invalidateProperties()!method!is!called!whenever!a!property!
changes!that!is!required!before!the!component!is!re‐measured!and!laid!out!(bear!
with!us,!this!will!be!clearer!when!we!get!to!Validation).!!The!invalidateSize()!
method!is!called!when!something!changes!(property!or!other!action)!that!requires!
the!component!to!re‐calculate!its!size!or!its!children’s!size.!!Finally,!the!
invaildateDisplayList()!method!is!called!whenever!something!changes!that!
requires!the!components!display!list!to!be!updated/managed!(adding/removing!of!
children,!skin!updates,!drawing!API,!etc)!.!
Component+Phases:+Validation+(growth+maturity)+
If!we!change!a!property,!such!as!data,!it!may!not!require!the!component!to!change!
its!size!or!update!its!display!list,!yet!we!still!need!to!execute!some!calculation!on!the!
data!when!it!changes.!!By!breaking!invalidation!into!three!methods!we!can!also!
break!validation!into!three!corresponding!methods!with!a!special!fourth!method!
called!layoutChrome()!which!we!will!explain!in!a!bit.!!The!four!methods!of!
validation!are:!commitProperties(),!measure(),!layoutChrome(),!and!
updateDisplayList().!
!
Figure'7')' The'V alidat ion'St ages'
Unlike!Invalidation
15
,!Validation!has!a!pre‐defined!order!in!the!way!the!methods!get!
executed:!commitProperties() first,!measure() second,!layoutChrome() third (if!
enabled),!and!finally!updateDisplayList().!!Validation!has!this!linear!arrangement!
because!the!order!that!we!validate!(apply!settings)!is!very!important.!!
For!example,!when!we!use!invalidateProperties()!to!state!that!one!or!more!of!
our!properties!have!changed,!we!need!to!make!sure!to!validate!the!properties!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15
#The#Invalidation#methods#don’t#have#a#call#order#because#you#execute #them#onl y#when#you#need#to #
invalidate#some#as pect# of#your#compo nent.#Since#multiple#aspects#of#the#co mponent#can#change#at #any#
time#there#ca nnot,#nor#should#there#be,#a#required#call#order#for#invalidation.##
Commentaires sur ces manuels