Re: MAPictureDescription missing from Magritte???

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

Re: MAPictureDescription missing from Magritte???

John Chludzinski
Lukas, not quite certain what you meant by: "However, I doubt that it
is possible to write it in a platform independent way ..."?  The
platform is the browser; so are you saying it would be browser
specific?  In what way?  (The beginning of this thread was started on
[hidden email].)

BTW,  I made some mods to some classes to support pictures:

MAFileUploadComponent subclass: #MMAPicFileUploadComponent
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'MMAApp'!


!MMAPicFileUploadComponent methodsFor: 'rendering' stamp: 'jtc 6/8/2009 17:44'!
renderEditorOn: html

        self value isNil
                ifFalse: [
                        html table: [
                                html tableRow: [
                                        html image
                                                id: 'XXX';
                                                document: self value contents mimeType: self value mimetype].
                                html tableRow: []]].

        self isMultipart
                ifTrue: [ self renderUploadOn: html ]
                ifFalse: [ self renderRemoveOn: html ]! !


<<<<<<<<<<<<<<<<<<This will put the picture in the
editor>>>>>>>>>>>>>>>>>>>>>>>>>


MAFileDescription subclass: #MMAImageFileDescription
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'MMAApp'!

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

MMAImageFileDescription class
        instanceVariableNames: ''!

!MMAImageFileDescription class methodsFor: 'as yet unclassified'
stamp: 'jtc 6/8/2009 16:29'!
defaultReportColumnClasses

        ^ Array with: MMADescribedImageColumn! !


MADescribedColumn subclass: #MMADescribedImageColumn
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'MMAApp'!

!MMADescribedImageColumn methodsFor: 'as yet unclassified' stamp: 'jtc
6/8/2009 18:21'!
renderCellContent: anObject on: html

        | myValue |

        myValue _ (self valueFor: anObject).
                "myValue contents class asString displayAt: 0@40."

        (myValue isNil or: [myValue contents isEmpty]) ifTrue: [
                ^html render: (self formatter value: myValue)].

        html image
                id: 'XXX';
                document: myValue contents mimeType: myValue mimetype
! !

<<<<<<<<<<<<<<<<<<This will put the picture in the
report>>>>>>>>>>>>>>>>>>>>>>>>>


---John


On Fri, Jun 5, 2009 at 6:17 PM, John Chludzinski
<[hidden email]> wrote:
>
> After searching about I've come to the conclusion that Magritte is missing MAPictureDescription + MAPictureComponent classes.  I would like to have a passport ilk pictures appear in Magritte generated reports and editors for users of a system by defining a #descriptionPicture class-side method for a system-user class.  Not that easy!
>
> I assume I'll need to add these classes (MAPictureDescription + MAPictureComponent) to Magritte?  ----John

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

Re: [Seaside] Re: MAPictureDescription missing from Magritte???

Lukas Renggli
> !MMAImageFileDescription class methodsFor: 'as yet unclassified'
> stamp: 'jtc 6/8/2009 16:29'!
> defaultReportColumnClasses
>
>        ^ Array with: MMADescribedImageColumn! !

That subclass is not really necessary, because you can reconfigure any
description instance to use your customized view:

    MAFileDescription new
        reportColumnClass: MMADescribedImageColumn;
        componentClass: MADescribedImageComponent;
        ....

>        html image
>                id: 'XXX';
>                document: myValue contents mimeType: myValue mimetype

Something like this used to be part of Magritte. However, your table
or form will "explode" if you upload a typical 12 MB picture ;-)

I guess to make this really useable you need some code to resize the
picture accordingly. And this is unfortunately not possible on
different Smalltalk dialects in a platform independent way.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki