* @author Dmitry Pikhulya
*/
public class ColumnReorderingRenderer extends RendererBase {
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
ColumnReordering cr = (ColumnReordering) component;
AbstractTable table = cr.getTable();
StyleParam draggedCellStyle = new StyleParam(cr, "draggedCell", "o_table_draggedColumn");
StyleParam autoScrollAreaStyle = new StyleParam(cr, "autoScrollArea", "o_headerAutoScrollArea");
StyleParam dropTargetStyle = new StyleParam(cr, "dropTarget", "o_table_columnDropTarget");
Styles.renderStyleClasses(context, cr);
// important: style rendering is made earlier than init function deliberately to allow script to
// inspect styles dynamically
Rendering.renderInitScript(context,
new ScriptBuilder().initScript(context, table,
"O$.Table._initColumnReordering",
draggedCellStyle,
cr.getDraggedCellTransparency(),
autoScrollAreaStyle,
cr.getAutoScrollAreaTransparency(),
Resources.getURL(context, cr.getAutoScrollLeftImageUrl(), null, "table/autoScrollLeft.gif"),
Resources.getURL(context, cr.getAutoScrollRightImageUrl(), null, "table/autoScrollRight.gif"),
dropTargetStyle,
Resources.getURL(context, cr.getDropTargetTopImageUrl(), null, "table/dropTargetTop.gif"),
Resources.getURL(context, cr.getDropTargetBottomImageUrl(), null, "table/dropTargetBottom.gif")
),
AbstractTableRenderer.getTableJsURL(context)
);
}