public void encodeEnd(FacesContext context, ResponseWriter writer,
UIComponent column, String facetName, boolean sortableColumn)
throws IOException {
if (column instanceof UIColumn) {
UIColumn dataColumn = (UIColumn) column;
String clientId = dataColumn.getClientId(context) + facetName;
String tableId = dataColumn.getParent().getClientId(context);
if (sortableColumn) {
String imageUrl = null;
if (Ordering.ASCENDING.equals(dataColumn.getSortOrder())) {
if (null != dataColumn.getSortIconAscending()) {
imageUrl = dataColumn.getSortIconAscending();
} else {
imageUrl = getResource(
TriangleIconUp.class.getName()).getUri(
context, null);
}
} else if (Ordering.DESCENDING.equals(dataColumn
.getSortOrder())) {
if (null != dataColumn.getSortIconDescending()) {
imageUrl = dataColumn.getSortIconDescending();
} else {
imageUrl = getResource(
TriangleIconDown.class.getName()).getUri(
context, null);
}
} else if (dataColumn.isSelfSorted()) {
if (null != dataColumn.getSortIcon()) {
imageUrl = dataColumn.getSortIcon();
} else {
imageUrl = getResource(
DataTableIconSortNone.class.getName())
.getUri(context, null);
}
}
if (imageUrl != null) {
writer.startElement(HTML.IMG_ELEMENT, column);
writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl,
null);
writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
writer
.writeAttribute(HTML.height_ATTRIBUTE, "15",
null);
writer.writeAttribute(HTML.class_ATTRIBUTE,
"extdt-header-sort-img", null);
writer.endElement(HTML.IMG_ELEMENT);
}
writer.endElement(HTML.SPAN_ELEM);
}
writer.endElement(HTML.DIV_ELEM);
// drag source area
writer.endElement(HTML.DIV_ELEM);
String dragSourceId = tableId + "_hdrag_" + dataColumn.getId();
String indicatorId = tableId + ":dataTable_indicator";
renderDragSupport(context, dataColumn, dragSourceId,
indicatorId, (String)dataColumn.getAttributes().get("label"));
// separator area
writer.startElement(HTML.SPAN_ELEM, column);
writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + ":sepSpan",
null);
writer
.writeAttribute(HTML.class_ATTRIBUTE, "extdt-hsep",
null);
writer.endElement(HTML.SPAN_ELEM);
// drop target area LEFT
String spanId = tableId + "_hdrop_" + dataColumn.getId()
+ "left";
writer.startElement(HTML.SPAN_ELEM, column);
writer.writeAttribute(HTML.id_ATTRIBUTE, spanId, null);
writer.writeAttribute(HTML.class_ATTRIBUTE, "extdt-hdrop",
null);
writer.writeAttribute(HTML.style_ATTRIBUTE,
"visibility: hidden;", null);
writer.startElement(HTML.SPAN_ELEM, column);
writer.writeAttribute(HTML.class_ATTRIBUTE,
"extdt-hdrop-top extdt-hdrop-top-left", null);
writer.writeAttribute(HTML.style_ATTRIBUTE,
"visibility: hidden;", null);
writer.endElement(HTML.SPAN_ELEM);
writer.startElement(HTML.SPAN_ELEM, column);
writer.writeAttribute(HTML.class_ATTRIBUTE,
"extdt-hdrop-bottom extdt-hdrop-bottom-left", null);
writer.writeAttribute(HTML.style_ATTRIBUTE,
"visibility: hidden;", null);
writer.endElement(HTML.SPAN_ELEM);
writer.endElement(HTML.SPAN_ELEM);
renderDropSupport(context, dataColumn, spanId, true);
// drop target area RIGHT
spanId = tableId + "_hdrop_" + dataColumn.getId() + "right";
writer.startElement(HTML.SPAN_ELEM, column);
writer.writeAttribute(HTML.id_ATTRIBUTE, spanId, null);
writer.writeAttribute(HTML.class_ATTRIBUTE, "extdt-hdrop",
null);
writer.writeAttribute(HTML.style_ATTRIBUTE,