<h:form>
<p:dashboard id="board"
binding="#{fundamentFormCreatorBean.dashboard}">
</p:dashboard>
</h:form>
FacesContext fc = FacesContext.getCurrentInstance();
Application application = fc.getApplication();
dashboard = (Dashboard) application.createComponent(fc,
"org.primefaces.component.Dashboard",
"org.primefaces.component.DashboardRenderer");
dashboard.setId("dashboard");
DashboardModel model = new DefaultDashboardModel();
column1 = new DefaultDashboardColumn();
Panel panel = (Panel) application.createComponent(fc,
"org.primefaces.component.Panel",
"org.primefaces.component.PanelRenderer");
panel.setId("UniqueId");
panel.setHeader("panelName");
panel.setClosable(true);
dashboard.getChildren().add(panel);
column1.addWidget(panel.getId());
我想在bean的面板中添加f:facet
。我已经从上面代码中显示的bean动态添加了 Primefaces仪表板及其面板。我尝试使用下面的代码添加一个方面,但没有成功。
HtmlGraphicImage oTabImage= new HtmlGraphicImage();
oTabImage.setValue("/images/tabicon.jpg");
HtmlOutputText oText = new HtmlOutputText();
oText.setValue("Here is my label");
HtmlPanelGroup oGroup = new HtmlPanelGroup();
oGroup.getChildren().add(oText);
oGroup.getChildren().add(oTabImage);
panel.getFacets().put("label", oGroup);