Archive for the ‘ fabrication ’ Category

PureMVC Fabrication Popup

 Hi,

I am sure sombody has to go through this. PopUp In PureMVC…. But Not performing any events…. I know why..
Mediator for pop component is initializing befor you have the component.. Check the solution below…

//reportPopup is of type customComponent(PdfReportFrame).

 reportPopup = PopUpManager.createPopUp(this.payrollModule,PdfReportFrame,true) as PdfReportFrame;
 registerMediator(new PdfReportFrameMediator(reportPopup, source));
 PopUpManager.centerPopUp(reportPopup);

Ranjit

Advertisements

Multiton/singleton AS3 for Modules Flex / PureMvc / Fabrication

Hi Friends,

Was wondering how to reference a singleton instance for particular Module in flex..

after reading few blog and googling ..

found a solution/rather built upon it .. thought this might be helpful to somebody…

Most things in AS are built on Java so Looked at Java Mulitone >> and there is the solution…

import flash.utils.Dictionary;

public class InternalModelLocator
{
private static var instances:Dictionary= new Dictionary();//Dictionary is treated as Java Hash Map

public function InternalModelLocator()
{
/* Only One Instance created with GetInstanceMethod*/
}

/* module_uuid can be a String ——–
In case of PureMVC “multitonKey” (this.multitonKey) can be used as unique key for multiple modules
*/
public static function getInstance(module_uuid:String):InternalModelLocator
{
var instance:InternalModelLocator = instances[module_uuid];

if(instance == null)
{
instance = new InternalModelLocator();
instances[module_uuid] = instance;
}
return instance;
}

}
Let me know if I miss some thing or needs more elboration….

Create/Register Mediator for Runtime created UIComponent Like adding into Pop up – PureMVC

Hi Friends,

Here I am again Puting accross point where I thought for second.
The solution for registering mediator for component in popup created at run time is below.

reportPopup = PopUpManager.createPopUp(this.payrollModule,PdfReportFrame,true) as PdfReportFrame;
registerMediator(new PdfReportFrameMediator(reportPopup)); //this without resolving component on parent
PopUpManager.centerPopUp(reportPopup);

Every thing else goes same way.

Ranjit

Multiton/singleton AS3 for Modules Flex / PureMvc / Fabrication

Hi Friends,

Was wondering how to reference a singleton instance for particular Module in flex..

after reading few blog and googling ..

found a solution/rather built upon it .. thought this might be helpful to somebody…

Most things in AS are built on Java so Looked at Java Mulitone >> and there is the solution…

<code>

    import flash.utils.Dictionary;

    public class InternalModelLocator
	{
		private static var instances:Dictionary= new Dictionary();//Dictionary is treated as Java Hash Map

		public function InternalModelLocator()
		{
                   /* Only One Instance created with GetInstanceMethod*/
		}

		/* module_uuid can be a String --------
                   In case of PureMVC "multitonKey" (this.multitonKey) can be used as unique key for multiple modules
                */
		public static function getInstance(module_uuid:String):InternalModelLocator
		{
			var instance:InternalModelLocator = instances[module_uuid];

			if(instance == null)
			{
				instance = new InternalModelLocator();
				instances[module_uuid] = instance;
			}
			return instance;
		} 

	}

</code>

Let me know if I miss some thing or needs more elboration….