All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tsl2.nano.collection.FormTable Maven / Gradle / Ivy

There is a newer version: 2.5.1
Show newest version
/*
 * File: $HeadURL$
 * Id  : $Id$
 * 
 * created by: Thomas Schneider
 * created on: Nov 19, 2012
 * 
 * Copyright: (c) Thomas Schneider 2012, all rights reserved
 */
package de.tsl2.nano.collection;

import java.text.Format;

import de.tsl2.nano.core.util.DefaultFormat;

/**
 * Simple extension of {@link TableList} to get formatted values.
 * 
 * @author Thomas Schneider
 * @version $Revision$
 */
public class FormTable, ID> extends TableList {

    /**
     * see {@link TableList#TableList(Class, int)}
     */
    @SuppressWarnings("unchecked")
    public FormTable(int columnCount) {
        //don't use the generic type H (Class) to be compilable on standard jdk javac.
        super((Class) DefaultFormat.class, columnCount);
    }

    /**
     * see {@link TableList#TableList(Object...)}
     */
    public FormTable(Format... header) {
        super((H[]) header);
    }

    /**
     * get formatted cell value. see {@link TableList#get(int, int)}
     */
    @Override
    public Object get(int row, int column) {
        Object value = super.get(row, column);
        return header[column].format(value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy