About the new PRWidgets

Lukas Renggli renggli at iam.unibe.ch
Thu Apr 19 16:17:24 MEST 2007


Hi Martial,

> As a newbie in Magritte, I don't understand well how the new widgets
> work in Pier. For my personal web site I'm programming in Pier, I
> created a PRBoxWidget instance to encapsulate other widgets.

widgets are essentially just Seaside components, but instead of  
#renderContentOn: you override #renderWidgetOn:. They also provide a  
settings command so that administrators can configure them from the  
web. It is also possible to plug in any Seaside component, e.g. the  
Sushi Store, but these are not configurable from the web.

> In my case, I like to have two instances of my site main class in  
> my disptacher:
> one for admin displaying everything and one for everybody with only a
> PRSearchWidget and a PRTree (no commands, no views); each one pointing
> to the same kernel. So until you don't know the url to access to the
> admin path you don't see the 'login' link.
>
> I did this using:
>
> PRBoxWidget subclass: #MyNavigationWidget
> instanceVariableNames: 'adminPool userPool' ...etc
>
> MyNavigationWidget>>#renderContentOn:
> self adminConfigFlag ifTrue:
> 	[adminPool do: [:ea | html render: ea] separatedBy: [html
> break]]
> 	ifFalse:
> 	[userPool...
>
>
> with adminConfigFlag being a simple boolean in the associated  
> WAConfiguration..
>
> MyNavigationWidget>>#initialize
> 	super initialize.
> 	adminPool := Array with: PRTreeWidget new with: PRCommandsWidget
> new with: PRViewsWidget.
> 	userPool := Array with: PRTreeWidget new with: PRSearchWidget
>
> Not a beautiful OO way to do things but it worked. But now I am a bit
> lost. If you understand what I mean (and you have time), I'll be glad
> you shortly explain where to look for to change this in the new way
> because now it doesn't work.

The new way? I guess I didn't change anything special there, just the  
way components get initialized using Magritte? If this breaks  
something this was not intentional. Maybe you need to reset the  
settings of the widgets.

> It's maybe a easy task to do but I don't know how to rethink my
> interface.

Did my latest changes break something in particular? Do you have a  
stack trace? What is the particular problem?

> PS: great change in visitParagraph: . It's cool. I did those kinds of
> modification in order to avoid a <div class='paragraph'> in the  
> start of
> the default page (as I need to manage two absolute divs). Your way  
> is better.

Thanks. I wanted to blog about that. This is absolutely needed to  
create sophisticated CSS layouts ...

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch




More information about the smallwiki mailing list