I am currently working on integrating Opentip into a GWT project. Since some of my widgets are loaded from Java rather than HTML, it seems like I will need to utilize JSNI in order to properly bind those tooltips. Here is the progress I have made so far:
- Inserted the necessary JS/CSS declarations before GWT's
nocache.js
in my HTML file. (I also attempted duplicating the JS loading usingScriptInjector
, but ultimately removed it as it was redundant. Created a JSNI method to initialize the tooltips:
private native void initControlTooltips() /*-{ var headerText = "Tooltip text"; new $wnd.Opentip($("#tooltipTrigger"), headerText); // more tooltips... }-*/
I have experimented with different variations of the above method, but from what I've researched, this appears to be the correct approach (Slide 20 here, though direct linking to the slide isn't possible). Unfortunately, I have not had success yet, and my latest attempt, which seems most accurate to me, has actually caused the remaining parts of my GWT module to stop loading (following the tooltip instantiation call), seemingly due to a syntax error somewhere, though nothing is being reported in the console. Any insights into what I may be doing wrong would be greatly appreciated. As I am relatively new to both GWT and JS, I'm hoping it's just a novice mistake.
One thing I have not tried is creating an Overlay object, partly because I am unsure how to correctly wrap a JS constructor based on the documentation. If that turns out to be the solution, any guidance on how to go about it would be helpful. The constructor I would be using (as per the Opentip documentation) is:
new Opentip("#my-trigger-element", "Optional content", "Optional title", { ...options... });
Thank you for any assistance; while this doesn't appear to be an overly challenging issue, my lack of experience has hindered my progress thus far.
Update
After numerous hours of frustration and tweaking parameters, I have managed to resolve this on my own. So please do not waste your time attempting to help me troubleshoot. I will provide an update later today when I have a moment free.