Hi, I'm pretty new to seaside, and it's only parttime, but well, I'm
anyway trying to implement some sort of AMChartsComponent (www.amcharts.com) (I find it nicer and better than PlotKit) It should't be tricky, however, two things are making my process very slow: I have the flash component rendered already, with some javascript code to configure it, however, one of the arguments I need to supply to a javascript call is a URL to an XML file. Maybe I can make this XML file be static, and then use AMChartsLibrary / #something, but maybe I need to dynamically create this XML, and hence I want to have some sort of callback: mechanism, so Seaside creates a dynamic URL, and the block answers with the XML. My question is, how do I create a component like this? suppose my renderContentOn: today looks something like: html script: 'doSomethingRequiringURL("http://localhost/seaside/blah");' I guess I could somehow turn it into: html script: 'doSomethingRequiringURL(', (AMChartLibrary / #lahpreparedXML) asJavascript, ');' but I'd really like to do something more like html amchart settings: [:xml | xml blah...] for example. And then, inside this XML there is another URL, that points to the data source to plot. I'm still not sure how the interface to all this will look like, but I certainly want this URL to again, be generated dinamically. so, a couple of questions. . How do I create a component that uses something like the callback mechanism? (how do I get seaside to generate the URL for me and do all its magic) . Do you have any design ideas on how I should better implement this? I guess I'll try to follow how PlotKit is used, so the interfaces to the two are somehow compatible. Right now I only want a quick hack, but eventually, if this finally works and I somehow like it, I'll contribute it... of course, if somebody has already done it, I'm more than willing to reuse :) thanks! richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
2008/11/21 Gerardo Richarte <[hidden email]>:
> Hi, I'm pretty new to seaside, and it's only parttime, but well, I'm anyway > trying to implement some sort of AMChartsComponent (www.amcharts.com) (I > find it nicer and better than PlotKit) > > It should't be tricky, however, two things are making my process very slow: > > I have the flash component rendered already, with some javascript code to > configure it, however, one of the arguments I need to supply to a javascript > call is a URL to an XML file. Maybe I can make this XML file be static, and > then use AMChartsLibrary / #something, but maybe I need to dynamically > create this XML, and hence I want to have some sort of callback: mechanism, > so Seaside creates a dynamic URL, and the block answers with the XML. My > question is, how do I create a component like this? suppose my > renderContentOn: today looks something like: > > html script: 'doSomethingRequiringURL("http://localhost/seaside/blah");' > > I guess I could somehow turn it into: > > html script: 'doSomethingRequiringURL(', (AMChartLibrary / #lahpreparedXML) > asJavascript, ');' > > but I'd really like to do something more like > > html amchart > settings: [:xml | xml blah...] > > for example. > > And then, inside this XML there is another URL, that points to the data > source to plot. I'm still not sure how the interface to all this will look > like, but I certainly want this URL to again, be generated dinamically. > > so, a couple of questions. > > . How do I create a component that uses something like the callback > mechanism? (how do I get seaside to generate the URL for me and do all its > magic) > . Do you have any design ideas on how I should better implement this? I > guess I'll try to follow how PlotKit is used, so the interfaces to the two > are somehow compatible. > > Right now I only want a quick hack, but eventually, if this finally works > and I somehow like it, I'll contribute it... of course, if somebody has > already done it, I'm more than willing to reuse :) What you're about to do is pretty advanced in terms of Seaside use. You'll be confronted with implementation details that the normal component developer never comes in contact with. You have more or less four choices what you can subclass: WAComponent, WATask, WACompound or building your own factory like Scriptaculous (or JQuery). WACompound isn't really an official public class and is merely used for implementation of WADateInput and WATimeInput. However if you want your classes to be used through the html canvas you have to use WACompound because WAComponent and WATask instances have to be reachable through #children or #call:. WAComponent and WATask have state that persists over multiple requests. They can very well take a block and evaluate it at some given time. For building XML consider making your own canvas. Have a look at RSRSS for an example. A possible quick hack could look like this: WAComponent subclass: #ChartComponent instanceVariableNames: 'settingsBlock' settingsBlock: aNoArgumentBlock settingsBlock := aNoArgumentBlock callbackUrlFor: aNoArgumentBlock using: aCanvas ^aCanvas context actionUrl copy addParameter: (aCanvas callbacks registerActionCallback: aNoArgumentBlock) settingsXml self session returnResponse: (WAResponse document: (SettingsCanvas builder fullDocument: true; render: settingsBlock)) mimeType: 'text/xml') renderContentOn: html html script: 'doSomethingRequiringURL(', self callbackUrlFor: [ self settingsXml ]');' While probably not the nicest implementation it should be enough to get you started. PlotKit sends all the data to the client in the JavaScript, not callbacks are made or supported. PlotKit also uses components and not compounds. Other places where you can look for inspiration are Scriptaculous (generates XML and JS dynamically for the client, can be used through the html canvas) and Sextant (SVG with callbacks). AFAIK DabbleDB uses flash for at least some of their charts so maybe they can help you as well. Cheers Philippe _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Philippe Marschall wrote:
> What you're about to do is pretty advanced in terms of Seaside use. > You'll be confronted with implementation details that the normal > component developer never comes in contact with. > > heh, I hope to manage :) > renderContentOn: html > html script: 'doSomethingRequiringURL(', self callbackUrlFor: > [ self settingsXml ]');' > thanks a lot, I think this'll give me a kick start. > PlotKit sends all the data to the client in the JavaScript, not > callbacks are made or supported. PlotKit also uses components and not > compounds. > yeah, I noticed. But this flash component I'm trying to use loads stuff from a URL (and in the meantime it puts a nice "loading" message). My dataset is large, so I prefer this other approach. Now, I found another way to do it, and I don't need to generate the configuration XML in a callback anymore, but I still want a callback for the data itself. I'll try to manage with your example. > Other places where you can look for inspiration are Scriptaculous > (generates XML and JS dynamically for the client, can be used through > the html canvas) and Sextant (SVG with callbacks). > Yeah, I dived into its code, but got lost quite quickly :( > AFAIK DabbleDB uses flash for at least some of their charts so maybe > they can help you as well. > uhm... interesting idea. I'll take a look, the do have a few controls that look like what I want to do. Thanks for the ideas. richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
You might want to take a look at a very similar implementation of
FusionCharts I did a while ago. The fileout is quite old and the implementation evolved substantially internally and sharing that might be a bit of an issue, but it should certainly show you enough to get started. http://www.fusioncharts.com/ They aren't free, but that's what DabbleDB is using, I believe. -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 http://tinyurl.com/r7uw4 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Gerardo Richarte Sent: Monday, November 24, 2008 9:43 AM To: Seaside - general discussion Subject: Re: [Seaside] Creating a component that requires a callback: Philippe Marschall wrote: > What you're about to do is pretty advanced in terms of Seaside use. > You'll be confronted with implementation details that the normal > component developer never comes in contact with. > > heh, I hope to manage :) > renderContentOn: html > html script: 'doSomethingRequiringURL(', self callbackUrlFor: > [ self settingsXml ]');' > thanks a lot, I think this'll give me a kick start. > PlotKit sends all the data to the client in the JavaScript, not > callbacks are made or supported. PlotKit also uses components and not > compounds. > yeah, I noticed. But this flash component I'm trying to use loads stuff from a URL (and in the meantime it puts a nice "loading" message). My dataset is large, so I prefer this other approach. Now, I found another way to do it, and I don't need to generate the configuration XML in a callback anymore, but I still want a callback for the data itself. I'll try to manage with your example. > Other places where you can look for inspiration are Scriptaculous > (generates XML and JS dynamically for the client, can be used through > the html canvas) and Sextant (SVG with callbacks). > Yeah, I dived into its code, but got lost quite quickly :( > AFAIK DabbleDB uses flash for at least some of their charts so maybe > they can help you as well. > uhm... interesting idea. I'll take a look, the do have a few controls that look like what I want to do. Thanks for the ideas. richie _______________________________________________ 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-FusionCharts.st (19K) Download Attachment |
Boris Popov wrote:
> You might want to take a look at a very similar implementation of > FusionCharts I did a while ago. thanks a lot!!! I'll get back to you with news :) richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Boris Popov, DeepCove Labs (SNN)
hi Boris,
from your code: (URL encode: (canvas mooCallback: [:render | ... I think that's exactly what I'm looking for, but I don't have the class URL, nor the method mooCallback: :-( any hints? I guess I'm missing some components, sorry for the stupid question :( richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
It's a helper method that creates a generic action callback that will
render a response. I have Seaside-Mootools loaded so I guess that code makes use of it, but it's not really specific to (or even dependent on) MooTools per se. -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 http://tinyurl.com/r7uw4 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Gerardo Richarte Sent: Monday, November 24, 2008 11:35 AM To: Seaside - general discussion Subject: Re: [Seaside] Creating a component that requires a callback: hi Boris, from your code: (URL encode: (canvas mooCallback: [:render | ... I think that's exactly what I'm looking for, but I don't have the class URL, nor the method mooCallback: :-( any hints? I guess I'm missing some components, sorry for the stupid question :( richie _______________________________________________ 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 |
Free forum by Nabble | Edit this page |