Search in sources :

Example 1 with DataEncoderTabImpl

use of com.liferay.faces.alloy.component.tab.internal.DataEncoderTabImpl in project liferay-faces-alloy by liferay.

the class TabViewRenderer method encodeChildren.

@Override
public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException {
    // Get the "value" and "var" attributes of the TabView component and determine if iteration should take place
    // using a prototype child tab.
    TabView tabView = (TabView) uiComponent;
    Integer selectedIndex = tabView.getSelectedIndex();
    boolean iterateOverDataModel = DataEncoderBase.isIterateOverDataModel(tabView);
    // Encode the starting <ul> unordered list element that represents the list of clickable tabs.
    ResponseWriter responseWriter = facesContext.getResponseWriter();
    responseWriter.startElement("ul", tabView);
    responseWriter.writeAttribute("class", "nav nav-tabs", null);
    DataEncoderBase dataEncoder = new DataEncoderTabHeaderImpl(selectedIndex);
    dataEncoder.encodeColumns(facesContext, tabView, iterateOverDataModel);
    responseWriter.endElement("ul");
    // Encode the starting <div> element that represents the content for the selected tab.
    responseWriter.startElement("div", uiComponent);
    responseWriter.writeAttribute("class", "tab-content", null);
    // Encode the content for each tab.
    dataEncoder = new DataEncoderTabImpl();
    dataEncoder.encodeColumns(facesContext, tabView, iterateOverDataModel);
    tabView.setRowIndex(-1);
    // Encode the closing </div> element for the content.
    responseWriter.endElement("div");
}
Also used : TabView(com.liferay.faces.alloy.component.tabview.TabView) ResponseWriter(javax.faces.context.ResponseWriter) DataEncoderBase(com.liferay.faces.alloy.component.data.internal.DataEncoderBase) DataEncoderTabImpl(com.liferay.faces.alloy.component.tab.internal.DataEncoderTabImpl)

Aggregations

DataEncoderBase (com.liferay.faces.alloy.component.data.internal.DataEncoderBase)1 DataEncoderTabImpl (com.liferay.faces.alloy.component.tab.internal.DataEncoderTabImpl)1 TabView (com.liferay.faces.alloy.component.tabview.TabView)1 ResponseWriter (javax.faces.context.ResponseWriter)1