Hello Friends,
I am confused by few things. I have created three layouts.
1. HLayout - main layout which will contain other two layouts
2. VLayout - menu layout which will be displayed on left side
3. Valyout - content layout which will be placed on right side.
On clicking of any menu from left side right Canvas items should be remove and new Canvas Items should be getting displayed.
For clearing the old item i am using .clear() method. And for adding new Canvas on right side i am using .addMember() method. And after clear and add operation i am calling the .draw() method again.
But the main problem is that the old Canvas Items is not getting cleared from VLayout and new Canvas item added in VLayout. Can you suggest where i am being wrong?
Below is the code for same thing:
EntryPoint.java:
CustomDSTest.java:
I am confused by few things. I have created three layouts.
1. HLayout - main layout which will contain other two layouts
2. VLayout - menu layout which will be displayed on left side
3. Valyout - content layout which will be placed on right side.
On clicking of any menu from left side right Canvas items should be remove and new Canvas Items should be getting displayed.
For clearing the old item i am using .clear() method. And for adding new Canvas on right side i am using .addMember() method. And after clear and add operation i am calling the .draw() method again.
But the main problem is that the old Canvas Items is not getting cleared from VLayout and new Canvas item added in VLayout. Can you suggest where i am being wrong?
Below is the code for same thing:
EntryPoint.java:
Code:
final HLayout mainPanel = new HLayout(); mainPanel.setHeight100(); final VLayout firstPanel = new VLayout(); firstPanel.setHeight100(); firstPanel.setWidth(100); firstPanel.setShowResizeBar(true); final VLayout secondPanel = new VLayout(); Button btn1 = new Button("Click Me"); btn1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { secondPanel.clear(); secondPanel.addChild(new CustomDSTest()); secondPanel.draw(); } }); firstPanel.addMember(btn1); mainPanel.addMember(firstPanel); mainPanel.addMember(secondPanel); mainPanel.draw();
Code:
public class CustomDSTest extends Canvas { public CustomDSTest() { //Create the Vstack containing ListGrid, DynamicForm this.addChild(Vstack); } }
Comment