tableMap = new HashMap();
MapValue tableState = new MapValue(tableMap);
store.put(id, tableState);
} else {
tableMap = idResource.getMap();
Value sortedByValue = (Value)idResource.getMap().get(TableHandler.SORTED_BY);
if ( sortedByValue != null && sortedByValue != NullValue.NULL ) sortedBy = sortedByValue.toString();
Value orderValue = (Value)idResource.getMap().get(TableHandler.ORDER);
if ( orderValue != null && orderValue != NullValue.NULL ) order = orderValue.toString();
Value sizeValue = (Value)idResource.getMap().get(TableHandler.SIZE);
if ( sizeValue != null && sizeValue != NullValue.NULL ) size = ((MapValue)sizeValue).getMap();
}
// create headers and columns and call super...
StringBuffer headersBuffer = new StringBuffer(1024);
Value []columns = ((ArrayValue)parameter.get(COLUMNS_PARAMETER)).getArray();
for ( int i = 0; i < columns.length; i++ ) {
Map columnMap = ((MapValue)columns[i]).getMap();
boolean sortable = ((BooleanValue)columnMap.get(SORTABLE)).booleanValue();
if ( ascendingHeaderColumnTemplate == null || descendingHeaderColumnTemplate == null ) sortable = false;
boolean resizable = ((BooleanValue)columnMap.get(RESIZABLE)).booleanValue();
Value header = (Value)columnMap.get(HEADER);
Map columnHeaderParameters = new HashMap();
columnHeaderParameters.putAll(parameter);
columnHeaderParameters.putAll(columnMap);
Template template = headerColumnTemplate;
String key = columnMap.get(KEY).toString();
template = headerColumnTemplate;
if ( resizable && collapsedColumnTemplate != null && collapsedHeaderColumnTemplate != null ) {
if ( size != null && TableHandler.COLLAPSED.equals(size.get(key))) {
createResizableHandler(key, TableHandler.EXPAND, handlerUrl, storeName, id, columnHeaderParameters, parameters);
template = collapsedHeaderColumnTemplate;
} else {
createResizableHandler(key, TableHandler.COLLAPSE, handlerUrl, storeName, id, columnHeaderParameters, parameters);
}
}
if ( sortable && template != collapsedHeaderColumnTemplate ) {
String requestedOrder = TableHandler.ASCENDING;
if ( sortedBy != null && sortedBy.equals(key) ) {
if ( order.equals(TableHandler.ASCENDING) ) {
template = ascendingHeaderColumnTemplate;
requestedOrder = TableHandler.DESCENDING;
} else {
template = descendingHeaderColumnTemplate;
requestedOrder = TableHandler.ASCENDING;
}
}
createSortableHandler(key, requestedOrder, handlerUrl, storeName, id, columnHeaderParameters, parameters);
}
template.evaluate(headersBuffer, columnHeaderParameters);
}
parameter.put(HEADERS, new StringValue(headersBuffer.toString()));
Value []input = ((ArrayValue)parameter.get(SimpleProcessor.INPUT)).getArray();
for ( int i = 0; i < input.length; i++ ) {
StringBuffer columnsBuffer = new StringBuffer(1024);
Map inputParameter = ((MapValue)input[i]).getMap();
for ( int j = 0; j < columns.length; j++ ) {
Map columnMap = ((MapValue)columns[j]).getMap();
boolean replaceColumn = ((BooleanValue)columnMap.get(REPLACE_COLUMN)).booleanValue();
Value processorUri = (Value)columnMap.get(PROCESSOR);
Map columnParameters = new HashMap();
columnParameters.putAll(parameter);
String key = columnMap.get(KEY).toString();
String name = columnMap.get(NAME).toString();
Object value = columnMap.get(VALUE);
if ( value == null || value == NullValue.NULL ) {
value = inputParameter.get(key);
}
columnParameters.put(name, value);
if ( processorUri != NullValue.NULL ) {
Processor processor = ProcessorManager.getInstance().getProcessor((URI)processorUri);
Value processorParameters = (Value)columnMap.get(PARAMETERS);
if ( processorParameters instanceof MapValue ) {
columnParameters.putAll(((MapValue)processorParameters).getMap());
}
Result processorResult = ProcessorManager.process(processor, columnParameters, context);
String resultKey = columnMap.get(RESULT).toString();
Value resultEntry = (Value)processorResult.getResultEntries().get(resultKey);
if ( resultEntry instanceof PrintableValue ) {
if ( replaceColumn ) {
((PrintableValue)resultEntry).print(columnsBuffer);
} else {
StringBuffer resultBuffer = new StringBuffer();