The only problem is I will have to recompile the whole framework along with the plugin which would at least take 5 - 10 minutesfor compiling. That would be too much to ask for from a enduser perspective.
On Fri, Mar 13, 2009 at 4:00 AM, Andreas Karlsson <[email protected]> wrote: > > Hi, > > What I (plan) to do is to automatically recompile the whole > application when a client-plugin is added. > > So I keep a plugin registry on the server side and when I enable/add a > plugin I generate some glue files and recompile + redeploy the whole > GWT-client automatically, this to get the most benefits from GWT > optimizations. > > Regards, > Andreas > > On Fri, Mar 13, 2009 at 10:38 AM, Rosh PR <[email protected]> wrote: > > For Drag and drop we use the SmartGWT. Will give a shot at your ideas. > > Thanks > > > > On Thu, Mar 12, 2009 at 10:39 PM, Vitali Lovich <[email protected]> > wrote: > >> > >> I'm pretty sure that you need an entry point to compile a module. My > >> abstract method approach should do it for you. > >> > >> The "obfuscated" code is just javascript which I explained to you how to > >> load. > >> > >> As for the drag and drop, just search up drag & drop on GWT - I'm pretty > >> sure there's support for it. > >> > >> > >> On Fri, Mar 13, 2009 at 12:38 AM, Rosh PR <[email protected]> wrote: > >>> > >>> Hi Matías & Vitali > >>> You are right about the Pointers > >>> a) Know what plugins exists, a registry of plugins > >>> b) Attach them into a panel, listen events and useful stuff > >>> > >>> We have exactly followed the same approach as you have mentioned > for > >>> installing the > >>> plugin into a directory & setting up a file with the list of plugins > >>> installed. > >>> But some of the issues I'm facing are > >>> * getting to compile a plugin without any entrypoint to Javascript. > >>> * Then the second biggest issue is getting the obfuscated code > loaded > >>> by the framework. > >>> * Even if i manage to load it using some of the options you have > >>> mentioned, The plugins should be able to interact > >>> be able to interact between them selfs like drag an object from > one > >>> plugin and drop it in to another. > >>> Are totally unaware of most of options mentioned by Vitali. I shall > give > >>> it a try. If you guys have any thing more > >>> solid and you feel it will work, Let me know about it. > >>> I think GWt should be coming up with some way we can load there > >>> Obfuscated code dynamically. > >>> Thanks a lot guys. > >>> > >>> On Fri, Mar 13, 2009 at 1:00 AM, Vitali Lovich <[email protected]> > wrote: > >>>> > >>>> Oh, and the RootPanel way of dynamically adding the plugin's > javascript > >>>> will probably only work in onModuleLoad. The DOM approach I gave > should > >>>> work at any time (i.e. as a response to user action). > >>>> > >>>> On Thu, Mar 12, 2009 at 3:21 PM, Vitali Lovich <[email protected]> > >>>> wrote: > >>>>> > >>>>> Uggh - sorry. Gmail decided to send the message for me. I've > >>>>> completed the class below. > >>>>> > >>>>> Anyways, plugins would extend PluginEntry. Again, your GWT would be > >>>>> reponsible for actually injecting the plugin javascript into your > page. Not > >>>>> sure what the GWT-preferred way would be, but in theory (I haven't > tried > >>>>> this out), you might be able to do a RootPanel.get().add(new > HTML("<script > >>>>> src='plugin/to/load'/>")), although I'd test it first (I highly doubt > this > >>>>> would work). > >>>>> > >>>>> A more explicit approach might be: > >>>>> > >>>>> Document dom = Document.get(); > >>>>> Element head = dom.getElementsByTagName("head").getItem(0); > >>>>> Element pluginScript = dom.createElement("script"); > >>>>> pluginScript.setPropertyString("src", "plugin.js"); > >>>>> pluginScript.setPropertyString("type", "text/javascript"); > >>>>> Document.appendChild(head, pluginScript); > >>>>> > >>>>> This should work (assuming the browser supports loading scripts added > >>>>> dynamically to the head element). I'd recommend testing this on > several > >>>>> browsers - I'm not sure which support it (although I suspect all of > the > >>>>> major ones). > >>>>> > >>>>> Good luck. > >>>>> > >>>>> On Thu, Mar 12, 2009 at 3:03 PM, Vitali Lovich <[email protected]> > >>>>> wrote: > >>>>>> > >>>>>> Well, one thing you can do is have the EntryPoint, and just tell > >>>>>> plugin developers that they have to attach to some particular div > element in > >>>>>> a particular way, as opposed to the traditional root (i.e. > >>>>>> RootPanel.get("plugin-name-div")). > >>>>>> > >>>>>> Then the user can request certain plugins to be added in which your > >>>>>> GWT code should create the div's for those plugins and load their > scripts. > >>>>>> > >>>>>> Hope this helps you get started. Also, I would recommend staying > away > >>>>>> from JSNI if you're not doing something that is absolutely not > supported > >>>>>> within the GWT framework. > >>>>>> > >>>>>> Just as an extension to the Java approach below, I would prefer > >>>>>> something like: > >>>>>> > >>>>>> public abstract class PluginEntry implements EntryPoint > >>>>>> { > >>>>>> String name; > >>>>>> > >>>>>> publc PluginEntry(String pluginName) > >>>>>> { > >>>>>> name = pluginName; > >>>>>> } > >>>>>> > >>>>>> public final void onModuleEntry() > >>>>>> { > >>>>> > >>>>> RootPanel pluginPanel = > RootPanel.get("plugins-location"); > >>>>>> > >>>>>> pluginPanel.add(new HTML("<div id='" + name + "'></div>")); > >>>>> > >>>>> onPluginEntry(RootPanel.get(name)); > >>>>>> > >>>>>> } > >>>>>> > >>>>>> protected abstract void onPluginEntry(RootPanel pluginPanel); > >>>>>> > >>>>>> } > >>>>>> > >>>>>> On Thu, Mar 12, 2009 at 2:13 PM, Matías Costa < > [email protected]> > >>>>>> wrote: > >>>>>>> > >>>>>>> On Thu, Mar 12, 2009 at 5:40 PM, Rosh PR <[email protected]> > wrote: > >>>>>>>> > >>>>>>>> One of the problems I'm facing over here is how will i compile a > >>>>>>>> small set of gwt code with out any EntryPoint and use the > >>>>>>>> generated javascript from the framework. I know we can compile > >>>>>>>> without the Entrypoint but the main problem I'm facing is > compiling > >>>>>>>> code to javascript instead of java classes and loading it to the > >>>>>>>> framework which will have to use these JS and display the plugin > >>>>>>>> widget on the framework console on runtime. > >>>>>>> > >>>>>>> Interesting problem. > >>>>>>> > >>>>>>> This is going to need some kind of infraestructure and policy. I am > >>>>>>> just thinking out loud waiting more experienced people point > problems and > >>>>>>> what can work. To start you need two things: > >>>>>>> > >>>>>>> a) Know what plugins exists, a registry of plugins > >>>>>>> b) Attach them into a panel, listen events and useful stuff > >>>>>>> > >>>>>>> To install the plugins you can drop them in folder. To know what > >>>>>>> exists you can do it manually, setting up a file and fetching it > from the > >>>>>>> client side. To do it automatically you can do it server side and > >>>>>>> rpc-serialize'it to client side. > >>>>>>> > >>>>>>> To load them the main problem is obfuscated code. I imagine you > can't > >>>>>>> mix up source comming from different optimizer executions. Let's > suposse we > >>>>>>> can. Then if we know the plugin main object name, we can construct > a jsni > >>>>>>> method to forge a call to the pluing initializer function, with the > panel id > >>>>>>> to be attached. > >>>>>>> > >>>>>>> native void initPlugin(String objectName, String panelId) /*-{ > >>>>>>> var method = "@"+objectName+"::doInit(Ljava/lang/String;)"; > >>>>>>> eval( method+"('"+panelId+"');" ); > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> }-*/; > >>>>>>> > >>>>>>> That should give to the plugin the ability to put itself into the > >>>>>>> panel and call whatever container hooks needs. > >>>>>>> > >>>>>>> Another way is doing plugin static iniatilazation self injection: > >>>>>>> > >>>>>>> class CoolPlugin extends Plugin { > >>>>>>> static { > >>>>>>> Application.staticSomething.register(new CoolPlugin()); > >>>>>>> } > >>>>>>> > >>>>>>> So the application can take further actions... > >>>>>>> > >>>>>>> > >>>>>> > >>>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >> > >> > >> > > > > > > > > > > > > > -- > __________________________________________________ > Andreas Karlsson ([email protected]) > Software Architect > MCP, MCAD.NET Charter, MCSD.NET Early Achiever, SCJP > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
