[aida] Using WebComponent for input objects

Janko Mivšek janko.mivsek at eranova.si
Sun Jul 6 15:34:07 CEST 2008


Hi Rob,

Rob Rothwell wrote:

> I'm trying to get back to finishing WebRadioButtonGroup, and thought it 
> would be best to create a WebComponent.  However, I can't seem to get 
> any values back into my objects when I use it.  I am using Aida5.6-np58.

WebComponent is meant to be used for more complex, standalone, ajaxified 
components and not elements as simple as radio button is.

About #build method: it is used to build a component, but of course 
someone must call it. It can be called from #initialize, from 
#printWebPageFor: or even #printHTMLPageOn:for: .

When it is called depends on how late you'd like to build a component. 
Sometimes it is good to be build as early as possible, sometimes there 
are needs to build as late as possible, that is just before the 
component is rendered to the HTML.

It can also be called from Ajax calls to rebuild the component and that 
was the main reason it is implemented as separate #build method and not 
in #prinWwebPageFor: as usual.

Janko


> For example, I have a simple
> 
> 
> WebComponent subclass: #WebInputComponent
> instanceVariableNames: 'object aspect'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Aida-Components'
> 
> with accessors for object and aspect so I can pass them on to the 
> underlying WebFormElement.
> 
> Then, as an example, try creating
> 
> WebInputComponent subclass: #WebTextComponent
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Aida-Components'
> 
> with
> 
> WebTextComponent>>#build
> |e|
> e := WebElement new.
> e addInputFieldAspect: self aspect for: self object size: 50.
> self add: e
> 
> and if you #add this component to an application, enter some text, 
>  press a submit button, and inspect the "bound" object, it remains nil.
> 
> Any advice on using WebComponent(s) for this purpose?  I can make 
> everything work fine by simply creating WebElement(s) instead of 
> WebComponent(s), but then you lose the built-in #build functionality and 
> have to resort to special constructors, etc...  It would be much more 
> elegant to understand why WebComponents are not posting their changes to 
> the model the way I am using them!
> 
> Also, what would be the best way to publish an individual component to 
> be added to Aida by an end user?  Should it just go into a package that 
> places the component in the Aida-Components category, or should it be a 
> new category like Aida-Third Party Components to distinguish them from 
> built-in components?
> 
> Thanks,
> 
> Rob
> 
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Aida mailing list
> Aida na aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida

-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si


More information about the Aida mailing list