Package org.jboss.dashboard.provider

Examples of org.jboss.dashboard.provider.DataProperty


            // Static properties.
            DashboardFilterProperty prop = getStaticPropertyById(id);
            if (prop != null) return prop;

            // Dynamic properties.
            DataProperty dp = getDashboard().getDataPropertyById(id);
            if (dp != null) return new DashboardFilterProperty(dp, this);
            return new DashboardFilterProperty(id, this);
        } catch (Exception e) {
            log.error("Cannot get data provider results.", e);
            return null;
View Full Code Here


            Iterator it = getDashboard().getDataProviders().iterator();
            while (it.hasNext()) {
                DataProvider dataProvider = (DataProvider) it.next();
                DataProperty[] properties = dataProvider.getDataSet().getProperties();
                for (int i = 0; i < properties.length; i++) {
                    DataProperty property = properties[i];
                    results.add(new DashboardFilterProperty(property, this));
                }
            }
        } catch (Exception e) {
            log.error("Cannot get data provider results.", e);
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

    }

    protected Object getPropertyValue(String propertyId, Object obj) {
        try {
            Object[] instance = (Object[]) obj;
            DataProperty property = dashboard.getDataPropertyById(propertyId);
            int column = property.getDataSet().getPropertyColumn(property);
            return instance[column];              
        } catch (ClassCastException e) {
            return null;
        }
    }
View Full Code Here

        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

        while (dashboard != null) {
            Iterator it = dashboard.getDataProviders().iterator();
            while (it.hasNext()) {
                DataProvider provider = (DataProvider) it.next();
                try {
                    DataProperty p = provider.getDataSet().getPropertyById(propertyId);
                    if (p != null) return p;
                } catch (Exception e) {
                    log.error("Dashboard provider dataset load: " + provider.getCode(), e);
                    continue;
                }
View Full Code Here

        // Init the provider and apply the group by configuration if required.
        if (providerNotInit) {
            DataSetTableModel dataSetModel = (DataSetTableModel) super.getModel();
            dataSetModel.setDataSet(getOriginalDataSet());
            if (getColumnCount() == 0) initFromDataSet();
            DataProperty groupByProp = getGroupByProperty();
            if (groupByProp != null) switchGroupByOn(groupByProp);
        }
        // Clear the current table configuration if the data provider is changed.
        if (providerChanged) {
            initFromDataSet();
View Full Code Here

    protected void initFromDataSet() {
        for (int i=getColumnCount()-1; i>=0; i--) removeColumn(i);
        DataProperty[] props = getDataSet().getProperties();
        for (int i = 0; i < props.length && i < 10; i++) {
            DataProperty prop = props[i];
            TableColumn column = createColumn();
            column.setPropertyId(prop.getPropertyId());
            column.setNameI18nMap(new HashMap(prop.getNameI18nMap()));
            column.setHintI18nMap(new HashMap(prop.getNameI18nMap()));
            addColumn(column);
            column.setSortable(true);
            column.setSelectable(false);
        }
    }
View Full Code Here

    public DataProperty getOriginalDataProperty(int columnIndex) {
        if (columnIndex < 0 || columnIndex >= getColumnCount()) return null;

        // If group by is deactivated then get the property from the current (original) dataset.
        DataProperty currentProp = getDataProperty(columnIndex);
        if (groupByProperty == null) return currentProp;

        // If not then get the property from the grouped data set and then get the corresponding property from the original one.
        DataProperty[] properties = getOriginalDataSet().getProperties();
        for (int i = 0; i < properties.length; i++) {
            DataProperty property = properties[i];
            if (property.equals(currentProp)) return property;
        }
        return null;
    }
View Full Code Here

    }

    public boolean isNonGroupByColumn(int columnIndex) {
        if (groupByProperty == null) return true;

        DataProperty prop = getDataProperty(columnIndex);
        if (prop == null) return true;

        return !groupByProperty.equals(prop);
    }
View Full Code Here

TOP

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

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.