Examples of DataColumn


Examples of org.dashbuilder.dataset.DataColumn

     * @param x The x position of the cell to check (starting at 0).
     * @param y The y position of the cell to check (starting at 0).
     * @param expected The expected value in the given cell.
     */
    public static void assertDataSetValue(DataSet dataSet, DataSetFormatter formatter, int x, int y, String expected) {
        DataColumn col = dataSet.getColumnByIndex(y);
        String displayedValue = formatter.formatValueAt(dataSet, x, y);
        if (!displayedValue.equals(expected)) {
            fail("Data set value [" + x + "," + y + "] is different. " +
                    "Column=\"" + col.getId() + "\" " +
                    "Actual=\"" + displayedValue + "\" Expected=\"" + expected + "\"");
        }
    }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        for (int i = index; i < expected.length; i++) {
            String[] row = expected[i];

            // Check row values
            for (int j = 0; j < row.length; j++) {
                DataColumn col = dataSet.getColumnByIndex(j);

                String expectedValue = row[j];
                if (expectedValue == null) continue;

                // Compare the data set value with the value the user is expecting to see.
                String displayedValue = formatter.formatValueAt(dataSet, i, j);
                if (!displayedValue.equals(expectedValue)) {
                    fail("Data set value [" + i + "," + j + "] is different. " +
                            "Column=\"" + col.getId() + "\" " +
                            "Actual=\"" + displayedValue + "\" Expected=\"" + expectedValue + "\"");
                }
            }
        }
    }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        else return numberPattern.charAt(5);
    }

    public String formatValueAt(DataSet dataSet, int row, int col) {
        Object val = dataSet.getValueAt(row, col);
        DataColumn column = dataSet.getColumnByIndex(col);
        if (ColumnType.DATE.equals(column.getColumnType())) {
            return dateFormat.format(val);
        }
        if (ColumnType.NUMBER.equals(column.getColumnType())) {
            return numberFormat.format(val);
        }
        return val.toString();
    }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        DataSet dataSet = ctx.getDataSet();

        // Create the comparator.
        DataSetRowComparator comparator = new DataSetRowComparator();
        for (ColumnSort columnSort : columnSortList) {
            DataColumn column = dataSet.getColumnById(columnSort.getColumnId());
            if (column == null) throw new IllegalArgumentException("Column not found in data set: " + columnSort.getColumnId());

            comparator.criteria(column, columnSort.getOrder());
        }
        // Create the row number list to sort.
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        else if (row1 != null && row2 == null) return 1;
        else if (row1 == null) return 0;

        // Compare the two rows.
        for (int i=0; i<columns.size(); i++) {
            DataColumn column = columns.get(i);
            SortOrder order = orders.get(i);
            Comparable value1 = (Comparable) column.getValues().get(row1);
            Comparable value2 = (Comparable) column.getValues().get(row2);
            int comp = ComparatorUtils.compare(value1, value2, order.asInt());
            if (comp != 0) return comp;
        }
        return 0;
    }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        if (rowCountNonTrimmed == -1) return getRowCount();
        return rowCountNonTrimmed;
    }

    public Object getValueAt(int row, String columnId) {
        DataColumn columnObj = getColumnById(columnId);
        return getValueAt(row, columnObj);
    }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        DataColumn columnObj = getColumnById(columnId);
        return getValueAt(row, columnObj);
    }

    public Object getValueAt(int row, int column) {
        DataColumn columnObj = getColumnByIndex(column);
        return getValueAt(row, columnObj);
    }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        }
        return column.getValues().get(row);
    }

    public DataSet setValueAt(int row, int column, Object value) {
        DataColumn columnObj = getColumnByIndex(column);

        List l = columnObj.getValues();
        if (row > l.size()) {
            throw new IllegalArgumentException("The row index " + row + " is out of bounds: " + (l.size()-1));
        }

        if (row == l.size()) l.add(value);
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

        }

        DataSetImpl other = cloneEmpty();
        other.rowCountNonTrimmed = getRowCount();
        for (int i=0; i<columns.size(); i++) {
            DataColumn column = columns.get(i);
            DataColumn colOther = other.getColumns().get(i);
            List values = column.getValues();
            List valOther = colOther.getValues();
            for (int j=offset; j<values.size() && j<( offset+rows ); j++) {
                Object value = values.get(j);
                valOther.add(value);
            }
        }
View Full Code Here

Examples of org.dashbuilder.dataset.DataColumn

    }

    public DataSetImpl cloneEmpty() {
        DataSetImpl other = new DataSetImpl();
        for (int i=0; i<columns.size(); i++) {
            DataColumn column = columns.get(i);
            other.addColumn(column.getId(), column.getColumnType());
        }
        return other;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.