Hi All,
We started using GWT-EXT controls.
We have a requirement to load the panel at run time i.e. when I select
a tree node, the information associated with that node should be
displayed towards the right panel. I tried this but the panel is not
loading the information at runtime with in the anonymous inner class
Is there any issue aroung GWTEXT panels loading information
dynamically ?
Here are the code snippets:-
1) We have created a new module which has Tree control and we added a
custom listener to it
TreeWidget:-
public TreeWidget() {
//Window.alert("inside composite");
Panel panel = new Panel();
panel.setBorder(false);
panel.setPaddings(15);
Toolbar fromToolbar = new Toolbar();
ToolbarButton addButton = new ToolbarButton();
addButton.setDisabled(false);
addButton.setIcon("home.gif");
addButton.setIconCls("user-add-icon");
fromToolbar.addButton(addButton);
fromToolbar.addSpacer();
ToolbarButton delButton = new ToolbarButton();
delButton.setDisabled(false);
delButton.setIcon("drafts.gif");
delButton.setIconCls("user-delete-icon");
fromToolbar.addButton(delButton);
fromToolbar.addSpacer();
//EventObject e ;
//fromToolbar.addListener(, funtion);
//this.onBrowserEvent(event)
final TreePanel treePanelVistaArrows = new SampleTree();
treePanelVistaArrows.setTitle("SMSC management");
treePanelVistaArrows.setWidth(400);
treePanelVistaArrows.setHeight(800);
treePanelVistaArrows.setUseArrows(true);
treePanelVistaArrows.setTopToolbar(fromToolbar);
/*final Panel accordionPanel = createAccordionPanel();
accordionPanel.setTitle("Accordion Panel");
accordionPanel.setHeight(400);
accordionPanel.setWidth(190);
accordionPanel.setVisible(false);*/
Panel horizontalPanel = new Panel();
horizontalPanel.setLayout(new HorizontalLayout(20));
horizontalPanel.add(treePanelVistaArrows);
//horizontalPanel.add(accordionPanel);
treePanelVistaArrows.addListener(new TreePanelListenerAdapter()
{
public void onClick(TreeNode node, EventObject e) {
/*if (node.getText().equalsIgnoreCase("SMS
Engine"))
else
accordionPanel.setVisible(false);*/
Window.alert("inside onClick mehtod of
treePanelVista.....");
notifyNodeSelectedListeners(node);
}
});
panel.add(horizontalPanel);
initWidget(panel);
//RootPanel.get().add(panel);
}
private List treeNodeSelectedListeners = new ArrayList();
public void addNodeSelectedListeners(TreeNodeSelectedListeners
listener) {
//Window.alert("inside addNodeSelectedListeners()
method..."+listener);
treeNodeSelectedListeners.add(listener);
}
private void notifyNodeSelectedListeners(TreeNode node) {
//Window.alert("inside notifyNodeSelectedListeners()
method...");
for (Iterator i = treeNodeSelectedListeners.iterator();
i.hasNext
();) {
((TreeNodeSelectedListeners)
i.next()).onTreeNodeSelected(node);
}
}
class SampleTree extends TreePanel {
public SampleTree() {
Window.alert("inside SampleTree()...");
TreeNode root = new TreeNode("Clusters");
TreeNode cluster1 = new TreeNode("Cluster1");
cluster1.setExpanded(true);
cluster1.appendChild(new TreeNode("SMS Engine"));
cluster1.appendChild(new TreeNode("DB Engine"));
TreeNode cluster2 = new TreeNode("Cluster2");
cluster2.setExpanded(true);
cluster2.appendChild(new TreeNode("SMS Engine"));
cluster2.appendChild(new TreeNode("DB Engine"));
TreeNode cluster3 = new TreeNode("Cluster3");
cluster3.appendChild(new TreeNode("SMS Engine"));
cluster3.appendChild(new TreeNode("DB Engine"));
TreeNode cluster4 = new TreeNode("Cluster4");
cluster4.appendChild(new TreeNode("SMS Engine"));
cluster4.appendChild(new TreeNode("DB Engine"));
root.appendChild(cluster1);
root.appendChild(cluster2);
root.appendChild(cluster3);
root.appendChild(cluster4);
setRootVisible(false);
setTitle("SMSC management");
setWidth(200);
setHeight(400);
setRootNode(root);
root.setExpanded(true);
}
}
}
Entry point class:-
SMSAdmin:-
/**
* This is the entry point method.
*/
Panel accordiantPanel = null ;
public void onModuleLoad() {
RootPanel basicPanel = RootPanel.get();
basicPanel.setSize("200", "200");
basicPanel.addStyleName("basic-panel");
Panel panel = new Panel();
panel.setBorder(false);
panel.setPaddings(15);
panel.setSize("200", "200");
panel.addStyleName("basic-panel");
//basicPanel.setvi
Panel treePanel = new Panel();
treePanel.setTitle("Cluster Panel");
treePanel.setCollapsible(true);
treePanel.setPagePosition(50, 50);
treePanel.setSize(400, 800);
// treePanel.setWidth(300);
treePanel.setVisible(true);
treePanel.setBorder(true);
TreeWidget treeWidget = new TreeWidget();
treePanel.add(treeWidget);
final Panel midPanel = new Panel();
midPanel.setTitle("Cluster Panel");
midPanel.setCollapsible(true);
midPanel.setPagePosition(450, 50);
midPanel.setSize(400, 800);
midPanel.setVisible(false);
midPanel.setBorder(true);
//AccordionWidget accordianWidget = new
AccordionWidget();
//Panel accordiantPanel = null ;
//midPanel.add(accordiantPanel);
accordiantPanel = createAccordionPanel();
midPanel.add(accordiantPanel);
Panel horizontalPanel = new Panel();
horizontalPanel.setLayout(new HorizontalLayout(40));
horizontalPanel.add(treePanel);
horizontalPanel.add(midPanel);
if(treeWidget!=null)
{
treeWidget.addNodeSelectedListeners(new
TreeNodeSelectedListeners() {
public void
onTreeNodeSelected(TreeNode node)
{
if(node.getText().equalsIgnoreCase("SMS Engine")){
accordiantPanel =
createAccordionPanel();
midPanel.setVisible(true);
/*
Window.alert("accordiantPanel:"+accordiantPanel);
midPanel.setVisible(true);
Window.alert("Before
adding accordiantPanel to
midPanel");*/
//
midPanel.add(accordiantPanel);
}else
{
midPanel.setVisible(false);
}
Window.alert("Before adding
accordiantPanel to
horizontalPanel");
//horizontalPanel.add(midPanel);
}
});
}
basicPanel.add(horizontalPanel);
panel.add(horizontalPanel);
Viewport viewport = new Viewport(panel);
}
private Panel createAccordionPanel() {
Panel accordionPanel = new Panel();
accordionPanel.setLayout(new AccordionLayout(true));
Panel panelOne = new Panel("Panel 1", "<p>Panel1 content!</
p>");
panelOne.setIconCls("settings-icon");
accordionPanel.add(panelOne);
Panel panelTwo = new Panel("Panel 2", "<p>Panel2
content!</
p>");
panelTwo.setIconCls("folder-icon");
accordionPanel.add(panelTwo);
Panel panelThree = new Panel("Panel 3", "<p>Panel3
content!</
p>");
panelThree.setIconCls("user-add-icon");
accordionPanel.add(panelThree);
return accordionPanel;
}
}
Any suggestion would be really helpful
Thanks in Advance
Thanks,
Ravi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---