Wrapping ProtoTip

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

Wrapping ProtoTip

Yar Hwee Boon-3
I am wrapping around ProtoTip [1] by implementing SUTip as a subclass
of SUNamed. And need some help.

One of the parameters is a piece of HTML, e.g.:

      new Tip('myElementId', '<em>Italics here</em>');


Following the spirit of the SU* classes, I can do:

     html script: (html tip id: 'myElementId';
                         content: '<em>Italics here</em>')


How do I use the canvas object, such as:

     html script: (html tip id: 'myElementId';
                         content: [:h | h em: 'Italics here']


[1] http://www.nickstakenburg.com/projects/prototip/

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

Re: Wrapping ProtoTip

Lukas Renggli
>  How do I use the canvas object, such as:
>
>      html script: (html tip id: 'myElementId';
>                          content: [:h | h em: 'Italics here']

Have a look at SUElement>>#update:, #insert:, #replace:, ...

These methods all use the canvas to generate some XHTML string as a
parameter to a JavaScript function.

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: Wrapping ProtoTip

Yar Hwee Boon-3
On Wed, Mar 5, 2008 at 2:35 PM, Lukas Renggli <[hidden email]> wrote:

>  Have a look at SUElement>>#update:, #insert:, #replace:, ...

I'm probably doing it wrongly, but in a attempt to debug, I change my
SUTip>>content to:

    Transcript
                nextPutAll: (String
                                streamContents: [:stream | self render: aBlock on: stream]);
                 endEntry.


Then I can see in the transcript that what's printed is the XHTML
string which I have generated (great). followed by some SU* related
javascript from a previous use of SUAutocompleter:

<span>test4</span><script type="text/javascript">/*<![CDATA[*/new
Ajax.Autocompleter('query','id6','http://localhost:8081/seaside/sfe',{'afterUpdateElement':function(){new
Ajax.Request('http://localhost:8081/seaside/sfe',{'parameters':['_s=QkGrWpbTSpLBRefB','_k=CXCQlzYF','5',$('query').serialize()].join('&')})},'evalScripts':true,'parameters':['_s=QkGrWpbTSpLBRefB','_k=CXCQlzYF','4'].join('&')})/*]]>*/</script>


<span>test4</span> alone is what I am expecting. Any suggestion on
what I am doing wrongly? Thanks again.

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

Re: Wrapping ProtoTip

Adrian Lienhard
Hi,

We integrated Prototip some time ago (but never really used it).
I committed the package, TTPrototip-al.3.mcz, to this project:

http://www.squeaksource.com/Seaside29Addons.html

HTH,
Adrian

On Mar 5, 2008, at 09:53 , Hwee-Boon Yar wrote:

> On Wed, Mar 5, 2008 at 2:35 PM, Lukas Renggli <[hidden email]>  
> wrote:
>
>> Have a look at SUElement>>#update:, #insert:, #replace:, ...
>
> I'm probably doing it wrongly, but in a attempt to debug, I change my
> SUTip>>content to:
>
>   Transcript
> nextPutAll: (String
> streamContents: [:stream | self render: aBlock on: stream]);
> endEntry.
>
>
> Then I can see in the transcript that what's printed is the XHTML
> string which I have generated (great). followed by some SU* related
> javascript from a previous use of SUAutocompleter:
>
> <span>test4</span><script type="text/javascript">/*<![CDATA[*/new
> Ajax.Autocompleter('query','id6','http://localhost:8081/seaside/sfe',
> {'afterUpdateElement':function(){new
> Ajax.Request('http://localhost:8081/seaside/sfe',{'parameters':
> ['_s=QkGrWpbTSpLBRefB','_k=CXCQlzYF','5',$
> ('query').serialize()].join('&')})},'evalScripts':true,'parameters':
> ['_s=QkGrWpbTSpLBRefB','_k=CXCQlzYF','4'].join('&')})/*]]>*/</script>
>
>
> <span>test4</span> alone is what I am expecting. Any suggestion on
> what I am doing wrongly? Thanks again.
>
> --
> Hwee-Boon
> _______________________________________________
> 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: Wrapping ProtoTip

Yar Hwee Boon-3
On Wed, Mar 5, 2008 at 5:49 PM, Adrian Lienhard <[hidden email]> wrote:
> Hi,
>
>  We integrated Prototip some time ago (but never really used it).
>  I committed the package, TTPrototip-al.3.mcz, to this project:

It looks like #content: takes a static string?

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

Re: Wrapping ProtoTip

Lukas Renggli
In reply to this post by Yar Hwee Boon-3
> I'm probably doing it wrongly, but in a attempt to debug, I change my
>  SUTip>>content to:
>
>     Transcript
>                 nextPutAll: (String
>                                 streamContents: [:stream | self render: aBlock on: stream]);
>                  endEntry.

You could just use #render:

>  <span>test4</span> alone is what I am expecting. Any suggestion on
>  what I am doing wrongly? Thanks again.

That looks like a bug somewhere ... maybe in Scriptaculous, maybe in
your own code.

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: Wrapping ProtoTip

John Thornborrow
In reply to this post by Yar Hwee Boon-3
Hi,

See attached file for SUTooltip class.

Don't forget to add #tooltip method to WARenderCanvas:

tooltip
  ^SUTooltip new


Usage example:

renderContentOn: html
  html div
    onMouseOver: (html tooltip content: [ :ren | ren strong: 'strong
text' ]);
    with: 'other text'


Not tested for things like quotes in the content.
HTH

Regards,
John.

www.pinesoft.co.uk

Hwee-Boon Yar wrote:

> I am wrapping around ProtoTip [1] by implementing SUTip as a subclass
> of SUNamed. And need some help.
>
> One of the parameters is a piece of HTML, e.g.:
>
>       new Tip('myElementId', '<em>Italics here</em>');
>
>
> Following the spirit of the SU* classes, I can do:
>
>      html script: (html tip id: 'myElementId';
> content: '<em>Italics here</em>')
>
>
> How do I use the canvas object, such as:
>
>      html script: (html tip id: 'myElementId';
> content: [:h | h em: 'Italics here']
>
>
> [1] http://www.nickstakenburg.com/projects/prototip/
>

Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com


SUPrototype subclass: #SUTooltip
        instanceVariableNames: 'content'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Tooltip'!

!SUTooltip methodsFor: 'private' stamp: 'jmt 3/5/2008 11:59'!
defaultPrototype
        ^'new Tip'! !

!SUTooltip methodsFor: 'private' stamp: 'jmt 3/5/2008 11:57'!
printArgumentsOn: aStream
        aStream
                nextPutAll: '(this,''';
                nextPutAll: (WARenderCanvas builder render: content);
                nextPutAll: ''')'.! !


!SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
content
        "Answer the value of content"

        ^ content! !

!SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
content: anObject
        "Set the value of content"

        content := anObject! !

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

Re: Wrapping ProtoTip

Lukas Renggli
>  !SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
>  content: anObject
>         "Set the value of content"
>
>         content := anObject! !

Shouldn't this be

         content := self render: anObject

?

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: Wrapping ProtoTip

John Thornborrow
No, DNU SUTooltip>>render: is raised if that were to be the case. I
admit I got lazy with the accessors and variable names.

John

Lukas Renggli wrote:

>>  !SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
>>  content: anObject
>>         "Set the value of content"
>>
>>         content := anObject! !
>
> Shouldn't this be
>
>          content := self render: anObject
>
> ?
>
> Lukas
>


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

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

Re: Wrapping ProtoTip

John Thornborrow
In reply to this post by Lukas Renggli
I also forgot to mention that anyone who uses this class will need to
include their own file library for the Tooltip JS code.

John

Lukas Renggli wrote:

>>  !SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
>>  content: anObject
>>         "Set the value of content"
>>
>>         content := anObject! !
>
> Shouldn't this be
>
>          content := self render: anObject
>
> ?
>
> Lukas
>


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

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

Re: Wrapping ProtoTip

Lukas Renggli
> I also forgot to mention that anyone who uses this class will need to
>  include their own file library for the Tooltip JS code.

This means it works now? Or is it a bug report?

Would it be possible to publish the mcz?

Lukas

>
>
>  John
>
>
>  Lukas Renggli wrote:
>  >>  !SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
>  >>  content: anObject
>  >>         "Set the value of content"
>  >>
>  >>         content := anObject! !
>  >
>  > Shouldn't this be
>  >
>  >          content := self render: anObject
>  >
>  > ?
>  >
>  > Lukas
>  >
>
>
>
> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>
>
>
>  This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
>
>
> _______________________________________________
>  seaside mailing list
>  [hidden email]
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
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: Wrapping ProtoTip

John Thornborrow
The class SUTooltip is not part of any package (that I know of) as I
just created it this morning :)

The "Tooltip JS code" is the Prototip library file needed to create
Tooltips[1]. SUTooltip will only write "new Tip(this, '<content set
within the content block>')"  it will not write the Tip JS definition,
nor the extra options available to Prototip.

I didn't want to submit/publish anything as of yet, as there is a lot
more functionality available from Prototip than what is included in
SUTooltip, and this was only meant as a demonstration of creating a
widget with a render block as Hwee-Boon Yar asked.

1. http://www.nickstakenburg.com/projects/prototip/

Regards,
John.

Lukas Renggli wrote:

>> I also forgot to mention that anyone who uses this class will need to
>>  include their own file library for the Tooltip JS code.
>
> This means it works now? Or is it a bug report?
>
> Would it be possible to publish the mcz?
>
> Lukas
>
>>
>>  John
>>
>>
>>  Lukas Renggli wrote:
>>  >>  !SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
>>  >>  content: anObject
>>  >>         "Set the value of content"
>>  >>
>>  >>         content := anObject! !
>>  >
>>  > Shouldn't this be
>>  >
>>  >          content := self render: anObject
>>  >
>>  > ?
>>  >
>>  > Lukas
>>  >
>>
>>
>>
>> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>>
>>
>>
>>  This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
>>
>>
>> _______________________________________________
>>  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: Wrapping ProtoTip

Lukas Renggli
Now I understand why you end up with these scripts in the string. This
is indeed a bug in Scriptaculous.

http://code.google.com/p/seaside/issues/detail?id=25

Lukas

On 3/5/08, John Thornborrow <[hidden email]> wrote:

> The class SUTooltip is not part of any package (that I know of) as I
>  just created it this morning :)
>
>  The "Tooltip JS code" is the Prototip library file needed to create
>  Tooltips[1]. SUTooltip will only write "new Tip(this, '<content set
>  within the content block>')"  it will not write the Tip JS definition,
>  nor the extra options available to Prototip.
>
>  I didn't want to submit/publish anything as of yet, as there is a lot
>  more functionality available from Prototip than what is included in
>  SUTooltip, and this was only meant as a demonstration of creating a
>  widget with a render block as Hwee-Boon Yar asked.
>
>
>  1. http://www.nickstakenburg.com/projects/prototip/
>
>
> Regards,
>
> John.
>
>
>  Lukas Renggli wrote:
>  >> I also forgot to mention that anyone who uses this class will need to
>  >>  include their own file library for the Tooltip JS code.
>  >
>  > This means it works now? Or is it a bug report?
>  >
>  > Would it be possible to publish the mcz?
>  >
>  > Lukas
>  >
>  >>
>  >>  John
>  >>
>  >>
>  >>  Lukas Renggli wrote:
>  >>  >>  !SUTooltip methodsFor: 'accessing' stamp: 'jmt 3/5/2008 11:58'!
>  >>  >>  content: anObject
>  >>  >>         "Set the value of content"
>  >>  >>
>  >>  >>         content := anObject! !
>  >>  >
>  >>  > Shouldn't this be
>  >>  >
>  >>  >          content := self render: anObject
>  >>  >
>  >>  > ?
>  >>  >
>  >>  > Lukas
>  >>  >
>  >>
>  >>
>  >>
>  >> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>  >>
>  >>
>  >>
>  >>  This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
>  >>
>  >>
>  >> _______________________________________________
>  >>  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
>


--
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: Wrapping ProtoTip

Gerhard Obermann
In reply to this post by Adrian Lienhard
Hi!
 
Thanks a lot Adrian, its now fully integrated :) !
 
http://www.squeaksource.com/Seaside29Addons.html

Name: ScriptaculousAddOns-obi.9
Author: obi
Time: 5 March 2008, 9:38:23 pm
UUID: f6f9f9a0-306b-654c-b211-8b5a14cc4bc4
Ancestors: ScriptaculousAddOns-obi.8

Full integration of Prototip (thanks to Adrian)
 - fixed some issues
 - added new tests
 - newest version of prototip
 - using now compressed version
 - Integration into other addOn Tests
 



 
2008/3/5, Adrian Lienhard <[hidden email]>:
Hi,

We integrated Prototip some time ago (but never really used it).
I committed the package, TTPrototip-al.3.mcz, to this project:

http://www.squeaksource.com/Seaside29Addons.html

HTH,
Adrian

On Mar 5, 2008, at 09:53 , Hwee-Boon Yar wrote:

> On Wed, Mar 5, 2008 at 2:35 PM, Lukas Renggli <[hidden email]>
> wrote:
>
>> Have a look at SUElement>>#update:, #insert:, #replace:, ...
>
> I'm probably doing it wrongly, but in a attempt to debug, I change my
> SUTip>>content to:
>
>   Transcript
>               nextPutAll: (String
>                               streamContents: [:stream | self render: aBlock on: stream]);
>                endEntry.
>
>
> Then I can see in the transcript that what's printed is the XHTML
> string which I have generated (great). followed by some SU* related
> javascript from a previous use of SUAutocompleter:
>
> <span>test4</span><script type="text/javascript">/*<![CDATA[*/new
> Ajax.Autocompleter('query','id6','http://localhost:8081/seaside/sfe',
> {'afterUpdateElement':function(){new
> Ajax.Request('<a href="http://localhost:8081/seaside/sfe&#39;,{&#39;parameters">http://localhost:8081/seaside/sfe',{'parameters':
> ['_s=QkGrWpbTSpLBRefB','_k=CXCQlzYF','5',$
> ('query').serialize()].join('&')})},'evalScripts':true,'parameters':
> ['_s=QkGrWpbTSpLBRefB','_k=CXCQlzYF','4'].join('&')})/*]]>*/</script>
>
>
> <span>test4</span> alone is what I am expecting. Any suggestion on
> what I am doing wrongly? Thanks again.
>
> --
> Hwee-Boon
> _______________________________________________
> 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


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside