Yeah, I'm not sure what the best solution is going to be on plugins.
The naive way I've approached this problem so far was by creating:
trait FlotPlugin {
val pluginFile: String
}
and then creating objects that extended that with the name of the plugin file:
object FlotSelection extends FlotPlugin {
val pluginFile = "jquery.flot.selection.js"
}
Then I added a new var and a new init method inside the Flot object
var plugins: List[FlotPlugin] = Nil
def init(fp: FlotPlugin*) {
plugins = fp.toList
init()
plugins.foreach{ p =>
ResourceServer.allow({
case "flot" :: p.pluginFile :: Nil => true
})
}
}
And I also added a for loop into the renderHead method to yield a
script include for each plugin that was in the plugins List of the
Flot object. That way, I could at least choose in my Boot.scala which
plugins I wanted to initialize in my project by calling
Flot.init(FlotSelection).
Ideally, it would be cool if you would define a FlotCapability as
needing a particular FlotPlugin and then use some method inside of
Flot.init to lookup all the FlotCapabilities that you've declared in
your project and then initialize the plugins based on that list. I'm
not sure if there's a good way to do that outside of using reflection
though as I'm not too familiar with the Lift initialization process.
- Aaron
On Fri, Feb 5, 2010 at 3:22 PM, Peter Robinett <[email protected]> wrote:
> Hi Aaron,
>
> I just added hoverable to my branch. Please let me know if you have
> any issues with it.
>
> As for plugins, I think it might take a little thinking to get right.
> Looking at the Flot plugin documentation (http://flot.googlecode.com/
> svn/trunk/PLUGINS.txt), a plugin registers itself by calling
> $.plot.plugins.push(pluginDefinitionObject). I think we could have a
> generic plugin trait and make individual instances for each specific
> plugin which would implement the minimum possible, which may simply be
> including the plugin javascript file on the page.
>
> However, including the plugin Javascript files could be tricky.
> Flot.init in boot.scala could be aggressive about including as many
> plugin files as possible, but that's not a particularly elegant way.
> However, including them elsewhere, for example as part of the
> Flot.render, would make uses like calling Flot.render in a CometActor
> tricky.
>
> Finally, I notice that plugins are allowed to add their own options to
> the new series option object we've been discussing. Because by their
> nature we can't anticipate all options, it may make sense that the
> series object should be some sort of Map.
>
> What do people think?
>
> Peter
>
> On Feb 5, 6:13 am, Aaron Valade <[email protected]> wrote:
>> Looks great!
>>
>> One little nit is, could we add the "hoverable" option to
>> FlotGridOptions? That's a new feature which was added to Flot which
>> shouldn't break backwards compatibility.
>>
>> Any thoughts about integrating plugins as the zooming and FlotOverview
>> class don't work without the selecting plugin.
>>
>> - A
>>
>>
>>
>> On Thu, Feb 4, 2010 at 7:56 PM, Peter Robinett <[email protected]>
>> wrote:
>> > Hi Aaron,
>>
>> > I've pushed the simplest update possible to my branch here:
>> >http://github.com/dpp/liftweb/tree/pr1001_issue_322. I will make the
>> > series options change if there are no significant dissenting voices in
>> > the thread I created[1]. In the meantime, do. The flotDemo app seems
>> > to work without any changes.
>>
>> > What do you think?
>>
>> > Peter
>>
>> > [1]:http://groups.google.com/group/liftweb/t/ba7e0f76042ff562
>>
>> > On Feb 3, 6:30 am, Aaron Valade <[email protected]> wrote:
>> >> I've created a ticket here:
>>
>> >>http://github.com/dpp/liftweb/issues/issue/322
>>
>> >> Thanks again!
>> >> - Aaron
>>
>> >> On Tue, Feb 2, 2010 at 10:10 PM, Peter Robinett <[email protected]>
>> >> wrote:
>> >> > You're welcome. I'm happy to look into adding Flot plugin support, but
>> >> > please open a ticket on GitHub (http://github.com/dpp/liftweb/issues).
>>
>> >> > Peter
>>
>> >> > On Feb 1, 10:22 am, Aaron Valade <[email protected]> wrote:
>> >> >> Thanks Peter!
>>
>> >> >> One of the other things that changed between Flot 0.4 and 0.6 is that
>> >> >> a plugin structure was introduced and some functionality was pushed
>> >> >> out of the core and into a plugin, specifically the selection
>> >> >> functionality which can be used for zooming and other interactions
>> >> >> with the charted data. I hate to tack on requests for more work, but
>> >> >> if you get a chance, I'd appreciate if you could add functionality to
>> >> >> the Lift Flot Widget to allow use of these plugins. I'm in the process
>> >> >> of making some small changes with the Flot Widget to support these
>> >> >> plugins in my local fork of Lift and would be happy to share what I've
>> >> >> done, if that's allowed. Otherwise, I'd be very eager to provide
>> >> >> additional testing of any capabilities that you make available or any
>> >> >> other help that I can provide within the guidelines of the Lift
>> >> >> project.
>>
>> >> >> Thanks,
>> >> >> - A
>>
>> >> >> On Mon, Feb 1, 2010 at 12:28 PM, Peter Robinett
>> >> >> <[email protected]> wrote:
>> >> >> > Ok guys, I'll work on this in the next few days (I'm out of town
>> >> >> > right
>> >> >> > now).
>>
>> >> >> > Peter
>>
>> >> >> > On Jan 31, 3:20 pm, Timothy Perrett <[email protected]> wrote:
>> >> >> >> It seems like peter will take ownership of this and make it happen
>> >> >> >> ASAP so a patch / diff should not be needed.
>>
>> >> >> >> Peter, please confirm when you will roll this in a branch and put it
>> >> >> >> on review board?
>>
>> >> >> >> Cheers, Tim
>>
>> >> >> >> Sent from my iPhone
>>
>> >> >> >> On 31 Jan 2010, at 22:48, Aaron Valade <[email protected]> wrote:
>>
>> >> >> >> > I'm more than happy to submit the patch under the Lift IP policy,
>> >> >> >> > but I understand if you don't feel comfortable with that. And I
>> >> >> >> > can
>> >> >> >> > submit it anyway that works for you. I'm just looking to help give
>> >> >> >> > back to everyone that's helped me out. Albeit in a very, very
>> >> >> >> > small
>> >> >> >> > way.
>>
>> >> >> >> > Sent from my iPhone
>>
>> >> >> >> > On Jan 31, 2010, at 5:43 PM, David Pollak
>> >> >> >> > <[email protected]
>> >> >> >> > > wrote:
>>
>> >> >> >> >> Peter,
>>
>> >> >> >> >> Please keep in mind the Lift IP policy. We don't pull from other
>> >> >> >> >> repositories nor do we accept patches. We'll have to do the Flot
>> >> >> >> >> 0.6 ourselves.
>>
>> >> >> >> >> Thanks,
>>
>> >> >> >> >> David
>>
>> >> >> >> >> On Fri, Jan 29, 2010 at 4:44 PM, Peter Robinett
>> >> >> >> >> <[email protected]
>> >> >> >> >> > wrote:
>> >> >> >> >> Aaron, thanks so much for taking the initiative to upgrade Flot,
>> >> >> >> >> it's
>> >> >> >> >> something that I've been meaning to do. Just skimming over your
>> >> >> >> >> changes, everything looks good. As for not using the packed
>> >> >> >> >> excanvas
>> >> >> >> >> file, that should be ok since Lift runs the YUI compressor by
>> >> >> >> >> default
>> >> >> >> >> on all Javascript files (correct, David?). Of course, broken URLs
>> >> >> >> >> need
>> >> >> >> >> to be fixed.
>>
>> >> >> >> >> David, how do we go about merging these changes?
>>
>> >> >> >> >> Peter
>>
>> >> >> >> >> On Jan 29, 3:32 pm, Aaron Valade <[email protected]> wrote:
>> >> >> >> >> > There is one break that my commit made which I just realized
>> >> >> >> >> after I
>> >> >> >> >> > had sent this email in that I deleted the excanvas.pack.js
>> >> >> >> >> > file and
>> >> >> >> >> > dropped in the excanvas.js that was included with the Flot 0.6
>> >> >> >> >> > distribution but didn't rename it to be excanvas.pack.js and
>> >> >> >> >> > didn't
>> >> >> >> >> > change the path in the Flot.scala file.
>>
>> >> >> >> >> > I can make an additional commit that fixes this, if it pleases
>> >> >> >> >> the court. :-)
>>
>> >> >> >> >> > - A
>>
>> >> >> >> >> > On Fri, Jan 29, 2010 at 6:15 PM, David Pollak
>>
>> >> >> >> >> > <[email protected]> wrote:
>> >> >> >> >> > > Peter,
>>
>> >> >> >> >> > > What do you think of the upgrade (given that you're the most
>> >> >> >> >> Flot-ish Lift
>> >> >> >> >> > > committer)?
>>
>> >> >> >> >> > > Thanks,
>>
>> >> >> >> >> > > David
>>
>> >> >> >> >> > > On Fri, Jan 29, 2010 at 12:32 PM, Aaron Valade
>> >> >> >> >> <[email protected]> wrote:
>>
>> >> >> >> >> > >> Hello all,
>> >> >> >> >> > >> I needed to use some of the recent functionality in the Flot
>> >> >> >> >> jQuery
>> >> >> >> >> > >> plugin which is version 0.6. The Flot lift-widget is
>> >> >> >> >> currently at
>> >> >> >> >> > >> 0.4. So I upgraded it to use the new version and I've
>> >> >> >> >> > >> posted
>> >> >> >> >> the
>> >> >> >> >> > >> commit on github:
>>
>> >> >> >> >> > >>http://github.com/avalade/liftweb/commit/fa3d76fb72a7f74d13265e4039f0
>> >> >> >> >> ...
>>
>> >> >> >> >> > >> Version 0.6 of Flot does make one breaking change which
>> >> >> >> >> requires some
>> >> >> >> >> > >> of the options which were previously described as a top
>> >> >> >> >> > >> level
>> >> >> >> >> > >> attributes on the FlotOptions object to be pushed inside of
>> >> >> >> >> > >> a
>> >> >> >> >> new
>> >> >> >> >> > >> attribute called FlotSeriesOptions. I've made the
>> >> >> >> >> > >> appropriate
>> >> >> >> >> changes
>> >> >> >> >> > >> to the various example Flot charts which were included in
>> >> >> >> >> > >> the
>> >> >> >> >> flotDemo
>> >> >> >> >> > >> module.
>>
>> >> >> >> >> > >> Would it be possible to get this change upstream?
>>
>> >> >> >> >> > >> - Aaron
>>
>> >> >> >> >> > >> --
>> >> >> >> >> > >> You received this message because you are subscribed to the
>> >> >> >> >> Google Groups
>> >> >> >> >> > >> "Lift" group.
>> >> >> >> >> > >> To post to this group, send email to
>> >> >> >> >> > >> [email protected].
>> >> >> >> >> > >> To unsubscribe from this group, send email to
>> >> >> >> >> > >> [email protected].
>> >> >> >> >> > >> For more options, visit this group at
>> >> >> >> >> > >>http://groups.google.com/group/liftweb?hl=en.
>>
>> >> >> >> >> > > --
>> >> >> >> >> > > Lift, the simply functional web frameworkhttp://liftweb.net
>> >> >> >> >> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
>> >> >> >> >> > > Follow me:http://twitter.com/dpp
>> >> >> >> >> > > Surf the harmonics
>>
>> >> >> >> >> > > --
>> >> >> >> >> > > You received this message because you are subscribed to the
>> >> >> >> >> Google Groups
>> >> >> >> >> > > "Lift" group.
>> >> >> >> >> > > To post to this group, send email to
>> >> >> >> >> > > [email protected].
>> >> >> >> >> > > To unsubscribe from this group, send email to
>> >> >> >> >> > > [email protected].
>> >> >> >> >> > > For more options, visit this group at
>> >> >> >> >> > >http://groups.google.com/group/liftweb?hl=en.
>>
>> >> >> >> >> --
>> >> >> >> >> You received this message because you are subscribed to the
>> >> >> >> >> Google
>> >> >> >> >> Groups "Lift" group.
>> >> >> >> >> To post to this group, send email to [email protected].
>> >> >> >> >> To unsubscribe from this group, send email to
>> >> >> >> >> [email protected]
>> >> >> >> >> .
>> >> >> >> >> For more options, visit this group
>> >> >> >> >> athttp://groups.google.com/group/liftweb?hl=en
>> >> >> >> >> .
>>
>> >> >> >> >> --
>> >> >> >> >> Lift, the simply functional web frameworkhttp://liftweb.net
>> >> >> >> >> Beginning Scalahttp://www.apress.com/book/view/1430219890
>> >> >> >> >> Follow me:http://twitter.com/dpp
>> >> >> >> >> Surf the harmonics
>> >> >> >> >> --
>> >> >> >> >> You received this message because you are subscribed to the
>> >> >> >> >> Google
>> >> >> >> >> Groups "Lift" group.
>> >> >> >> >> To post to this group, send email to [email protected].
>> >> >> >> >> To unsubscribe from this group, send email to
>> >> >> >> >> [email protected]
>> >> >> >> >> .
>> >> >> >> >> For more options, visit this group
>> >> >> >> >> athttp://groups.google.com/group/liftweb?hl=en
>> >> >> >> >> .
>> >> >> >> > --
>> >> >> >> > You received this message because you are subscribed to the Google
>> >> >> >> > Groups "Lift" group.
>> >> >> >> > To post to this group, send email to [email protected].
>> >> >> >> > To unsubscribe from this group, send email to
>> >> >> >> > [email protected]
>> >> >> >> > .
>> >> >> >> > For more options, visit this group
>> >> >> >> > athttp://groups.google.com/group/liftweb?hl=en
>> >> >> >> > .
>>
>> >> >> > --
>> >> >> > You received this message because you are subscribed to the Google
>> >> >> > Groups "Lift" group.
>> >> >> > To post to this group, send email to [email protected].
>> >> >> > To unsubscribe from this group, send email to
>> >> >> > [email protected].
>> >> >> > For more options, visit this group
>> >> >> > athttp://groups.google.com/group/liftweb?hl=en.
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "Lift" group.
>> >> > To post to this group, send email to [email protected].
>> >> > To unsubscribe from this group, send email to
>> >> > [email protected].
>> >> > For more options, visit this group
>> >> > athttp://groups.google.com/group/liftweb?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Lift" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>>
>> ...
>>
>> read more »
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.