Reputation: 5736
attach an Image after you have called removeFromParent in GWT?
The Image was created from an UiBinder e.g.
<g:HTMLPanel>
<g:Image ui:field="myImage"/>
</g:HTMLPanel>
public class Testing extends Composite {
interface MyUiBinder extends UiBinder<Widget, Testing> {}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
@UiField Image myImage;
public Testing() {
initWidget(uiBinder.createAndBindUi(this));
}
public void remove() {
myImage.removeFromParent();
}
public void add() {
...
}
Upvotes: 0
Views: 96
Reputation: 2460
Well, I suppose you could add a field referencing your container panel:
<g:HTMLPanel ui:field="imgPanel">
<g:Image ui:field="myImage"/>
</g:HTMLPanel>
you could then go:
imgPanel.add(myImage);
Upvotes: 1
Reputation: 743
Instead of remove the image, you can just hide the image :
public void remove() {
myImage.setVisible(false);
}
public void add() {
myImage.setVisible(true);
}
Add and remove from the DOM is expensive for the browser.
Upvotes: 1