Hi folks,
I want to exchange panels when special nodes of my main navigation tree object
are clicked
------------------------8<--------------------------------
public class Index extends AbstractPage {
// constants
private static String ID_MAIN_PANEL = "main_panel";
private static String ID_NAVIGATION_TREE = "fbc_navigation_tree";
// attributes
private LinkTree myNavigationTree = null;
protected Panel myMainPanel = null;
// constructors
public Index ( final PageParameters pParameters) {
final EmptyPanel lEmptyPanel = new EmptyPanel ( ID_MAIN_PANEL);
final MMCSystemPanel lMMCSystemPanel = new MMCSystemPanel (
ID_MAIN_PANEL, new MMCSystem ());
myMainPanel = lEmptyPanel;
add ( myMainPanel);
myNavigationTree = new LinkTree ( ID_NAVIGATION_TREE,
getApp().getNavigationTreeModel ()) {
@Override
protected void onNodeLinkClicked ( Object pNode,
BaseTree pTree, AjaxRequestTarget pTarget) {
NavigationTreeNode lNode = (NavigationTreeNode)
pNode;
switch ( lNode.getType ()) {
case PANEL:
System.out.println (
"PANEL_NODE");
Object lPayLoad =
lNode.getPayLoad ();
//MMCSystemPanel lPanel = new
MMCSystemPanel ( ID_MAIN_PANEL, (MMCSystem) lPayLoad);
setMainPanel (
lMMCSystemPanel);
break;
case SUB_TREE_ROOT:
setMainPanel ( lEmptyPanel);
if (
pTree.getTreeState().isNodeExpanded ( pNode)) {
pTree.getTreeState().collapseNode ( pNode);
} else {
pTree.getTreeState().expandNode ( pNode);
}
break;
case DEAD:
System.out.println (
"DEAD_NODE");
break;
}
}
};
add ( myNavigationTree);
add ( new Link ( "swap") {
private boolean myFlag = true;
@Override
public void onClick () {
if ( myFlag) {
setMainPanel ( lMMCSystemPanel);
} else {
setMainPanel ( lEmptyPanel);
}
myFlag = ! myFlag;
}
});
myNavigationTree.getTreeState().expandAll ();
}
// methods
public void setMainPanel ( Panel pPanel) {
myMainPanel.replaceWith ( pPanel);
myMainPanel = pPanel;
}
------------------------>8--------------------------------
For testing I also added a link (id=swap) that should toggle between two panels
when clicked.
While clicking the swap-link produces the expected result, clicking nodes of my
tree doesn't switch the panel (but produces the output "PANEL_NODE" to console).
Any ideas?
I'm using Firefox 3.0.10, SUN Java(TM) SE Runtime Environment (build
1.6.0_10-b33), wicket 1.4-rc4 (also tested 1.4-rc2) on Linux
Thanks in advance.
Mit freundlichen Grueszen, / With kind regards,
i.A. Andreas Buergel
BUCYRUS (R)
Engineering Center
Automation
Longwall Division
Industriestr. 1, D-44534 Luenen
Tel: +49 (2306) 709 2509
Fax: +49 (2306) 709 1315 2509
mailto: [email protected]
http://www.bucyrus.com____________________________________________________________________________________________________________________
Bucyrus DBT Europe GmbH
Sitz der Gesellschaft: Luenen, Registergericht: Amtsgericht Dortmund,
Handelsregister HRB 17120
Geschaeftsfuehrung: Luis de Leon (Sprecher), Dr. Ulrich Noll Vorsitzender des
Aufsichtsrates: Dr. Juergen W. Stadelhofer
____________________________________________________________________________________________________________________
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte unverzueglich
den Absender und vernichten Sie diese E-Mail. Das
unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail sind nicht
gestattet.
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient or have received this
e-mail in error, please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or
distribution of the material in this e-mail is strictly forbidden
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]