
Originally Posted by
Wilayers
Where can I find this example ?
hi mate,
i didn't find the example for Ext GWT, i did what i used to do in JAVA Swing application, and solved the problem. Generally i use a getter and setter to get reference of the content panel in the tree panel, like this:
Code:
public class MyTreePanel extends LayoutContainer {
private MyDisplayPanel myPanelReference;
public void setMyPanelReference(ContentPanel c) {
this.myPanelReference = c;
}
public void onRender() {
...
Tree myTree = new Tree();
myTree.addListener(Events.SelectionChange, new Listener<TreeEvent>() {
public void handleEvent(TreeEvent e) {
myPanelReference.buildPanel(); // this is to call the method in MyDisplayPanel class
}
});
}
......
}
// this is the panel
public class MyDisplayPanel extends LayoutContainer {
public MyPanel() {
// if you don't want to display anything initially, nothing here
}
public ContentPanel buildPanel() {
// do something to construct the panel
ContentPanel panel = new ContentPanel();
......
......
return panel;
}
}
// Then at the point that you add the TreePanel and the DisplayPanel, setup the reference to the panel
// using the setter in the TreePanel class
public class MainPanel extends LayoutContainer {
public MainPanel() {
MyTreePanel mtp = new MyTreePanel();
MyDisplayPanel mdp = new MyDisplayPanel();
mtp.setMyPanelReference(mdp);
add(mtp);
add(mdp);
}
}
This works for me, i m not sure whether it's the right way of doing it. You are more than welcome to post your solution, or any problem you have.
Best regards