|
|
Show Posts
|
Pages: [1]
|
2
|
Announcements and General Discussion / General Discussion / Only one Mediator Instead of One for every single Thumbnail!!!
|
on: December 01, 2009, 11:22:15
|
Hi All... i have an issue... ...i lost all my flex projects in my stolen laptop, so i've stated to do all my projects from zero, the problem is that some code that i used to use, now doesn't work....that is weird.
The issue is : in a panel Component Mediator ( WetsuitViewMediator.as) wich has a component associated (WetsuitView.mxml)... i have the following code that create thumbnails from another component (TemplatePiezaItem.mxml)
var n:int = (_templateProxy.templates[0] as TemplateVO).Piezas.length; viewInstance.entidadItems = new Array(n); for (i=0; i < n; i++) { var componentItem : TemplatePiezaItem = new TemplatePiezaItem(); viewInstance.entidadItems[i] = componentItem; viewInstance.entidadItems[i].showInAutomationHierarchy = true; componentItem._templatePiezaVO = (_templateProxy.templates[0] as TemplateVO).Piezas.getItemAt(i) as TemplatePiezaVO; componentItem.source = componentItem._templatePiezaVO.ImagePath; viewInstance.entidadContent.addChild(componentItem); //piezaItem.piezaColor.setStyle( "backgroundColor", piezaItem.wetsuitPiezaVO.codigoHexa ); var mediator : TemplatePiezaItemMediator = new TemplatePiezaItemMediator( componentItem ); facade.registerMediator( mediator ); }
with above code i have thumbnails of TemplatePiezaItem .mxml in WetsuitView.mxml.
THE PROBLEM is that instead of every single TemplatePiezaItem component has its own TemplatePiezaItemMediator...i only have ONE TemplatePiezaItemMediator for all of them.
i don't understand that's wrong...it worked fine to me before.
Thanks in advance.
|
|
|
3
|
Announcements and General Discussion / General Discussion / Re: TreeItemRenderer - Mediators.
|
on: September 06, 2008, 11:15:05
|
it is working now!!!
i moved the call to the dispatchEvent from the constructor method to initializationComplete method.
in TreeItemFormRenderer
public class TreeItemFormRenderer extends TreeItemRenderer { /* Constants */ public static const EVENT_ITEM_RENDERER_CREATED : String = "eventItemRendererCreated"; public static const EVENT_PRIORITY_CHANGE : String = "eventPriorityChange";
...
public function TreeItemFormRenderer():void { super(); this.addEventListener( MouseEvent.ROLL_OUT, onRollOut ); this.addEventListener( MouseEvent.ROLL_OVER, onRollOver ); }
override protected function initializationComplete():void { super.initializationComplete(); this.dispatchEvent( new Event( EVENT_ITEM_RENDERER_CREATED, true ) ); }
... }
Thanks for your help Cliff!!!
yeremy.
|
|
|
4
|
Announcements and General Discussion / General Discussion / Re: TreeItemRenderer - Mediators.
|
on: September 06, 2008, 08:33:37
|
hey Cliff!
Thanks for your help!...i tried to do that you recommended me. but for some reason, it doesn't work correctly.
in TreeItemFormRenderer.
public class TreeItemFormRenderer extends TreeItemRenderer { /* Constants */ public static const EVENT_ITEM_RENDERER_CREATED : String = "eventItemRendererCreated";
public function TreeItemFormRenderer():void { super(); this.addEventListener( MouseEvent.ROLL_OUT, onRollOut ); this.addEventListener( MouseEvent.ROLL_OVER, onRollOver ); this.dispatchEvent( new Event( EVENT_ITEM_RENDERER_CREATED, true ) ); // bubbling event //this.dispatchEvent(new Event( "testEvent", true )); } ... {
in TreeContainerMediator
override public function onRegister():void { treeContainer.addEventListener( TreeItemFormRenderer.EVENT_ITEM_RENDERER_CREATED, onRendererCreated ); } private function onRendererCreated ( event:Event ):void { var renderer : TreeItemFormRenderer = event.target as TreeItemFormRenderer; var mediator : TreeItemFormRendererMediator = new TreeItemFormRendererMediator( renderer ); facade.registerMediator( mediator ); }
i did exactly that you told me. it seems like onRendererCreated is not being called when the event is sent.
do you know what is wrong in this?
Thanks in Advance!
yeremy.
|
|
|
5
|
Announcements and General Discussion / General Discussion / TreeItemRenderer - Mediators.
|
on: September 04, 2008, 10:46:13
|
Hi All!
i've been working with a Tree Control. now i need to add some funtionallity to each item of the tree, to do this is necesary to integrate with the rest of the application, send notifications, get the proxies, etc.
i've created a itemRenderer and a mediator for this.
public class TreeItemFormRenderer extends TreeItemRenderer { ... }
it is called from the itemRenderer property :
//TreeContainer.mxml
<mx:Tree id="treeForm" left="0" top="0" width="100%" height="100%" change="handleTreeChange(event);" defaultLeafIcon="{SetNullLeafIcon}" itemRenderer="com.dhManager.view.components.util.TreeItemFormRenderer"> </mx:Tree>
and i setup the Tree in the Mediator for treeConteiner.
//TreeContainerMediator.as private function fillTreeView():void { treeContainer.treeForm.labelField = "@name"; treeContainer.treeForm.data = "@id"; treeContainer.treeForm.showRoot = false; treeContainer.treeForm.dragEnabled = true; treeContainer.treeForm.dataProvider = formProxy.getXMLListCollectionFoms(); }
I need to integrate each TreeItemRenderer to the rest of the application. my question is : Where i can put the called to the notification which call to "Create Mediator Command" ?
this is the notification :
sendNotification( ApplicationFacade.MEDIATOR_CREATE, [ TreeItemFormRendererMediator.NAME, this ] ); //this : TreeItemFormRenderern Object.
Any Help is good received!!
thanks!
yeremy.
|
|
|
7
|
Announcements and General Discussion / General Discussion / Nested View - Manage Mediators.
|
on: July 31, 2008, 01:52:07
|
hi All!
i've been doing small apps to understand pureMVC, i thing i got the general Idea. now i'm working in a product catalog (the FlexStore) and i have a problem to register the Mediators.
i have the following view hierarchy :
-MyAPP.mxml - ProductView.mxml - ProductCatalogPanel.mxml - ProductCatalogThumbnail.mxml - ProductCart.mxml - ProductFilterPanel.mxml - LoginPanel.mxml
and i have the following Mediators :
-ApplicationMediator.as ( MyAPP.mxml ) which registers the LoginPanelMediator.as (LoginPanel.mxml) and the ProductViewMediator (ProductView.mxml).
my question is : where should i register the ProductCatalogPanelMediator (ProductCatalogPanel.mxml) and ProductCatalogThumbnailMediator.as (ProductCatalogThumbnail.mxml)
i'm trying to register ProductCatalogPanelMediator.as in the ProductViewMediator's constructor Method :
public class ProductViewMediator extends Mediator implements IMediator { public static const NAME : String = "ProductViewMediator"; public function ProductViewMediator(viewComponent:Object=null) { super(NAME, viewComponent); facade.registerMediator( new ProductCatalogPanelMediator( productView.catalogPanel ) ); } public function get productView(): ProductView { return viewComponent as ProductView; } }
i didn't get an error with this...but when i want to reference to ProductCatalogPanelMediator's viewcomponent (with the get property) inside ProductCatalogPanelMediator, the reference is null...i mean :
public class ProductCatalogPanelMediator extends Mediator implements IMediator { public static const NAME : String = "ProductCatalogPanelMediator"; private var productProxy : ProductProxy; public function ProductCatalogPanelMediator(viewComponent:Object=null) { super(NAME, viewComponent); productProxy = facade.retrieveProxy( ProductProxy.NAME ) as ProductProxy; } public function get productCatalogPanel():ProductCatalogPanel { return viewComponent as ProductCatalogPanel; } /*---------- Own Methods----------*/ private function doSomething():void { if (productCatalogPanel.thumbnails != null){} //here productCatalogPanel in null }
}
in that part productCatalogPanel is null.
thanks!
|
|
|
8
|
Announcements and General Discussion / General Discussion / LibraryDelegate - Manage few Service Sources
|
on: July 29, 2008, 12:21:19
|
hi All!
i've been working in the login component..and it is done, now i need work with another remote object..i've used a LibraryDelegate to manage a service with differents sources...but i'm not sure about it is a good way to do that.
the following code is that i've used :
-----------------Login Proxy ------------------------------------ this is a method inside the LoginProxy Class.
public function login(tryLoggin: LoginVO):void { var delegate:LibraryDelegate = new LibraryDelegate( new Responder( onLoginResult, onLoginFault ) ); delegate.setSourceService( LibraryDelegate.SERVICE_USER ); delegate.login( tryLoggin ); }
-----------------Library Delegate ------------------------------------ package com.me.myapp.model.business
public class LibraryDelegate { private var responder: IResponder; private var service : RemoteObject; public var currentService : int; public static const SERVICE_USER : uint = 1; public static const SERVICE_PRODUCT : uint = 2; public function LibraryDelegate( pResponder : IResponder ) { service = new RemoteObject(); //service.endpoint = ""; service.destination = "GenericDestination"; service.showBusyCursor = true; service.makeObjectsBindable = true; responder = pResponder; } public function setSourceService(pSelectorSource : uint):void { currentService = pSelectorSource; switch ( currentService ) { case SERVICE_PRODUCT : service.source = "WebOrbTestBusinessLogic.Entities.Product"; break; case SERVICE_USER : service.source = "WebOrbTestBusinessLogic.Entities.User"; default : } }
}
i hope somebody can help me with this!
Thanks!
|
|
|
11
|
Announcements and General Discussion / General Discussion / can Commands implement IResponder Interface in PureMVC?
|
on: July 25, 2008, 03:03:46
|
i'm begining to learn pureMVC, before it i was doing tests with Cairngorm... ...my question is : is a good practice use a Delegate class to manage a remote object? i mean...a command implements IResponder Interface and in the execute method the command references to the delegate class sending as a parameter itself. i just wanna be sure about it. it would be nice if somebody would give me an answer! ![;D](http://forums.puremvc.org/Smileys/default/xgrin.gif.pagespeed.ic.QVVz6XIT20.png) thanks! ![:D](http://forums.puremvc.org/Smileys/default/xcheesy.gif.pagespeed.ic.KPzuH4J-TG.png)
|
|
|
|
|