/* Ċ Ġ* ĠThis Ġfile Ġis Ġpart Ġof ĠM CP IDE , Ġlicensed Ġunder Ġthe ĠMIT ĠLicense Ġ( MIT ). Ċ Ġ* Ċ Ġ* ĠCopyright Ġ( c ) Ġk en zier ocks Ġ< https :// ken zier ocks . me > Ċ Ġ* ĠCopyright Ġ( c ) Ġcontributors Ċ Ġ* Ċ Ġ* ĠPermission Ġis Ġhereby Ġgranted , Ġfree Ġof Ġcharge , Ġto Ġany Ġperson Ġobtaining Ġa Ġcopy Ċ Ġ* Ġof Ġthis Ġsoftware Ġand Ġassociated Ġdocumentation Ġfiles Ġ( the Ġ" Software "), Ġto Ġdeal Ċ Ġ* Ġin Ġthe ĠSoftware Ġwithout Ġrestriction , Ġincluding Ġwithout Ġlimitation Ġthe Ġrights Ċ Ġ* Ġto Ġuse , Ġcopy , Ġmodify , Ġmerge , Ġpublish , Ġdistribute , Ġsublicense , Ġand / or Ġsell Ċ Ġ* Ġcopies Ġof Ġthe ĠSoftware , Ġand Ġto Ġpermit Ġpersons Ġto Ġwhom Ġthe ĠSoftware Ġis Ċ Ġ* Ġfurnished Ġto Ġdo Ġso , Ġsubject Ġto Ġthe Ġfollowing Ġconditions : Ċ Ġ* Ċ Ġ* ĠThe Ġabove Ġcopyright Ġnotice Ġand Ġthis Ġpermission Ġnotice Ġshall Ġbe Ġincluded Ġin Ċ Ġ* Ġall Ġcopies Ġor Ġsubstantial Ġportions Ġof Ġthe ĠSoftware . Ċ Ġ* Ċ Ġ* ĠTHE ĠSOFTWARE ĠIS ĠPROVIDED Ġ" AS ĠIS ", ĠWITHOUT ĠWARRANTY ĠOF ĠANY ĠKIND , ĠEXPRESS ĠOR Ċ Ġ* ĠIMPLIED , ĠINCLUDING ĠBUT ĠNOT ĠLIMITED ĠTO ĠTHE ĠWARRANTIES ĠOF ĠMERCHANTABILITY , Ċ Ġ* ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠAND ĠNONINFRINGEMENT . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE Ċ Ġ* ĠAUTHORS ĠOR ĠCOPYRIGHT ĠHOLDERS ĠBE ĠLIABLE ĠFOR ĠANY ĠCLAIM , ĠDAMAGES ĠOR ĠOTHER Ċ Ġ* ĠLIABILITY , ĠWHETHER ĠIN ĠAN ĠACTION ĠOF ĠCONTRACT , ĠTORT ĠOR ĠOTHERWISE , ĠARISING ĠFROM , Ċ Ġ* ĠOUT ĠOF ĠOR ĠIN ĠCONNECTION ĠWITH ĠTHE ĠSOFTWARE ĠOR ĠTHE ĠUSE ĠOR ĠOTHER ĠDEALINGS ĠIN Ċ Ġ* ĠTHE ĠSOFTWARE . Ċ Ġ*/ Ċ Ċ package Ġme . ken zier ocks . m cp ide . inject Ċ Ċ import Ġdagger . Module Ċ import Ġdagger . Provides Ċ import Ġjavafx . f xml . FXML Loader Ċ import Ġjavafx . util . Callback Ċ import Ġme . ken zier ocks . m cp ide . controller . Export able Mappings Controller Ċ import Ġme . ken zier ocks . m cp ide . controller . File Ask Dialog Controller Ċ import Ġme . ken zier ocks . m cp ide . controller . Find In Path Controller Ċ import Ġme . ken zier ocks . m cp ide . controller . Find Popup Controller Ċ import Ġme . ken zier ocks . m cp ide . controller . Main Controller Ċ import Ġjava . nio . charset . StandardCharsets Ċ import Ġjavax . inject . Provider Ċ import Ġjavax . inject . Singleton ĊĊ Ċ interface ĠController Factory Ġ: ĠCallback < Class <* >, ĠAny > Ċ Ċ private Ġinline Ġfun Ġ< re ified ĠT > Ġcontroller Bind ( source : ĠProvider < T >): ĠPair < Class <* >, Ġ() Ġ-> ĠT > Ġ= ĊĠĠĠ ĠT :: class . java Ġto Ġsource :: get Ċ Ċ private Ġclass ĠMap Based Controller Factory ( ĊĠĠĠ Ġprivate Ġval Ġcontrollers : ĠMap < Class <* >, Ġ() Ġ-> ĠAny > Ċ ) Ġ: ĠController Factory Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġcall ( cls : ĠClass <* >) Ġ= ĊĠĠĠĠĠĠĠ Ġ( controllers [ cls ] Ġ?: Ġthrow ĠIllegalStateException (" No Ġcontroller Ġfor Ġclass Ġ${ cls . name } ")) () Ċ } Ċ Ċ private Ġfun Ġmap Based Controller Factory ( var arg Ġcontroller Bind s : ĠPair < Class <* >, Ġ() Ġ-> ĠAny >): ĠMap Based Controller Factory Ġ{ ĊĠĠĠ Ġreturn ĠMap Based Controller Factory ( map Of (* controller Bind s )) Ċ } Ċ Ċ private Ġfun Ġnew F xml Loader ( controller Factory : ĠController Factory ) Ġ= ĊĠĠĠ ĠF XML Loader ( null , Ġnull , Ġnull , Ġcontroller Factory , ĠStandard Charsets . UTF _ 8 ) Ċ Ċ @ Module Ċ object ĠF x Module Ġ{ ĊĠĠĠ Ġ@ [ Provides ĠSingleton ] ĊĠĠĠ Ġfun Ġprovide Controller Factory ( ĊĠĠĠĠĠĠĠ Ġmain Controller : ĠProvider < Main Controller >, ĊĠĠĠĠĠĠĠ Ġfile Ask Dialog Controller : ĠProvider < File Ask Dialog Controller >, ĊĠĠĠĠĠĠĠ Ġexport able Mappings Controller : ĠProvider < Export able Mappings Controller >, ĊĠĠĠĠĠĠĠ Ġfind Popup Controller : ĠProvider < Find Popup Controller > ĊĠĠĠ Ġ): ĠController Factory Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġmap Based Controller Factory ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontroller Bind ( main Controller ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontroller Bind ( file Ask Dialog Controller ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontroller Bind ( export able Mappings Controller ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontroller Bind ( find Popup Controller ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide F xml Loader ( controller Factory : ĠController Factory ) Ġ= Ġnew F xml Loader ( controller Factory ) Ċ Ċ } Ċ Ċ @ Module Ċ object ĠProject Fx Module Ġ{ ĊĠĠĠ Ġ@ [ Provides ĠProject Scope ĠProject Q ] ĊĠĠĠ Ġfun Ġprovide Controller Factory ( ĊĠĠĠĠĠĠĠ Ġfind In Path Controller : ĠProvider < Find In Path Controller > ĊĠĠĠ Ġ): ĠController Factory Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġmap Based Controller Factory ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontroller Bind ( find In Path Controller ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ [ Provides ĠProject Q ] ĊĠĠĠ Ġfun Ġprovide F xml Loader (@ Project Q Ġcontroller Factory : ĠController Factory ) Ġ= Ġnew F xml Loader ( controller Factory ) Ċ Ċ } Ċ