Search in sources :

Example 1 with RawCellModel

use of com.developmentontheedge.be5.query.impl.model.TableModel.RawCellModel in project be5 by DevelopmentOnTheEdge.

the class PropertiesToRowTransformer method collectCells.

/**
 * Glues and constructs cells.
 * @see # preprocessProperties(DatabaseConnector, List<DynamicProperty>, Map<String, DynamicProperty>)
 */
List<RawCellModel> collectCells() {
    // TODO support: collect all values, GLUE_COLUMN_PREFIX
    // // mutable map of properties
    // Map<String, StringBuilder> temp = new LinkedHashMap<>();
    // 
    // // see RecordEx#preprocessProperties/3
    // for( DynamicProperty property : properties )
    // {
    // String name = property.getName();
    // if( name.startsWith( RecordEx.GLUE_COLUMN_PREFIX ) )
    // {
    // appendProperty( property, temp );
    // continue;
    // }
    // temp.put( name, new StringBuilder( toString( property ) ) );
    // }
    // 
    // List<RawCellModel> cells = new ArrayList<>();
    // 
    // // collect all values
    // for( Entry<String, StringBuilder> entry : temp.entrySet() )
    // {
    // String cellName = entry.getKey();
    // String cellContent = entry.getValue().toString();
    // boolean hidden = shouldBeSkipped( cellName );
    // cells.add( new RawCellModel( cellName, localizer.localize( cellContent ), null, hidden ) );
    // }
    List<RawCellModel> cells = new ArrayList<>();
    for (DynamicProperty property : properties) {
        String cellName = property.getName();
        Object cellContent = formatValue(property);
        boolean hidden = shouldBeSkipped(cellName);
        cells.add(new RawCellModel(cellName, cellContent, DynamicPropertyMeta.get(property), hidden));
    }
    return cells;
}
Also used : RawCellModel(com.developmentontheedge.be5.query.impl.model.TableModel.RawCellModel) DynamicProperty(com.developmentontheedge.beans.DynamicProperty) ArrayList(java.util.ArrayList)

Aggregations

RawCellModel (com.developmentontheedge.be5.query.impl.model.TableModel.RawCellModel)1 DynamicProperty (com.developmentontheedge.beans.DynamicProperty)1 ArrayList (java.util.ArrayList)1