Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  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.

2  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.
3  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!
4  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!
5  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

thanks! :D
Pages: [1]