Parameterized component links

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Parameterized component links

NorbertHartl
Hi,

I asked some moons ago about the possibility to have parameterized
component links. I'm not that familiar with pier so my solution to this
might be a bit cheesy.

I wanted to have for multiple reason the ability to do

+mycomponent1|key=value+

to parameterize a component at rendering time. The problem is
that the string is parsed to a link and the link has the parameters.
So the question is how the component gets notice of these. The
last possible call to do I recognized to be

PRViewRenderer>>visitInternalLinkEmbed:

I added the following to it at the beginning

   (anObject target isComponent) ifTrue: [
      anObject parameters do: [:each|
         (self context componentAt: anObject target) propertyAt: each
key put: each value.
      ]
   ].

So I just copy all the parameters over to the component. I found
that PRComponent has already properties so I'm using these. Is this
feasible to do? Is there a better way to do? Can this be added to
pier?

I use this for two scenarios:

- advising a component what type it should filter
- to select a child component from a Magritte container (not done, yet)
 
thanks,

Norbert

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Parameterized component links

Lukas Renggli
> I asked some moons ago about the possibility to have parameterized
> component links. I'm not that familiar with pier so my solution to this
> might be a bit cheesy.

I added this functionality after you asked (see
PREmbeddedRenderer>>#visitComponent:).

> I wanted to have for multiple reason the ability to do
>
> +mycomponent1|key=value+

The key is set in the description of the component using #parameterName:

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Parameterized component links

NorbertHartl
On Sun, 2009-05-17 at 22:24 +0200, Lukas Renggli wrote:
> > I asked some moons ago about the possibility to have parameterized
> > component links. I'm not that familiar with pier so my solution to this
> > might be a bit cheesy.
>
> I added this functionality after you asked (see
> PREmbeddedRenderer>>#visitComponent:).
>
Didn't you tell me to take care myself about it? Or did you tell me that
it is there? Can't remember! But thanks anyway. I shortly browsed the
stuff in monticello and that looks quite good. I'm eager to test it.
But I'm glad I tried to do it myself.A few things more learned about
pier.
> > I wanted to have for multiple reason the ability to do
> >
> > +mycomponent1|key=value+
>
> The key is set in the description of the component using #parameterName:
>
All it needs is another description :) Well done!

thanks,

Norbert

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki