I tried to play with the lastest Pier and I found it great to add the
formattings. I even uploaded my kernel (via ReferenceStream) and it runs
well. My specific classes just needed to be upgraded to replace
WARendererHtmlRoot to WAHtmlRoot and use #nextPutAll: in my hack of
MyWARender>>#writeOnLoadOn: (actually I added a #onResizeScripts for my
session). Quite easy! but I would like to have some enlightenments about
this actual version of Pier:
1) Pier-blog doesn't work. What's the actual state of it?
2) I explore my new kernel and I can see the new PRVisitor I added in my
content (like PRItalicFormat for example) and I thought: What if there
is no well-suited visitors ? Could there be a way to downgrade a pier
application ? For example, I got the pier-r2d2 version and a friend of
me has the old pier-r2d1 version: I would be glad to send my kernel to
him but he doesn't have the special PRC3POVisitor I added. It could be
cool to "parse" a unknown PRVisitor heir as a new class PRUnknownVisitor
so that the mutilated pier kernel could work (the PRUnkownVisitor thing
could even remember the original tag if the pier classes finally are
updated to r2d2). This is just a suggestion. This idea could be great as
(I hope) the number of pier webmasters should grow in the future and
everyone could be able to add its own specific text formatters.
3) I think I read about some classes/projects to manage multiple
PRStructure (I often hack my environment to add my special +newclass+).
Is there any work about it?
(double posted on purpose, apologies if you get msg twice.)
Please tell me how this could happen:
I updated a file reference (a url() that points to a png) reference in
the PRPierLibrary in a css method.
I used the FileLibrary "files" upload facility in the dispatcher to
upload the PNG. (So, now my png is in the image)
When I refreshed the browser, my new png is not displayed.
Hmm... so I restored the method as it was, saved, and again refreshed
Hmm... still no png.. the original is not displayed either.
Why? I would expect if I replaced the method to exactly how it was it
would display as it was. I reinit'd Pier and also stopped/started WAKom.
+1 (408) 799-6124
Have you ever used an auto accessor and been annoyed by the fact that
the suggested type of the mutators argument is 'anObject'? I mean we
have a description that has a kind, so why not a suggested type? The
problem is that an accessor doesn't know to what description it
belongs. So is there a way around this? Yes, we can look at the first
argument in #write:to:. However, only doing
'a', anObject class name
Will not work. For booleans this will either result in 'aTrue' or
'aFalse'. Other cases that have to be taken care of are:
- Collections (expect dictionaries, but I don't think they are not
supported by Magritte)
- (Pier) structures
additionally we need to take nil into account.
So it may be a better idea to implement #suggestedType in various classes.
if I use attributes on a description I get something strange.
| desc |
desc := MAStringDescription selector: #dummy label: 'Dummy' priority:
desc attributes at: #dummyKey put: #dummyVal.
and I request the attributes in my renderer
| dummyVal |
dummyVal := aDescription attributes
html text: '(',aDescription asString, ') at: #dummyKey = ', dummyVal
The value is an Association #dummyKey->#dummyVal
Attached you will find the complete code which shows it.
I need to render multiple fieldsets for a model. My
idea was to split up descriptions into multiple groups,
assign each of the group to a MAContainer and add the
containers into a root container. Something like this:
So I would be able to render a fieldset per container.
As containers have labels I could even render a legend
tag for the fieldsets.
But I wasn't very lucky to do so. Is this a conceptional
problem? I tried MAContainer new and setting an accessor
as well as self description copy setChildren to get a
container. But no luck.
Any help is appreciated. thanks,
I'm dealing now quite a bit of time with Magritte to do a
web application. It took a while to get into Magritte and
I'm not sure how much I've grasped til now. But I'm quite
impressed by the power of Magritte. It seems to be customiz-
able at the right places which distinguishes it from others.
At the moment I'm refactoring the code I hacked the last weeks.
I have a few questions about best practice patterns using
Magritte. For the demo, you have a model and you just need
any component, the case is quite easy. aModel asComponent
will do. But most of the tasks that have to be done for a
web application aren't that trivial. You need to have a
customized layout (which can be very complex), you need your
own components etc.
For customization I put every little bit in a wrapper class
around the generated Magritte component. This is for customizing
the generated component as well as to do some manual html if
it isn't avoidable. I have the feeling that this is not the
right way to do but I have no better idea. To minimize the effort
to do a component for a model component I've built a base class
which should ease the customization of the component. The parameters
for the base component are:
This is a symbol which is invoke on the model if you need a subset
of the descriptions. The default value is #description
The visitor which is used to render the component
A Collection of Associations (button label -> selector). MAForm-
Decoration is only useful if you have save and cancel buttons. As the
selectors are performed on the MAContainerComponent there is no way of
extending it. I extendend MAFormDecoration to have associations for
buttons (to distinguish the button label and the selector to use) and
to be created with a delegator. The selector is than performed on the
delegate which leads to a usage form
(WHFormDecoration delegate: self)
buttons: #( #ok -> commit. #abbrechen -> abort)
There are three choices:
* no validation
* validation by MAValidationDecoration (or similar)
I must confess that I never understood processChildCallbacks.
* manual validation and error handling
Using the form
[self component validate]
do: [:anException | self exception: anException].
Having a wrapper component I need to process answer in the wrapper.
This can be customized by defining answerBlock. Default value is
self component onAnswer: (
answerBlock ifNil: [
[:anAnswer | self answer: anAnswer]
I'm mimicking the behaviour in MAElementComponent having
renderViewerOn:/renderEditorOn:. This is a good way to switch a
component between readonly and readwrite mode. In my case the layout
of the component is completely different between those two modes. So
I use two different renderers for readonly and for readwrite mode.
- really complex layout cases
I have one case where it is necessary to put css classes to some of
the components of a form. The best way I found so far (being dirty)
is to use propertyAt:put: at description level and use this in a
So far so good. I like to hear your oppions and experiences doing this
kind of stuff.
Another problem I have no solution til now is the mixture of models into
one component. Sometimes you build your data model and then page layout
forces you to edit two objects at the same time. I have no problem to
mix descriptions in a desired way. But by invoking asComponentOn: they
would have all the same model which is wrong for a subset of the
descriptions. Is there any clever way to mix descriptions, set the model
accordingly and then produce the component?
thanks in advance,