1 Reply Latest reply on Jul 17, 2007 2:14 PM by Raymond Eperen

    Nesting JSF components inside RichFaces

    Raymond Eperen Newbie

      I am new to RichFaces and JSF. I am programmatically creating a RichFaces PanelBar with several PanelBarItems. The PanelBarItems have nested PanelBar and PanelBarItems. Up to here it works fine. Inside the inner PanelBarItems I need to nest some JSF Components - an HTMLPanelGrid with some outputText and CommandLinks etc. These seem to compile and run, but nothing is displayed - only the RichFaces components display. The code is below. Any ideas?

      Ray

      From xhtml page:

      <rich:panelBar binding="#{datasetManagementMainWebBean.scheduleBar}"/>
      


      From backing bean:
       /**
       * Programmatically builds the RichFaces PanelBar component. One panel item is built for each schedule in scheduleList
       * and each of those has a panel bar created with one panel item for each dataset that has been received against that schedule.
       * Each dataset panel item is them populated with various components based on their state.
       *
       * @return the RichFaces HtmlPanelBar object
       */
       public HtmlPanelBar getScheduleBar()
       {
       this.checkCurrentState();
      
       if (this.isValidConfig())
       {
       this.createScheduleList();
      
       DatasetScheduleDO schedule;
       HtmlPanelBar datasetBar;
       HtmlPanelBarItem scheduleItem;
       HtmlDataGrid datasetGrid;
       HtmlOutputText receiveText;
       DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
      
       // build the panel bar for the schedules
       Application app = FacesContext.getCurrentInstance().getApplication();
       this.scheduleBar = (HtmlPanelBar) app.createComponent(HtmlPanelBar.COMPONENT_TYPE);
       this.scheduleBar.setId("scheduleBar");
      
       for (int x = 0; x < this.scheduleList.size(); x++)
       {
       // build a panel bar item for each schedule
       schedule = this.scheduleList.get(x);
       scheduleItem = new HtmlPanelBarItem();
       scheduleItem.setId("schedule" + schedule.getId());
       scheduleItem.setLabel(df.format(schedule.getScheduleDate()));
      
       if (!schedule.getDatasets().isEmpty())
       {
       // build a panel bar for the datasets
       datasetBar = new HtmlPanelBar();
       datasetBar.setId("scheduleDatasets" + schedule.getId());
       scheduleItem.getChildren().add(datasetBar);
      
       HtmlPanelBarItem datasetItem;
       DatasetDO dataset;
       for (int y = 0; y < schedule.getDatasets().size(); y++)
       {
       // build the panel bar item for each dataset
       dataset = schedule.getDatasets().get(y);
       datasetItem = new HtmlPanelBarItem();
       datasetItem.setId("dataset" + dataset.getId());
       datasetItem.setLabel("Datagate Id: " + dataset.getDatagateId() + " - " + dataset.getDatasetName());
      
       // build the data grid to contain the dataset details
       datasetGrid = new HtmlDataGrid();
       datasetGrid.setCellpadding("0");
       datasetGrid.setCellspacing("0");
       datasetGrid.setId("datasetGrid" + dataset.getId());
       datasetGrid.setWidth("100%");
       datasetGrid.setColumns(1);
      
       // put the receive data into the grid
       receiveText = new HtmlOutputText();
       receiveText.setId("receiveText" + dataset.getId());
       receiveText.setTitle("The title");
       receiveText.setValue("Received: " + df.format(dataset.getReceiveDate()) + " by "
       + dataset.getReceiveUser());
      
       datasetGrid.getChildren().add(receiveText);
       datasetItem.getChildren().add(datasetGrid);
       datasetBar.getChildren().add(datasetItem);
       }
       }
       this.scheduleBar.getChildren().add(scheduleItem);
       }
       }
      
       return this.scheduleBar;
       }