You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Lorinda Swick <ls...@intalio.com> on 2004/12/18 00:16:51 UTC
JspTilesViewHandlerImpl & dynamic component rendering
Hi,
Has anyone dynamically rendered JSF components while using myfaces'
JspTilesViewHandlerImpl view handler?
I have a WebGalileoFaces tabbed panel component. Its listener attaches
sub-tabs to it dynamically. The rendering works without using the view
handler above. Yet, when I use the myfaces handler, I get an NPE. My
listener impl is below.
The view handler appears to cut off access to the actual UIViewRoot so the
form cannot be found. I've tried a couple calls directly to the handler
using context.getApplication().getViewHandler() yet, none of the methods
gave me access to it (well, that I could figure out).
Ideas anyone?
Thanks
Lorinda
public void processTabSelected(TabSelectedEvent event)
throws AbortProcessingException {
context = FacesContext.getCurrentInstance();
// who sent the event?
FacesTabbedPanel eventSource = (FacesTabbedPanel) event.getSource();
UIComponent tabbedPanel = event.getComponent();
String tabName = tabbedPanel.getId();
String formId = tabbedPanel.getParent().getId();
LOG.info("Tab selected: " + tabName);
LOG.info("Parent form: " + formId);
UIForm form = (UIForm) context.getViewRoot().findComponent(formId);
--> NPE UIPanel panel = (UIPanel) form.findComponent("childTabsGrid");
if (panel == null) {
LOG.error("PanelGrid 'childTabsGrid' could not be found.
");
} else {
// clear the childTabsGrid to prevent stacking child tabs
<-- ATTACHES sub-tabs here
panel.getChildren().clear();
ListSelectionModel selectionModel =
eventSource.getListSelectionModel();
UIComponent newTabbedPanel =
createSubTabbedPanel(selectionModel);
panel.getChildren().add(newTabbedPanel);
}