Package org.jboss.dashboard.provider

Examples of org.jboss.dashboard.provider.DataFormatterRegistry


    public static String generateKPIValuesArray(KPI kpi) {

        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet == null) return null;

        DataFormatterRegistry dataFormatterRegistry = DataFormatterRegistry.lookup();
        StringBuffer buf = new StringBuffer();
        buf.append("new String[][] {");
        for (int i = 0; i < dataSet.getRowCount(); i++) {
            buf.append("\n{");

            for (int j = 0; j < dataSet.getProperties().length; j++) {
                Object dataSetValue = dataSet.getValueAt(i, j);
                DataProperty prop = dataSet.getPropertyByColumn(j);
                DataPropertyFormatter propFormatter = dataFormatterRegistry.getPropertyFormatter(prop.getPropertyId());
                String displayedValue = propFormatter.formatValue(prop, dataSetValue, Locale.ENGLISH);

                if (j > 0) buf.append(",");
                buf.append("\"" + displayedValue + "\"");
            }
View Full Code Here


        if (holder.value == null) return null;
        return holder.value.toString();
    }

    public String getDescription(Locale l) {
        DataFormatterRegistry dfr = DataFormatterRegistry.lookup();
        DataProperty property = getDomain().getProperty();
        if (property == null) return getLabel();

        DataPropertyFormatter dpf = dfr.getPropertyFormatter(property.getPropertyId());
        return dpf.formatValue(property, getLabel(), l);
    }
View Full Code Here

    public void setLabel(String label) {
        this.label = label;
    }

    public String getDescription(Locale l) {
        DataFormatterRegistry dfr = DataFormatterRegistry.lookup();
        DataProperty property = getDomain().getProperty();
        if (property == null) return label;

        DataPropertyFormatter dpf = dfr.getPropertyFormatter(property.getPropertyId());
        return dpf.formatValue(property, label, l);
    }
View Full Code Here

        if (holder.value == null) return null;
        return holder.value.toString();
    }

    public String getDescription(Locale l) {
        DataFormatterRegistry dfr = DataFormatterRegistry.lookup();
        DataProperty property = getDomain().getProperty();
        if (property == null) return getLabel();

        DataPropertyFormatter dpf = dfr.getPropertyFormatter(property.getPropertyId());
        return dpf.formatValue(property, getLabel(), l);
    }
View Full Code Here

    public String getLabel() {
        return holder.value.toString();
    }

    public String getDescription(Locale l) {
        DataFormatterRegistry dfr = DataFormatterRegistry.lookup();
        DataProperty property = getDomain().getProperty();
        if (property == null) return getLabel();

        DataPropertyFormatter dpf = dfr.getPropertyFormatter(property.getPropertyId());
        return dpf.formatValue(property, getLabel(), l);
    }
View Full Code Here

     * @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, int x, int y, String expected) {
        Locale locale = Locale.ENGLISH;
        DataFormatterRegistry dataFormatterRegistry = DataFormatterRegistry.lookup();
        Object value = dataSet.getValueAt(x,y);

        DataProperty prop = dataSet.getPropertyByColumn(y);
        DataPropertyFormatter propFormatter = dataFormatterRegistry.getPropertyFormatter(prop.getPropertyId());
        String displayedValue = propFormatter.formatValue(prop, value, locale);
        if (!displayedValue.equals(expected)) {
            fail("Data set value [" + x + "," + y + "] is different. " +
                    "Column=\"" + prop.getPropertyId() + "\" " +
                    "Actual=\"" + displayedValue + "\" Expected=\"" + expected + "\"");
View Full Code Here

     * @param expected The expected row values.
     * @param index The starting data set row index where the comparison starts.
     */
    public static void assertDataSetValues(DataSet dataSet, String[][] expected, int index) {
        Locale locale = Locale.ENGLISH;
        DataFormatterRegistry dataFormatterRegistry = DataFormatterRegistry.lookup();

        // Check size
        assertThat(dataSet.getRowCount()).isGreaterThan(index);

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

            // Check row values
            for (int j = 0; j < row.length; j++) {
                Object dataSetValue = dataSet.getValueAt(i, j);
                DataProperty prop = dataSet.getPropertyByColumn(j);

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

                // Compare the data set value with the value the user is expecting to see.
                DataPropertyFormatter propFormatter = dataFormatterRegistry.getPropertyFormatter(prop.getPropertyId());
                String displayedValue = propFormatter.formatValue(prop, dataSetValue, locale);
                if (!displayedValue.equals(expectedValue)) {
                    fail("Data set value [" + i + "," + j + "] is different. " +
                            "Column=\"" + prop.getPropertyId() + "\" " +
                            "Actual=\"" + displayedValue + "\" Expected=\"" + expectedValue + "\"");
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.provider.DataFormatterRegistry

Copyright © 2018 www.massapicom. 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.