Hi,
I am using getWidgetCount() but it does not look like i am getting correct results. Here is the code where i have this function:
public class ERD1 implements EntryPoint {
private PickupDragController dragController;
final AbsolutePanel boundaryPanel = new AbsolutePanel();
int i;
public void onModuleLoad() {
boundaryPanel.setPixelSize(1000, 1000);
final Diagram d = new Diagram(boundaryPanel);
dragController = new PickupDragController(boundaryPanel, true);
dragController.setBehaviorMultipleSelection(false);
dragController.setBehaviorDragProxy(false);
dragController.setBehaviorConstrainedToBoundaryPanel(true);
AddDraggableWidget adw = new AddDraggableWidget(dragController);
adw.add(new CreateClone(new Test()));
adw.add(new CreateClone(new Test2()));
Button b = new Button("Click for Connector");
b.addClickListener(new ClickListener(){
@Override
public void onClick(Widget sender) {
SectionDecoration startDecoration = new SectionDecoration
(SectionDecoration.DECORATE_ARROW);
SectionDecoration endDecoration = new SectionDecoration
(SectionDecoration.DECORATE_ARROW);
Connector con = new Connector(250, 30, 300, 100, startDecoration, endDecoration);
con.showOnDiagram(d);
i = boundaryPanel.getWidgetCount();
System.out.println("No of widget" + i);
}
});
boundaryPanel.add(b, 20, 30);
boundaryPanel.add(adw, 20, 60);
RootPanel.get().add(boundaryPanel);
}
}
Here when ever i click on the button i am trying to get the number of widgets in the panel. The AddDragabbleWidget, CreateClone, Test, and Test2 are the class that help to create clones of widgets. Test and Test2 extends composite panels. But first time when i run the program without creating any clones this is how it looks: http://www.cs.uofs.edu/~sudhakaras2/one.jpg there are only 6 widgets but the answer for getWidgetCount() is 10 and when i create clones this is how it looks: http://www.cs.uofs.edu/~sudhakaras2/two.jpg there are extra four more widgets but it gives 20 as answer.
Can anyone please point out what the problem is.
Thank you.