That's some fancy voodoo, Elliot (and Bob).   Event observers are
powerful...if only they made a great Americano... ;)

Paul

On Thu, Dec 4, 2008 at 11:59 AM, Elliott Sprehn <[EMAIL PROTECTED]> wrote:

>
> On Dec 4, 2:20 pm, "Matt Quackenbush" <[EMAIL PROTECTED]> wrote:
> > On Thu, Dec 4, 2008 at 1:19 PM, Matt Graf wrote:
> >
> > > I don't think I am explaining myself very well lets see if I can
> > > explain it a little better
> >
> > > Here is an example of where I tell transfer to use my decorator
> > > <object name="widget_one" table="widget_one"
> > > decorator="model.decorators.widget_one">
> >
> > > now what I want is for transfer to use my base decorator without
> > > telling transfer to do so.
> >
> > > is that possible?
> >
> > No.
>
> I'm going to have to cry foul on this. It *is* possible, but it
> requires some creativity.
>
> 1. Create your special decorator object.
> 2. Create a single instance of this object and add it as a listener
> for the AfterNewTransferEvent.
> 3. Implement the actionAfterNewTransferEvent() method such that it
> mixes the two components together and does setup.
>
> AutoDecorator.cfc:
>
> <!---+
>        Mix the two components together. Only mixes the public stuff, so if
> you need private methods or
>        variables you'll need to inject another method and use that.
> --->
> <cffunction name="actionAfterNewTransferEvent" access="public"
> returntype="void" output="false">
>        <cfargument name="event" type="transfer.com.events.TransferEvent"
> required="true">
>
>        <cfset var object = arguments.event.getTransferObject()>
>
>        <cfset object.mixin = mixin>
>        <cfset object.mixin(variables)>
>        <!--- Maybe call some special method like setup() here to allow the
> special decorator to do setup --->
> </cffunction>
>
> <cffunction name="mixin" access="public" returntype="void"
> output="false">
>        <cfargument name="componentVariables" type="any" required="true">
>
>        <cfset structAppend(this,componentVariables.this,false)>
>        <cfset structAppend(variables,componentVariables,false)>
> </cffunction>
>
> In general I'm a big advocate of very dynamic solutions, but this
> seems rather extreme with a high cost in terms of maintainability
> later. So, while this does work, I'd argue that it'd be better to just
> use decorator="BaseDecorator" on every <object/> in your transfer.xml
> instead of this much black magic.
>
> >
>


-- 
Paul Marcotte
Fancy Bread - in the heart or in the head?
http://www.fancybread.com

--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to