...">

Add a face to the bean surface panel

<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());

I want to add f:facetto the panel from the bean. I added a dynamic panel Ruler and its panels dynamically from the bean shown in the above code. I tried to add a face with the code below, but failed.

 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);
+4
source share
1 answer

The PrimeFaces panel does not have a facet label. So this will never work, even in xhtml (as I pointed out). Try a header cell that will work

0
source

Source: https://habr.com/ru/post/1619616/


All Articles