MAPictureDescription missing from Magritte???

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

MAPictureDescription missing from Magritte???

John Chludzinski
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

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: MAPictureDescription missing from Magritte???

Lukas Renggli
Hi John,

MAFileDescription used to display the uploaded image in earlier
versions. I changed that to simply put a link for various reasons.
There are many different ways to display a picture, sometimes
applications need to add special tooltips, make them clickable or
resize and convert them to a special format.

> I assume I'll need to add these classes (MAPictureDescription +
> MAPictureComponent) to Magritte?  ----John

That would be a possibility, if you need some sophisticated meta
capabilities on pictures. For me I mostly went with the
MAFileDescription:

   descriptionPicture
      ^ MAFileDescription new
         accessor: #picture;
         addCondition: [ :file | file isImage ];
         componentClass: MAPictureComponent;
         yourself

The condition ensures that only images can be uploaded. The component
class changes the default view to a custom subclass of MAFileComponent
that automatically resizes and displays the picture.

If you want to contribute an MAPictureComponent I am sure some people
would be interested to use such a plugin. However I doubt that it is
possible to write it in a platform independent way, so that it could
be part of Magritte-Seaside.

Btw, there is a special mailing-list for Magritte, see
<http://www.lukas-renggli.ch/smalltalk/magritte>.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: MAPictureDescription missing from Magritte???

John Chludzinski
In reply to this post by 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
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: MAPictureDescription missing from Magritte???

Julian Fitzell-2
He was referring, I think, to Squeak vs. GemStone vs. VisualWorks vs.
Gnu vs. Dolphin (and so on).

Julian

On Mon, Jun 8, 2009 at 3:42 PM, John
Chludzinski<[hidden email]> wrote:

> 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
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: MAPictureDescription missing from Magritte???

Lukas Renggli
In reply to this post by John Chludzinski
> !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
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside