2012-08-09 15 views
0

我已經嘗試在JSf中構建Java類使用XPage的頁面添加視圖 在這個簡單的示例中使用UiDataview,但我的問題是尋呼機女巫被添加到結果中從不顯示在我的Xpage中。任何人一個想法我必須做什麼?使用JSF添加頁面查看器到Xpage

public class MainLibcontrol extends UIComponentBase implements FacesComponent { 

     private static final String RENDERER_TYPE = "de.my.MainLibcontrol"; 
     private static final String COMPONENT_FAMILY = "de.my"; 

     public MainLibcontrol() { 
      setRendererType(RENDERER_TYPE); 
     } 

     @Override 
     public String getFamily() { 
      return COMPONENT_FAMILY; 
     } 

     @SuppressWarnings("unchecked") 
     public void initBeforeContents(FacesContext arg0) throws FacesException { 
      try { 
      UIDataView viewtable = new UIDataView(); 
      viewtable.setColumnTitles(true); 
      CategoryColumn categoryColumn = new CategoryColumn(); 
      categoryColumn.setComponent(viewtable); 
      categoryColumn.setColumnName("form"); 
      categoryColumn.setColumnTitle("form"); 
      categoryColumn.setContentType("text"); 
      viewtable.addCategoryColumn(categoryColumn); 

      DominoViewData data = new DominoViewData(); 
      data.setComponent(viewtable); 
      data.setViewName("142342"); 
      data.setVar("view2"); 
      viewtable.setData(data); 
      viewtable.setId("dataView1"); 
      viewtable.setRows(3); 
      SummaryColumn summaryColumn = new SummaryColumn(); 
      summaryColumn.setComponent(viewtable); 
      summaryColumn.setColumnName("5"); 
      summaryColumn.setColumnTitle("5"); 
      viewtable.setSummaryColumn(summaryColumn); 


      XspPager pager = new XspPager(); 
      pager.setPartialRefresh(true); 
      pager.setLayout("Previous Group Next"); 
      pager.setId("pager1"); 

      viewtable.getChildren().add(pager); 

      this.getChildren().add(viewtable); 
      } catch (Exception e) { 
       e.printStackTrace(); 

      } 
     } 
     public void buildContents(FacesContext arg0, FacesComponentBuilder arg1) throws FacesException { 
       ..... 
     } 

     public void initAfterContents(FacesContext arg0) throws FacesException { 
      .... 
     } 

    } 

回答

1

我還沒有嘗試過這一點,但我想你想將其添加爲viewTable的一個方面而不是一個孩子。

所以你行應

viewtable.getFacets().put("headerPager", pager); 
+0

我覺得託比在指向正確的方向。查看在標準XPage中使用數據表和尋呼機時生成的Java(在本地文件夾中) – stwissel 2012-08-09 17:08:09