writer.startElement(HtmlConstants.INPUT_ELEM, component);
// TODO nick - selection input id should use constants/be a method
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ":si", null);
writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, component.getClientId(context) + ":si", null);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
UIDataTableBase table = (UIDataTableBase) component;
StringBuilder builder = new StringBuilder("|");
Object key = table.getRowKey();
table.captureOrigValue(context);
SequenceRange range = (SequenceRange) table.getComponentState().getRange();
int first = range.getFirstRow();
int last = first + range.getRows() - 1;
Map<String, Object> attributes = component.getAttributes();
table.setRowKey(attributes.get("activeRowKey"));
int activeIndex = table.getRowIndex();
if (activeIndex > 0) {
if (activeIndex < first) {
builder.append(ClientSelection.FLAG_BEFORE_RANGE);
} else if (activeIndex > last) {
builder.append(ClientSelection.FLAG_AFTER_RANGE);
}
}
builder.append("|");
table.setRowKey(attributes.get("shiftRowKey"));
int shiftIndex = table.getRowIndex();
if (shiftIndex > 0) {
if (shiftIndex < first) {
builder.append(ClientSelection.FLAG_BEFORE_RANGE);
} else if (shiftIndex > last) {
builder.append(ClientSelection.FLAG_AFTER_RANGE);
}
}
builder.append("|");
table.setRowKey(context, key);
table.restoreOrigValue(context);
writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, builder.toString(), null);
writer.endElement(HtmlConstants.INPUT_ELEM);
}