|
Adding the component to JSF components tree at run-time |
|
TabbedPanel component may be added to JSF components tree at runtime. To accomplish that the following steps should be used :
| 1. | Create helper class like: |
public class AddTabbedPanel extends AddComponent {
protected UIComponent getInstance() {
TabbedPanel tabbedPanel = new TabbedPanel();
tabbedPanel.setListDataModel(new TabbedPanelDataModelBean());
tabbedPanel.setListSelectionModel(new TabbedPanelSelectionModelBean());
tabbedPanel.setImagesWidth(32);
tabbedPanel.setImagesHeight(32);
tabbedPanel.setOrientation("HORIZONTAL");
tabbedPanel.setWidth("100%");
tabbedPanel.setStyle("border:1px solid black");
tabbedPanel.setTabComponentImageWidth(32);
tabbedPanel.setTabComponentImageHeight(32);
tabbedPanel.setTabComponentSmallImageWidth(16);
tabbedPanel.setTabComponentSmallImageHeight(16);
tabbedPanel.setKindOfImagesUsedTabComponent("BIG");
tabbedPanel.setTabComponentHLightStyle("color: gray; background-color: cyan;");
tabbedPanel.setTabComponentActiveStyle("color : white; background-color: maroon;");
tabbedPanel.setTabComponentStyle("color: gray; font-family:Arial; background-color: silver;");
tabbedPanel.addComponentListener("testingapplication.tabbedPanel.MyTabSelectedListener");
tabbedPanel.setServerSideAction(true);
return tabbedPanel;
}
protected String getComponentID() {
return "tabbedpanel1";
}
}
| 2. | Define the following construction in JSP: |
<h:form id="form1">
<h:commandButton id="addComponent" value="Add Tabbed Panel">
<f:actionListener type="testingapplication.tabbedPanel.AddTabbedPanel"/>
</h:commandButton>
<h:panelGrid id="panelgrid1" columns="1">
</h:panelGrid>
</h:form>
See additional documentation in the chapter: Ability to add WebGalileo Faces component to JSF components tree at run-time