[aida] "Dynamic" Domain Objects

Stefan Schmiedl s at xss.de
Fri May 23 16:05:50 CEST 2008


On Fri, 23 May 2008 09:38:51 -0400
"Rob Rothwell" <r.j.rothwell at gmail.com> wrote:

> > However, how about defining a method
> >
> >        WebFormElement>>dynamicProperty:of:
> >
> > similar to the way aspect:for: works, but instead of mapping the symbol
> > to an immediate accessor, use it to access the observee's property
> > dictionary.
> 
> 
> So, what I am working on is basically a combination of what you have
> suggested...a new dynamicProperty:of: method that gets activated by
> doesNotUnderstand: so that Aida can continue to function normally...

I've just taken a look at how aspect:for: was implemented, which led me
to the method WebFormElement>>adapt

  adapt
  "set appropriate aspect adaptor for that element"
	
  (self aspect isKindOf: Symbol) ifTrue:
      [self adaptor: ((AIDAAspectAdaptor forAspect: self aspect) subject: self object)].
    (self aspect isKindOf: Number) ifTrue:
      ["adapt to an element of collection"
        self adaptor:  ((AIDAIndexedAdaptor forIndex: self aspect) subject: self object)]

which is kind of ugly (sorry Janko). I might be wrong, but it
looks like adapt is called on all WebFormElements, so you probably can't
just define your own adaptor like

	self adaptor: 
		((AIDAIndexedAdaptor forIndex: self aspect) 
			subject: self object properties

OTOH, it gives me an idea: It would work out of the box, if the object
behind the form is a collection indexable by numbers. Can you put your
dynamic properties into an OrderedCollection and use this collection as
model for a "dynamic property editor" component?

s.


More information about the Aida mailing list