@SuppressWarnings("unchecked")
private void encodeMarkup(FacesContext facesContext, PickList pickList) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
String clientId = pickList.getClientId(facesContext);
String widgetVar = createUniqueWidgetVar(facesContext, pickList);
DualListModel model = (DualListModel) pickList.getValue();
writer.startElement("table", pickList);
writer.writeAttribute("id", clientId, "id");
if(pickList.getStyle() != null) writer.writeAttribute("style", pickList.getStyle(), null);
if(pickList.getStyleClass() != null) writer.writeAttribute("class", pickList.getStyleClass(), null);
writer.startElement("tbody", null);
writer.startElement("tr", null);
//Source
writer.startElement("td", null);
encodeList(facesContext, pickList, clientId + "_source", widgetVar, "pf-picklist-source", model.getSource());
writer.endElement("td");
//Controls
writer.startElement("td", null);
if(pickList.getFacetCount() > 0) {
encodeFacet(facesContext, pickList, widgetVar, "add");
encodeFacet(facesContext, pickList, widgetVar, "addAll");
encodeFacet(facesContext, pickList, widgetVar, "remove");
encodeFacet(facesContext, pickList, widgetVar, "removeAll");
} else {
encodeDefaultControl(facesContext, pickList, widgetVar, ">", "add");
encodeDefaultControl(facesContext, pickList, widgetVar, ">>", "addAll");
encodeDefaultControl(facesContext, pickList, widgetVar, "<", "remove");
encodeDefaultControl(facesContext, pickList, widgetVar, "<<", "removeAll");
}
writer.endElement("td");
//Target
writer.startElement("td", null);
encodeList(facesContext, pickList, clientId + "_target", widgetVar, "pf-picklist-target", model.getTarget());
writer.endElement("td");
writer.endElement("tr");
writer.endElement("tbody");