Tuesday, June 21, 2016

SimplePanel can only contain one child widget

When i run the following Code and push Button "Push", more than once a time, i get browser error "simplePanel can only contain one child widget". How can i solve that problem? thank you in advance! Jogi

public class Projekt implements EntryPoint {        private RootPanel rootPanel;        public void onModuleLoad() {            rootPanel = RootPanel.get("gwtContainer");          rootPanel.setSize("1902", "868");             final AbsolutePanel boundaryPanel = new AbsolutePanel();           boundaryPanel.setStyleName("frame1");           boundaryPanel.setSize("1455px", "600px");                    final Diagram diagram = new Diagram(boundaryPanel);             RootPanel.get().add(boundaryPanel, 446, 242);               final Connector con = new Connector(100, 300, 300, 500);             Button la = new Button("Push");           la.setSize("200", "200");           RootPanel.get().add(la);             Button la2 = new Button("Push2");           la2.setSize("200", "200");           RootPanel.get().add(la2);             final Image img = new Image("images/concrete.svg");           img.setSize("200", "200");               final Shape shapei = new Shape(img);               Image img2 = new Image("images/variable.svg");           img2.setSize("200", "200");           boundaryPanel.add(img2, 200,200);             final Shape shapei2 = new Shape(img2);           shapei2.showOnDiagram(diagram);             la.addClickHandler(new ClickHandler(){                @Override              public void onClick(ClickEvent event) {                   boundaryPanel.add(img, 100,100);                   shapei.showOnDiagram(diagram);              }             });           la2.addClickHandler(new ClickHandler(){                    @Override                  public void onClick(ClickEvent event) {                         con.showOnDiagram(diagram);                  }                 });               diagram.addDiagramListener(new DiagramListenerAdapter() {                  @Override                public void onElementConnect(ElementConnectEvent event) {                  if (con.startEndPoint.isGluedToConnectionPoint()) {                      Widget connected = con.startEndPoint.gluedConnectionPoint.parentWidget;                      if(connected.equals(shapei.connectedWidget)){                    Image logo = new Image("images/xor.svg");                    logo.setSize("100", "100");                    boundaryPanel.add(logo);                  }                      else if(connected.equals(shapei2.connectedWidget)){                           Image logo2 = new Image("images/and.svg");                        logo2.setSize("100", "100");                        boundaryPanel.add(logo2);                      };                }}              });    }}

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment