typo:
private class TestClone extends Composite{
public TestClone (TestClone src){
setElement(new HTML(src.toString()).getElement
());
}
public TestClone (){
initWidget(new VerticalPanel(){
{add(new TextBox()); add(new CheckBox());}
});
}
}
On Aug 21, 12:38 pm, Rakesh <[email protected]> wrote:
> It is not impossible, though not very straight forward;
> To start with, you can create a simple replica of any of your widget
> by flattening it into html, and creating element out of this html.
> private class TestClone extends Composite{
> public TestComposite(TestClone src){
> setElement(new HTML(src.toString()).getElement());
> }
> public TestComposite(){
> initWidget(new VerticalPanel(){
> {add(new TextBox()); add(new CheckBox());}
> });
> }
>
> }
>
> ...
>
> TestClone original = new TestClone();
> TestClone cloned = new TestClone(original);//Cloned!
>
> This simple construct will work on basic Widgets that does not have
> private variables and other handler related references attached to
> them. Technically you should be able to achieve complete cloning if
> you are able to link the html and its corresponding variable
> references properly.
>
> Rakesh Wagh
>
> On Aug 13, 8:53 am, Ice13ill <[email protected]> wrote:
>
> > If i have a Widget, in a VerticalPanel let's say, and i want to add a
> > widget with the same properties in another panel, is it possible to
> > clone that widget? Or to create a Widget from that first widget ?
>
> > (Smth like : Widget w = new Widget(firstWidget) )
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---