Package org.jboss.dashboard.provider

Examples of org.jboss.dashboard.provider.DataPropertyFormatter


            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 + "\"");
            }
            buf.append("}");
View Full Code Here


                List allowedValues = new ArrayList();
                String[] allowedArray = StringUtils.split(staticProperty.getProperty("allowedvalues"), ",");
                for (int j = 0; allowedArray != null && j < allowedArray.length; j++) {
                    String allowedStr = allowedArray[j];
                    try {
                        DataPropertyFormatter dpf = DataFormatterRegistry.lookup().getPropertyFormatter(propertyId);
                        allowedValues.add(dpf.parsePropertyValue(getStaticPropertyClass(propertyId), allowedStr));
                    } catch (Exception e) {
                        log.error("Can not  parse static prpoerty allowed value: " + allowedStr);
                        continue;
                    }
                }
View Full Code Here

    /**
     * Get the class for a given property.
     */
    public Class getPropertyClass(String propertyId) {
        DataPropertyFormatter dpf = DataFormatterRegistry.lookup().getPropertyFormatter(propertyId);
        DataProperty property = dashboard.getDataPropertyById(propertyId);
        if (property != null) return dpf.getPropertyClass(property);
        return getStaticPropertyClass(propertyId);
    }
View Full Code Here

    }

    // AbstractFilter implementation

    protected String formatForDisplay(String propertyId, Object value) {
        DataPropertyFormatter formatter = DataFormatterRegistry.lookup().getPropertyFormatter(propertyId);
        return formatter.formatValue(propertyId, value, LocaleManager.currentLocale());
    }
View Full Code Here

        DashboardFilter dashboardFilter = (DashboardFilter) dataFilter;
        DashboardFilterProperty filterProp = dashboardFilter.getFilterPropertyById(propId);
        if (filterProp == null) return "[" + name + ", property '" + propId + "' not found]";

        String commandName = getName();
        DataPropertyFormatter dpf = DataFormatterRegistry.lookup().getPropertyFormatter(propId);
        Locale locale = LocaleManager.currentLocale();
       
        if (FILTER_MIN_VALUE.equals(commandName)) {
            Comparable min = filterProp.getPropertyMinValue();
            return dpf.formatValue(propId, min, locale);
        }
        if (FILTER_MAX_VALUE.equals(commandName)) {
            Comparable max = filterProp.getPropertyMaxValue();
            return dpf.formatValue(propId, max, locale);
        }
        if (FILTER_SELECTED.equals(commandName)) {
            List values = filterProp.getPropertySelectedValues();
            if (values.isEmpty()) return null;

            Collections.sort(values);
            String separator = getArgument(1);
            if (separator == null) separator = ", ";

            StringBuffer result = new StringBuffer();
            Iterator it = values.iterator();
            while (it.hasNext()) {
                Object value = it.next();
                if (result.length() > 0) result.append(separator);
                result.append(dpf.formatValue(propId, value, locale));
            }
            return result.toString();
        }
        if (FILTER_ALL.equals(commandName)) {
            List values = filterProp.getPropertyDistinctValues();
            if (values.isEmpty()) return null;

            Collections.sort(values);
            String separator = getArgument(1);
            if (separator == null) separator = ", ";

            StringBuffer result = new StringBuffer();
            Iterator it = values.iterator();
            while (it.hasNext()) {
                Object value = it.next();
                if (result.length() > 0) result.append(separator);
                result.append(dpf.formatValue(propId, value, locale));
            }
            return result.toString();
        }
        return "[" + commandName + ", command not supported]";
    }
View Full Code Here

        // If property exist in any dashboard's data provider, get it and get its name
        DataProperty property = getDataProperty();
        if (property != null) return property.getName(l);

        // If property is static, use data property formatter to get its name.
        DataPropertyFormatter df = getDataPropertyFormatter();
        if (df != null) return df.formatName(propertyId, l);
        return propertyId;
    }
View Full Code Here

        return propertyId;
    }

    public String formatPropertyValue(Object value, Locale l) {
        DataProperty property = getDataProperty();
        DataPropertyFormatter df = getDataPropertyFormatter();
        if (df == null) return value == null ? "" : value.toString();
        if (property != null) return df.formatValue(property, value, l);
        return df.formatValue(propertyId,value,l);
    }
View Full Code Here

        if (property != null) return df.formatValue(property, value, l);
        return df.formatValue(propertyId,value,l);
    }

    public Object parsePropertyValue(String value) throws Exception {
        DataPropertyFormatter df = getDataPropertyFormatter();
        return isStaticProperty() ? df.parsePropertyValue(getPropertyClass(), value) : df.parsePropertyValue(getDataProperty(),value);
    }
View Full Code Here

    protected String formatCellValue(Table table, int row, int column) {
        DataSetTable dataSetTable = (DataSetTable) table;
        DataProperty property = dataSetTable.getDataProperty(column);
        if (property == null) return "";
       
        DataPropertyFormatter formatter = DataFormatterRegistry.lookup().getPropertyFormatter(property.getPropertyId());
        return StringEscapeUtils.escapeHtml(formatter.formatValue(property, table.getValueAt(row, column), LocaleManager.currentLocale()));
    }
View Full Code Here

    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

TOP

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

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.