0

I am new to JSF and need to convert a Swing project into JSF. The screen of the Swing GUI is in 2 parts. The left side has a tree menu and the right side is created dynamically depending on the selected tree menu item. I have implemented the tree menu but need help with creating right panel dynamically.

The treenodes have context menus, here is an example of one:

<p:contextMenu for="treeSingle" nodeType="xxxx">
    <p:menuitem value="menu 1" actionListener="#{treeManagedBean.menu1selected}"/>
</p:contextMenu>

The menu1selected function in treeManagedBean is correctly called.

The right part of the screen is currently only:

<p:layoutUnit position="center">
</p:layoutUnit>

How can I create a panel and contents in java when a tree node is selected - i.e. what do I need to put in menu1selected function to erase existing contents and create new contents. The contents may be a table, some buttons, labels etc.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
amah
  • 73
  • 1
  • 13
  • something like https://stackoverflow.com/questions/7108668/how-to-ajax-refresh-dynamic-include-content-by-navigation-menu-jsf-spa?rq=1 – Kukeltje Aug 04 '16 at 12:25
  • Thanks for the quick reply but the content of the right part of screen is dynamic and therefore has to be created using java. My question is how to create content using java when a tree node is selected. – amah Aug 04 '16 at 13:07
  • like in all the other questions on how to 'programmatically create views' – Kukeltje Aug 04 '16 at 13:15
  • http://stackoverflow.com/questions/3510614/how-to-create-dynamic-jsf-form-fields – Kukeltje Aug 04 '16 at 13:27
  • Apologies for being not clear but what I am looking for is not using templates and having only a simple xhtml file but doing the rest in java. I have been googling around and found http://www.naturalborncoder.com/java/java-ee/2012/02/13/dynamic-datatable-with-jsf-2-0/ Is there anyway I can call this code from the function (menu1selected) which is invoked when user selects a menu from tree? – amah Aug 04 '16 at 16:07

0 Answers0