protected void encodeMarkup(FacesContext context, AccordionPanel acco) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = acco.getClientId(context);
    String widgetVar = acco.resolveWidgetVar();
    String styleClass = acco.getStyleClass();
    styleClass =
        styleClass == null
            ? AccordionPanel.CONTAINER_CLASS
            : AccordionPanel.CONTAINER_CLASS + " " + styleClass;

    if (ComponentUtils.isRTL(context, acco)) {
      styleClass = styleClass + " ui-accordion-rtl";
    }

    writer.startElement("div", null);
    writer.writeAttribute("id", clientId, null);
    writer.writeAttribute("class", styleClass, null);
    if (acco.getStyle() != null) {
      writer.writeAttribute("style", acco.getStyle(), null);
    }

    writer.writeAttribute("role", "tablist", null);

    writer.writeAttribute(HTML.WIDGET_VAR, widgetVar, null);

    encodeTabs(context, acco);

    encodeStateHolder(context, acco);

    writer.endElement("div");
  }
  protected void encodeMarkup(FacesContext context, DataTable table) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = table.getClientId(context);
    boolean scrollable = table.isScrollable();
    boolean hasPaginator = table.isPaginator();
    String style = table.getStyle();
    String paginatorPosition = table.getPaginatorPosition();

    // style class
    String containerClass =
        scrollable
            ? DataTable.CONTAINER_CLASS + " " + DataTable.SCROLLABLE_CONTAINER_CLASS
            : DataTable.CONTAINER_CLASS;
    containerClass =
        table.getStyleClass() != null
            ? containerClass + " " + table.getStyleClass()
            : containerClass;
    if (table.isResizableColumns())
      containerClass = containerClass + " " + DataTable.RESIZABLE_CONTAINER_CLASS;
    if (ComponentUtils.isRTL(context, table))
      containerClass = containerClass + " " + DataTable.RTL_CLASS;

    // default sort
    if (!table.isDefaultSorted() && table.getSortBy() != null && !table.isLazy()) {
      SortFeature sortFeature = (SortFeature) table.getFeature(DataTableFeatureKey.SORT);

      if (table.isMultiSort()) sortFeature.multiSort(context, table);
      else sortFeature.singleSort(context, table);

      table.setDefaultSorted();
    }

    if (hasPaginator) {
      table.calculateFirst();
    }

    writer.startElement("div", table);
    writer.writeAttribute("id", clientId, "id");
    writer.writeAttribute("class", containerClass, "styleClass");
    if (style != null) {
      writer.writeAttribute("style", style, "style");
    }

    encodeFacet(context, table, table.getHeader(), DataTable.HEADER_CLASS);

    if (hasPaginator && !paginatorPosition.equalsIgnoreCase("bottom")) {
      encodePaginatorMarkup(context, table, "top");
    }

    if (scrollable) {
      encodeScrollableTable(context, table);
    } else {
      encodeRegularTable(context, table);
    }

    if (hasPaginator && !paginatorPosition.equalsIgnoreCase("top")) {
      encodePaginatorMarkup(context, table, "bottom");
    }

    encodeFacet(context, table, table.getFooter(), DataTable.FOOTER_CLASS);

    if (table.isSelectionEnabled()) {
      encodeStateHolder(
          context,
          table,
          table.getClientId(context) + "_selection",
          table.getSelectedRowKeysAsString());
    }

    if (table.isDraggableColumns()) {
      encodeStateHolder(context, table, table.getClientId(context) + "_columnOrder", null);
    }

    if (scrollable) {
      encodeStateHolder(
          context, table, table.getClientId(context) + "_scrollState", table.getScrollState());
    }

    writer.endElement("div");
  }