Alyxandor, thanks a lot!

That was exactly that help I needed. The only problem now is that it
perfectly works in Hosted mode and in Safary but totally fails in
Firefox.
Firebug sais:
uncaught exception: [Exception... "Component returned failure code:
0x80004003 (NS_ERROR_INVALID_POINTER)
[nsIDOMHTMLTableElement.appendChild]" nsresult: "0x80004003
(NS_ERROR_INVALID_POINTER)" location: "JS frame ::
http://localhost:8888/package.Main/601C4746C2C9302863FEA163B011868C.cache.html
:: C5c :: line 2696" data: no]
and I have no idea what's the problem. Tried to google it but no
results so far.
May be you can advise me a direction?

On May 20, 1:39 am, Alyxandor <[email protected]>
wrote:
> You can make your own widgets with custom html without wrappers, just
> be careful because event listening often relies on the proper html
> elements being present to operate properly {spans can be wonky when it
> comes to KeyListeners}
>
> The following code is for a simple widget that you can send arbitrary
> html or plain text and have it converted into a widget...  It's got a
> little extra code in it, but that's code cloneNode is way faster than
> document.createElement()...
>
> public class xSimpleWidget extends Widget{
>
>         protected xSimpleWidget(){this("<div/>";}
>
>         public xSimpleWidget(String xHtml){
>                 setElement(xMakeHtml((xHtml.startsWith("<")?xHtml:"<div
> style='display:inherit;'> "+xHtml+" </div>").replaceAll("\r|\n", "<br/>")));
>
>         }
>         public xSimpleWidget(Element x){
>                 setElement(x);
>         }
>
> private static Element
>                 xBLANK_DIV= Document.get().createDivElement()
>                 ,xBLANK_X= xDiv()
>         ;
>
>         public static Element xDiv(){
>                 return xBLANK_DIV.cloneNode(false).cast();
>         }
>         public static Element xMakeHtml(String x){
>                 xBLANK_X.setInnerHTML(x);
>                 if(xUserAgent.xStandards())//Non IE browsers don't have to 
> forget
> their reference to the new child
>                         return xBLANK_X.getFirstChildElement();
>                 Element xRet = xBLANK_X.getFirstChildElement();//Get the 
> element
> created inside our div
>                 xBLANK_X=xDiv();//Reset the div so IE won't lose it's 
> reference the
> next time the xBLANK_X is overwritten
>                 return xRet;
>         }
>
> }
>
> Basically, a Widget, Panel or Composite needs setElement(e), setElement
> (e) and initWidget(w) {respectively} before you call getElement() or
> add(), and all gwt widgets already call these functions {can only be
> set once}.  If you want widgets with element's of any dynamic type
> with including the proper GWT-wrapped widgets {they've got a widget
> for pretty much every element already}...
>
> If you can't find the GWT widgets, go to the DOM.createFormElement(),
> or whatever element you're interested in, right-click and select "open
> call hierarchy" to find out where GWT uses those calls...  Should lead
> to better Widgets than my xSimpleWidget...
>
> CHEERS!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to