|
|
|
Leon Wang-2
|
Hi Marius,
Thank you for creating the API! I am still trying to figure out how to display the gwt tree edit panel in the WYSIWYG editing mode. Is it correct that I use the new api like last time you told me? Please see the code below: native void setBackgroudColor(String color) /*-{ editorJSReference.execute('backcolor', color); }-*/; and if (((TreeItem)event.getSelectedItem()).getText().equals("Alternative")) { setBackgroudColor("yellow"); } What do you think? Do you think that will work? Thank you! Hope I could get it done before meeting in the coming week. Otherwise, my advisors will give me unhappy look again =_= If there are anything I could help free feel to let me know, like documenting how to use your new background API. Remember you have to create the page for me first. Leon _______________________________________________ devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Marius Dumitru Florea
|
Hi Leon,
Leon Wang wrote: > Hi Marius, > > Thank you for creating the API! > > I am still trying to figure out how to display the gwt tree edit panel in > the WYSIWYG editing mode. > > Is it correct that I use the new api like last time you told me? Please see > the code below: > > native void setBackgroudColor(String color) > /*-{ > editorJSReference.execute('backcolor', color); > }-*/; > > and > > if > (((TreeItem)event.getSelectedItem()).getText().equals("Alternative")) > { > setBackgroudColor("yellow"); > } > > What do you think? Do you think that will work? > In my previous mail I pointed out a JIRA issue ( http://jira.xwiki.org/jira/browse/XWIKI-4519 ) which has a link to the documentation ( http://code.xwiki.org/xwiki/bin/view/Modules/WysiwygEditorModule#HCommandManager ) which gives you an example. Follow that example. I have exposed the command manager so you can do more than just executing a command. Also, "editorJSReference" is not defined by default. I wrote it just as an example. You have to either set its value somewhere or replace it with what you have, window['content_editor'] for instance. Hope this helps, Marius > Thank you! Hope I could get it done before meeting in the coming week. > Otherwise, my advisors will give me unhappy look again =_= > > If there are anything I could help free feel to let me know, like > documenting how to use your new background API. Remember you have to create > the page for me first. > > Leon > _______________________________________________ > devs mailing list > [hidden email] > http://lists.xwiki.org/mailman/listinfo/devs devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Leon Wang-2
|
In reply to this post
by Leon Wang-2
Hi Marius,
I successfully load the tree panel in the WYSIWYG editing model. Thank you so much! :-) I put the compiled xwiki-web-gwt, xwiki-web-wysiwyg and xwiki-webdav 2.02 jar file to the lib folder. After the tree loaded, I found there 2 errors using firebug (thank you for recommendation), one is saying "isc is not defined" in overwritesc.js(), one is saying "isc is not defined" in overwritesc.js(). Here is the screenshot: http://picasaweb.google.com/lh/photo/BxK7IksttDQFB4KtJAJOvg?feat=directlink. Here is what I did, first I modify the template/macros.vm file: Wysiwyg.onModuleLoad(function() { window["wysiwyg_editor"] = new WysiwygEditor($jsVarName); $jsVarName = undefined; }); In the GWT file: native void setBackgroudColor(String color) /*-{ wysiwyg_editor.getCommandManager().execute('backcolor', 'yellow'); alert(wysiwyg_editor.getCommandManager().getValue('backcolor') ); }-*/; /** * This is the entry point method. */ @SuppressWarnings("unchecked") public void onModuleLoad() { Tree tree = new Tree(); tree.setAnimationEnabled(true); TreeItem outerRoot = new TreeItem("DR Tag Tree"); outerRoot.addItem("Alternative"); outerRoot.addItem("Assumption"); outerRoot.addItem("Argument"); outerRoot.addItem("Claim"); outerRoot.addItem("Decision"); outerRoot.addItem("Requirement"); tree.addItem(outerRoot); tree.addSelectionHandler(new SelectionHandler() { public void onSelection(SelectionEvent event) { if (((TreeItem) event.getSelectedItem()).getText().equals( "Alternative")) { setBackgroudColor("yellow"); } else if (((TreeItem) event.getSelectedItem()).getText() .equals("Requirement")) { setBackgroudColor("blue"); } else if (((TreeItem) event.getSelectedItem()).getText() .equals("Decision")) { setBackgroudColor("green"); } Window.alert(((TreeItem) event.getSelectedItem()).getText()); } }); Could you give me some ideas what is wrong? Or what I missed? Thank you, Marius! -Leon _______________________________________________ devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Marius Dumitru Florea
|
Hi Leon,
Leon Wang wrote: > Hi Marius, > > I successfully load the tree panel in the WYSIWYG editing model. Thank you > so much! :-) > > I put the compiled xwiki-web-gwt, xwiki-web-wysiwyg and xwiki-webdav 2.02 > jar file to the lib folder. After the tree loaded, I found there 2 errors > using firebug (thank you for recommendation), one is saying "isc is not > defined" in overwritesc.js(), one is saying "isc is not defined" in > overwritesc.js(). Here is the screenshot: > http://picasaweb.google.com/lh/photo/BxK7IksttDQFB4KtJAJOvg?feat=directlink. "isc" is defined by SmartClient JavaScript framework. Do you use SmartClient? Did you changed any of the JavaScript files or templates (besides macros.vm and editpanelsvars.vm) that are bundled with XWiki Enterprise? It looks like the SmartClient JavaScript files are not loaded. > > Here is what I did, first I modify the template/macros.vm file: > > Wysiwyg.onModuleLoad(function() { > window["wysiwyg_editor"] = new WysiwygEditor($jsVarName); > $jsVarName = undefined; > }); Good. > > In the GWT file: > > native void setBackgroudColor(String color) > /*-{ > wysiwyg_editor.getCommandManager().execute('backcolor', 'yellow'); > alert(wysiwyg_editor.getCommandManager().getValue('backcolor') ); > }-*/; Almost there. You see, the code of your GWT module is loaded in an iframe and because of this any reference to the window object refers in fact to the iframe's window NOT the main browser window in which the wiki pages is loaded. You defined window["wysiwyg_editor"] in macros.vm but that's the main browser window. Writing any of: window["wysiwyg_editor"] window.wysiwyg_editor wysiwyg_editor inside a native GWT method will fail because you refer to the iframe's window. Instead, you have to write any of: $wnd["wysiwyg_editor"] $wnd.wysiwyg_editor where $wnd is defined by GWT and points to the main browser window. > /** > * This is the entry point method. > */ > @SuppressWarnings("unchecked") > public void onModuleLoad() { > Tree tree = new Tree(); > tree.setAnimationEnabled(true); > TreeItem outerRoot = new TreeItem("DR Tag Tree"); > outerRoot.addItem("Alternative"); > outerRoot.addItem("Assumption"); > outerRoot.addItem("Argument"); > outerRoot.addItem("Claim"); > outerRoot.addItem("Decision"); > outerRoot.addItem("Requirement"); > tree.addItem(outerRoot); > > tree.addSelectionHandler(new SelectionHandler() { > public void onSelection(SelectionEvent event) { > if (((TreeItem) event.getSelectedItem()).getText().equals( > "Alternative")) { > setBackgroudColor("yellow"); > } else if (((TreeItem) event.getSelectedItem()).getText() > .equals("Requirement")) { > setBackgroudColor("blue"); > } else if (((TreeItem) event.getSelectedItem()).getText() > .equals("Decision")) { > setBackgroudColor("green"); > } > Window.alert(((TreeItem) event.getSelectedItem()).getText()); > } > }); This looks fine. Hope this helps, Marius > > Could you give me some ideas what is wrong? Or what I missed? > > Thank you, Marius! > > -Leon > _______________________________________________ > devs mailing list > [hidden email] > http://lists.xwiki.org/mailman/listinfo/devs devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Leon Wang-2
|
In reply to this post
by Leon Wang-2
Hi Marius,
I have change it to $wnd["wysiwyg_editor"], so now it looks like: native void setBackgroudColor(String color) /*-{ $wnd["wysiwyg_editor"].getCommandManager().execute('backcolor', color); alert($wnd["wysiwyg_editor"].getCommandManager().getValue('backcolor')); }-*/; And this time the error says:"$wnd[ab].getCommandManager is not a function" Please see the screenshot: http://picasaweb.google.com/lh/photo/wLOJbhbvl0xZe1ZWshA5wg?feat=directlink I was wondering is it because the Java code setBackgroudColor("yellow"); and in native JavaScript do not accept double quoted string only single quoted string? I do deleted all xwiki web 2.0 jar files in lib and replaced with 2.02 jar files. I have no idea what went wrong. Any advise? Thank you, Marius! -Leon _______________________________________________ devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Leon Wang-2
|
In reply to this post
by Leon Wang-2
Hi Marius,
I think I know what is wrong with this error. For your reference: "And this time the error says:"$wnd[ab].getCommandManager is not a function.Please see the screenshot: http://picasaweb.google.com/lh/photo/wLOJbhbvl0xZe1ZWshA5wg?feat=directlink " I think this API is not included in the Xwiki 2.02 release. I made a wrong assumption. Now I downloaded the source code that contains your api. And I copied the gwt, gwt-dom, wysiwyg jar file to the tomcat/webapps/xwiki/lib/ folder. I reload tomcat it would not startup. I looked the log file, it says: Caused by: java.lang.ClassNotFoundException: org.xwiki.bridge.AttachmentNameFactory Here is the whole error stack: Oct 27, 2009 5:37:27 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.xwiki.container.servlet.XWikiServletContextListener java.lang.NoClassDefFoundError: Lorg/xwiki/bridge/AttachmentNameFactory; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2291) at java.lang.Class.getDeclaredFields(Class.java:1743) at org.xwiki.component.internal.ReflectionUtils.getAllFields(ReflectionUtils.java:45) at org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptor(ComponentDescriptorFactory.java:108) at org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptors(ComponentDescriptorFactory.java:74) at org.xwiki.component.annotation.ComponentAnnotationLoader.initialize(ComponentAnnotationLoader.java:101) at org.xwiki.component.embed.EmbeddableComponentManager.initialize(EmbeddableComponentManager.java:69) at org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:52) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429) at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1249) at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:612) at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ClassNotFoundException: org.xwiki.bridge.AttachmentNameFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 29 more Oct 27, 2009 5:37:27 PM org.apache.catalina.core.StandardContext listenerStop SEVERE: Exception sending context destroyed event to listener instance of class org.xwiki.container.servlet.XWikiServletContextListener java.lang.NullPointerException at org.xwiki.container.servlet.XWikiServletContextListener.contextDestroyed(XWikiServletContextListener.java:107) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474) at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1249) at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:612) at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619) Could you give me some ideas? Thank you! -Leon _______________________________________________ devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Marius Dumitru Florea
|
Hi Leon,
Leon Wang wrote: > Hi Marius, > > I think I know what is wrong with this error. For your reference: "And this > time the error says:"$wnd[ab].getCommandManager is not a function.Please see > the screenshot: > http://picasaweb.google.com/lh/photo/wLOJbhbvl0xZe1ZWshA5wg?feat=directlink " > I think this API is not included in the Xwiki 2.02 release. I made a wrong > assumption. Indeed, http://jira.xwiki.org/jira/browse/XWIKI-4519 specifies this. The changes will be included in the 2.0.3 and 2.1M1 releases. > > Now I downloaded the source code that contains your api. And I copied the > gwt, gwt-dom, wysiwyg jar file to the tomcat/webapps/xwiki/lib/ folder. I Did you download the source code or the jars? I hope you know you don't have to build these modules for yourself (unless you make some changes). You can just download the snapshots from http://maven.xwiki.org/snapshots/ . Back-porting the latest WYSIWYG editor snapshot to a previous XE version is not always easy. Overwriting the xwiki-web-wysiwyg jar in the lib directory is not enough. You have to at least update the client side (resources/js/xwiki/wysiwyg/xwe directory). Then the server side (the jar) depends on various XWiki modules (like core, rendering, bridge) which sometimes need to be updated too. Also, the editor declares some servlets and servlet filters in web.xml so this needs to be checked too. Finally velocity templates like macros.vm and wysiwyginput.vm need to be synchronized too. Why don't you integrate your tree in the latest XE snapshot? At least to see if it works well. 2.0.3 will be released next week. > reload tomcat it would not startup. I looked the log file, it says: Caused > by: java.lang.ClassNotFoundException: org.xwiki.bridge.AttachmentNameFactory Do you have the xwiki-core-bridge jar in the lib directory? Is the AttachmentNameFactory class included in the jar? What version of XE do you use? This class was added in 2.0RC1. Marius > Here is the whole error stack: > Oct 27, 2009 5:37:27 PM org.apache.catalina.core.StandardContext > listenerStart > SEVERE: Exception sending context initialized event to listener instance of > class org.xwiki.container.servlet.XWikiServletContextListener > java.lang.NoClassDefFoundError: Lorg/xwiki/bridge/AttachmentNameFactory; > at java.lang.Class.getDeclaredFields0(Native Method) > at java.lang.Class.privateGetDeclaredFields(Class.java:2291) > at java.lang.Class.getDeclaredFields(Class.java:1743) > at > org.xwiki.component.internal.ReflectionUtils.getAllFields(ReflectionUtils.java:45) > at > org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptor(ComponentDescriptorFactory.java:108) > at > org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptors(ComponentDescriptorFactory.java:74) > at > org.xwiki.component.annotation.ComponentAnnotationLoader.initialize(ComponentAnnotationLoader.java:101) > at > org.xwiki.component.embed.EmbeddableComponentManager.initialize(EmbeddableComponentManager.java:69) > at > org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:52) > at > org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934) > at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429) > at > org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1249) > at > org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:612) > at > org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) > at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) > at java.lang.Thread.run(Thread.java:619) > Caused by: java.lang.ClassNotFoundException: > org.xwiki.bridge.AttachmentNameFactory > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > ... 29 more > Oct 27, 2009 5:37:27 PM org.apache.catalina.core.StandardContext > listenerStop > SEVERE: Exception sending context destroyed event to listener instance of > class org.xwiki.container.servlet.XWikiServletContextListener > java.lang.NullPointerException > at > org.xwiki.container.servlet.XWikiServletContextListener.contextDestroyed(XWikiServletContextListener.java:107) > at > org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973) > at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577) > at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474) > at > org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1249) > at > org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:612) > at > org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) > at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) > at java.lang.Thread.run(Thread.java:619) > > Could you give me some ideas? > > Thank you! > > -Leon > _______________________________________________ > devs mailing list > [hidden email] > http://lists.xwiki.org/mailman/listinfo/devs devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
|
Leon Wang-2
|
In reply to this post
by Leon Wang-2
Hi Marius,
I do not know I do not have to build it myself. Now I know, thank you! I will try to integrate the tree in the latest XE snapshot, and try it out.Thank you for your advise. Appreciate your help! Leon _______________________________________________ devs mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/devs |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |