package Ġorg . n ield . dirty fx . beans Ċ Ċ import Ġjavafx . beans . Invalid ation Listener Ċ import Ġjavafx . beans . property .* Ċ import Ġjavafx . beans . value . ChangeListener Ċ import Ġjavafx . beans . value . Observable Value Ċ import Ġjavafx . beans . value . Weak ChangeListener Ċ import Ġjavafx . collections . FX Collections Ċ import Ġjavafx . collections . Observable Set Ċ import Ġjavafx . collections . Set ChangeListener Ċ import Ġorg . n ield . dirty fx . tracking . Dirty Property ĊĊĊ Ċ class ĠDir ty SetProperty < T > Ġconstructor ( original Set : ĠSet < T > Ġ= Ġmutable Set Of ()): ĠDir ty Property , ĠSet Property < T >() Ġ{ ĊĊĠĠĠ Ġconstructor ( var arg Ġitems : ĠT ): Ġ Ġthis ( items . to Mutable Set ()) ĊĊĠĠĠ Ġprivate Ġval Ġ_ original Set Ġ= ĠFX Collections . observable Set ( original Set . to Mutable Set ()) ĊĠĠĠ Ġprivate Ġval Ġ_ is Dirty Property Ġ= ĠSimple Boolean Property () ĊĠĠĠ Ġprivate Ġval Ġbacking Set Ġ= ĠSimple SetProperty ( FX Collections . observable Set ( original Set . to Mutable Set ())) ĊĊĠĠĠ Ġprivate Ġval Ġlistener Ġ= ĠChange Listener < Set < T >> Ġ{ Ġ_, _, _ Ġ-> ĊĠĠĠĠĠĠĠ Ġ_ is Dirty Property . set (_ original Set Ġ!= Ġthis ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġadd Listener ( Weak ChangeListener ( listener )) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ/** ĠSets Ġthis Ġ` Observable List ` Ġto Ġnow Ġbe Ġthe Ġ" original " Ġlist Ġ**/ ĊĠĠĠ Ġoverride Ġfun Ġre baseline () Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ original Set . clear () ĊĠĠĠĠĠĠĠ Ġ_ original Set . addAll ( this ) ĊĠĠĠĠĠĠĠ Ġ_ is Dirty Property . set ( false ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ/** ĠRe sets Ġthis Ġ` Observable List ` Ġto Ġthe Ġ" original " Ġlist Ġ**/ ĊĠĠĠ Ġoverride Ġfun Ġreset () Ġ{ ĊĠĠĠĠĠĠĠ Ġclear () ĊĠĠĠĠĠĠĠ Ġadd All (_ original Set ) ĊĠĠĠĠĠĠĠ Ġ_ is Dirty Property . set ( false ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġval Ġoriginal Set Ġget () Ġ= ĠFX Collections . unmodifiable Observable Set (_ original Set ) ĊĊĠĠĠ Ġoverride Ġfun Ġis Dirty Property (): ĠObservable Value < Boolean > Ġ= Ġ_ is Dirty Property ĊĠĠĠ Ġoverride Ġval Ġis Dirty Ġget () Ġ= Ġ_ is Dirty Property . get () ĊĊĠĠĠ Ġoverride Ġfun ĠhashCode () Ġ= Ġbacking Set . hashCode () ĊĠĠĠ Ġoverride Ġfun Ġequals ( other : ĠAny ?) Ġ= Ġbacking Set Ġ== Ġother ĊĊĠĠĠ Ġoverride Ġfun Ġempty Property () Ġ= Ġbacking Set . empty Property () ĊĊĠĠĠ Ġoverride Ġfun Ġsize Property () Ġ= Ġbacking Set . size Property () ĊĊĠĠĠ Ġoverride Ġfun ĠgetName () Ġ= Ġbacking Set . name ĊĊĠĠĠ Ġoverride Ġfun Ġadd Listener ( listener : ĠChange Listener < in ĠObservable Set < T >> ?) Ġ= Ġbacking Set . addListener ( listener ) ĊĊĠĠĠ Ġoverride Ġfun Ġadd Listener ( listener : ĠIn validation Listener ?) Ġ= Ġbacking Set . addListener ( listener ) ĊĊĠĠĠ Ġoverride Ġfun Ġadd Listener ( listener : ĠSet ChangeListener < in ĠT > ?) Ġ= Ġbacking Set . addListener ( listener ) ĊĊĠĠĠ Ġoverride Ġfun Ġremove Listener ( listener : ĠChange Listener < in ĠObservable Set < T >> ?) Ġ= Ġbacking Set . remove Listener ( listener ) ĊĊĠĠĠ Ġoverride Ġfun Ġremove Listener ( listener : ĠIn validation Listener ?) Ġ= Ġbacking Set . remove Listener ( listener ) ĊĊĠĠĠ Ġoverride Ġfun Ġremove Listener ( listener : ĠSet ChangeListener < in ĠT > ?) Ġ= Ġbacking Set . remove Listener ( listener ) ĊĊĠĠĠ Ġoverride Ġfun Ġget () Ġ= Ġbacking Set . get () ĊĊĠĠĠ Ġoverride Ġfun Ġget Bean () Ġ= Ġbacking Set . bean ĊĊĠĠĠ Ġoverride Ġfun Ġset ( value : ĠObservable Set < T > ?) Ġ= Ġbacking Set . set ( value ) ĊĊĠĠĠ Ġoverride Ġfun Ġun bind () Ġ= Ġbacking Set . unbind () ĊĊĠĠĠ Ġoverride Ġfun Ġbind ( observable : ĠObservable Value < out ĠObservable Set < T >> ?) Ġ= Ġbacking Set . bind ( observable ) ĊĊĠĠĠ Ġoverride Ġfun Ġis Bound () Ġ= Ġbacking Set . is Bound Ċ } ĊĊ