Hello
I am trying to put many component in a canvas and I have an error that I don't understand.
I am using development mode plugin for eclipse and when I try to show my canvas I see nothing and in the console I have this message :
This is my class :
When I just add the ListGrid to the Canvas there is no problem but when i try to add my HLayout the error message appear.
The message said a widget had already a parent but all my component just have one so I am a little lost.
What could be wrong in my code?
Thank you for any advice.
I am trying to put many component in a canvas and I have an error that I don't understand.
I am using development mode plugin for eclipse and when I try to show my canvas I see nothing and in the console I have this message :
Code:
Uncaught JavaScript exception [uncaught exception: java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list] in , line 0
Code:
import com.google.gwt.user.client.ui.TextBox; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import fr.vif.vif5_7.browser.client.login.user.model.DataExampleUser; /** * TODO Write the class' description. * * @author sv2 */ public class FirstFunction extends Canvas { private VLayout vlayout = null; private ListGrid listGrid = new ListGrid(); public FirstFunction() { super(); initialize(); } private void initialize() { this.addChild(getVLayout()); } public VLayout getVLayout() { if (vlayout == null) { vlayout = new VLayout(); } vlayout.setHeight("100%"); vlayout.setWidth("100%"); vlayout.addMember(getListGrid()); vlayout.addMember(getUserFormLine()); vlayout.draw(); return vlayout; } public ListGrid getListGrid() { if (listGrid == null) { listGrid = new ListGrid(); } ListGridField userCodeField = new ListGridField("codeUser", "Utilisateur"); ListGridField userLabelField = new ListGridField("libelleUser", "Libelle"); listGrid.setFields(new ListGridField[] { userCodeField, userLabelField }); listGrid.setData(DataExampleUser.getRecords()); listGrid.setHeight("80%"); listGrid.setWidth("100%"); listGrid.setAlternateRecordStyles(true); return listGrid; } public HLayout getUserFormLine() { HLayout hlayout = new HLayout(); com.smartgwt.client.widgets.Label lab = new com.smartgwt.client.widgets.Label("Utilisateur :"); TextBox textBoxCode = new TextBox(); hlayout.addMember(lab); TextBox textBoxLabel = new TextBox(); hlayout.addMember(textBoxCode); hlayout.addMember(textBoxLabel); return hlayout; } }
The message said a widget had already a parent but all my component just have one so I am a little lost.
What could be wrong in my code?
Thank you for any advice.
Comment