Examples of DashboardFilterProperty


Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

        // Show properties
        if (properties.size() ==0) renderFragment("outputEmpty");
        Iterator it = properties.iterator();
        while (it.hasNext()) {
            DashboardFilterProperty dashboardFilterProperty = (DashboardFilterProperty) it.next();
            if (dashboardFilterProperty.isBeingFiltered()) continue;
            if (!dashboardFilterProperty.isVisible()) continue;

            renderFragment("outputStartRow");
            renderPropertyName(dashboardFilterProperty);
            if (dashboardFilterProperty.isLabelProperty()) {

                // Get the property allowed values.
                String allowedValue = null;
                if (filter != null && filter.containsProperty(dashboardFilterProperty.getPropertyId())) {
                    List filterAllowedValues = filter.getPropertyAllowedValues(dashboardFilterProperty.getPropertyId());
                    if (filterAllowedValues.size() == 1) allowedValue = (String) filterAllowedValues.get(0);
                }

                // Get the list of distinct values for this label property. In order to avoid performance issues,
                // no combos of more than a given number of entries are allowed. In such cases the only way to enter
                // filter values is via the custom entry option.
                List allowedValues = dashboardFilterProperty.getPropertyDistinctValues();
                if (allowedValues.size() > DashboardSettings.lookup().getMaxEntriesInFilters()) allowedValues = new ArrayList();

                // Build the filter combo options.
                String[] keys = new String[allowedValues.size()+2];
                String[] values = new String[allowedValues.size()+2];
                keys[0] = DashboardFilterHandler.PARAM_NULL_VALUE;
                values[0] = " - " + getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "select") + " " + StringEscapeUtils.escapeHtml(dashboardFilterProperty.getPropertyName(getLocale())) + " - ";
                keys[1]=DashboardFilterHandler.PARAM_CUSTOM_VALUE;
                values[1]= " - " + getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "custom") + " - ";
                Iterator it1 = allowedValues.iterator();
                for (int i = 2; it1.hasNext(); i++) {
                    Object value = it1.next();
                    keys[i]= Integer.toString(i);
                    if (value != null && value.equals(allowedValue)) setAttribute("selected", Integer.toString(i));
                    values[i] = StringEscapeUtils.escapeHtml(dashboardFilterProperty.formatPropertyValue(value, getLocale()));
                }
                if (allowedValue == null) setAttribute("selected","0");
                setAttribute("keys",keys);
                setAttribute("values",values);
                setDefaultTypeAttributes(dashboardFilterProperty);
                setAttribute("submitOnChange",getDashboardFilterHandler().isShowSubmitOnChange());
                renderFragment("outputPropertyTypeLabel");
            } else if (dashboardFilterProperty.isNumericProperty()) {
                setDefaultTypeAttributes(dashboardFilterProperty);

                Object minValue = null;
                Object maxValue = null;
                if (filter != null && filter.containsProperty(dashboardFilterProperty.getPropertyId())) {
                    maxValue = dashboardFilterProperty.getPropertyMaxValue();
                    minValue = dashboardFilterProperty.getPropertyMinValue();
                }
                setAttribute("minValue",minValue);
                setAttribute("maxValue",maxValue);
                renderFragment("outputPropertyTypeNumeric");
            } else if (dashboardFilterProperty.isDateProperty()) {
                setDefaultTypeAttributes(dashboardFilterProperty);

                Object minValue = null;
                Object maxValue = null;
                if (filter != null && filter.containsProperty(dashboardFilterProperty.getPropertyId())) {
                    maxValue = dashboardFilterProperty.getPropertyMaxValue();
                    minValue = dashboardFilterProperty.getPropertyMinValue();
                }
                setAttribute("minValue",minValue);
                setAttribute("maxValue",maxValue);
                setAttribute("submitOnChange",getDashboardFilterHandler().isShowSubmitOnChange());
                renderFragment("outputPropertyTypeDate");
            } else {
                log.warn("Domain for property " + dashboardFilterProperty.getPropertyId()  + " is not supported.");
            }
            renderFragment("outputEndRow");
        }
        renderFragment("outputEnd");
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

            // Show legend.
            DashboardFilterProperty[] filteredProperties = getDashboardFilterHandler().getBeingFilteredProperties();
            if (getDashboardFilterHandler().isShowLegend() && filteredProperties.length > 0) {
                renderFragment("outputStartLegend");
                for (int i = 0; i < filteredProperties.length; i++) {
                    DashboardFilterProperty dashboardFilterProperty = filteredProperties[i];
                    setAttribute("propertyId", dashboardFilterProperty.getPropertyId());
                    setAttribute("propertyName", StringEscapeUtils.escapeHtml(dashboardFilterProperty.getPropertyName(getLocale())));
                    setAttribute("index", new Integer(i));
                    if (dashboardFilterProperty.isLabelProperty()) {
                        String filterValue = dashboardFilterProperty.formatPropertyValue(dashboardFilterProperty.getPropertySelectedValues(), getLocale());
                        setAttribute("propertyValue", StringEscapeUtils.escapeHtml(filterValue));
                        renderFragment("outputLegendStringProperty");
                    } else {
                        String minValue = dashboardFilterProperty.formatPropertyValue(dashboardFilterProperty.getPropertyMinValue(), getLocale());
                        String maxValue = dashboardFilterProperty.formatPropertyValue(dashboardFilterProperty.getPropertyMaxValue(), getLocale());
                        setAttribute("propertyMinValue", minValue);
                        setAttribute("propertyMaxValue", maxValue);
                        StringBuffer str = new StringBuffer();
                        str.append(getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "from")).append("  ");
                        str.append(minValue);
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

        renderFragment("outputHeader");
        DashboardFilterProperty[] properties = getDashboardFilterHandler().getAllPropertiesForCurrentFilter();
        if (properties.length == 0) renderFragment("outputEmpty");
        else {
            for (int i = 0; i < properties.length; i++) {
                DashboardFilterProperty property = properties[i];

                String dataProviderName;
                try {
                    if (property.isStaticProperty())
                        dataProviderName = getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "staticProperty");
                    else {
                        DataProvider provider = getDashboardFilterHandler().getDashboard().getDataProviderByCode(property.getDataProviderCode());
                        dataProviderName = provider.getDescription(getLocale());
                    }
                } catch (Exception e) {
                    log.error("Cannot get data provider with code " + property.getDataProviderCode());
                    continue;
                }
                setAttribute("index",new Integer(i));
                setAttribute("dataProviderCode",property.getDataProviderCode());
                setAttribute("propertyId",property.getPropertyId());
                setAttribute("visibleChecked",Boolean.valueOf(property.isVisible()));
                setAttribute("drillDownChecked",Boolean.valueOf(property.isDrillDownEnabled()));
                setAttribute("sectionId",property.getSectionId());
                // Drill down page title.
                String currentSectionTitle = "-- " + getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "select") + " --";
                Section section = property.getDrillDownPage();
                if (section != null) currentSectionTitle = getLocalizedValue(section.getTitle());
                setAttribute("currentSectionTitle", StringEscapeUtils.escapeHtml(currentSectionTitle));
                setAttribute("dataProviderName", StringEscapeUtils.escapeHtml(dataProviderName));
                setAttribute("propertyName",StringEscapeUtils.escapeHtml(property.getPropertyName(getLocale())));
                renderFragment("outputTableElement");
            }
        }

        // Render not allowed proeprties.
        List notAllowedProps = getDashboardFilterHandler().getNotAllowedProperties();
        if (!notAllowedProps.isEmpty()) {
            renderFragment("outputNotAllowedPropertiesStart");
            Iterator it = notAllowedProps.iterator();
            while (it.hasNext()) {
                DashboardFilterProperty dashboardFilterProperty = (DashboardFilterProperty) it.next();
                DataProvider provider = getDashboardFilterHandler().getDashboard().getDataProviderByCode(dashboardFilterProperty.getDataProviderCode());
                String dataProviderName = StringEscapeUtils.escapeHtml(provider.getDescription(getLocale()));
                setAttribute("dataProviderName", dataProviderName);
                setAttribute("propertyName", StringEscapeUtils.escapeHtml(dashboardFilterProperty.getPropertyName(getLocale())));
                renderFragment("outputNotAllowedProperty");
            }
            renderFragment("outputNotAllowedPropertiesEnd");
        }
        getDashboardFilterHandler().getNotAllowedProperties().clear();
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

    }

    public boolean filter(String propertyId, Object minValue, boolean minValueIncluded, Object maxValue, boolean maxValueIncluded, Collection allowedValues, int allowMode) throws Exception {

        // Get the filter property configuration.
        DashboardFilterProperty dashboardFilterProperty = dashboardFilter.getPropertyInFilterComponents(propertyId);

        // Apply drill-down.
        if (dashboardFilterProperty != null && dashboardFilterProperty.isDrillDownEnabled()) {
            Dashboard targetDashboard = dashboardFilterProperty.getDrillDownDashboard();
            DashboardFilter targetFilter = targetDashboard.getDashboardFilter();
            if (targetDashboard.drillDown(this, propertyId)) {
                targetFilter.addProperty(propertyId, minValue, minValueIncluded, maxValue, maxValueIncluded, allowedValues, FilterByCriteria.ALLOW_ANY);
                targetDashboard.filter();
                return true;
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

    }

    public DashboardFilterProperty getFilterPropertyById(String id) {
        try {
            // 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

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

    public DashboardFilterProperty getPropertyInFilterComponents(String propertyId) {
        if (dashboard.getSection() == null) return null;
        for (Panel panel : dashboard.getSection().getPanels()) {
            DashboardFilterHandler handler = getHandler(panel);
            if (handler != null) {
                DashboardFilterProperty prop = handler.getDashboardFilterProperty(propertyId);
                if (prop != null) return prop;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

    }

    public DashboardFilterProperty getPropertyInParentDashboards(String propId) {
        Dashboard parent = getDashboard().getParent();
        while (parent != null) {
            DashboardFilterProperty parentProp = parent.getDashboardFilter().getFilterPropertyById(propId);
            if (parentProp != null) return parentProp;
            parent = parent.getParent();
        }
        return null;
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

            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

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

         DashboardFilterProperty[] properties = new DashboardFilterProperty[defaultProperties.length];
         // Static properties.
        for (int i = 0; i < defaultProperties.length; i++) {
            Properties staticProperty = defaultProperties[i];
            String propertyId = staticProperty.getProperty("propertyid");
            DashboardFilterProperty prop = new DashboardFilterProperty(propertyId,this);
            prop.setStaticProperty(true);
            properties[i] = prop;
        }
        return properties;
     }
View Full Code Here

Examples of org.jboss.dashboard.ui.components.DashboardFilterProperty

         if (defaultProperties == null) return null;
         for (int i = 0; i < defaultProperties.length; i++) {
            Properties staticProperty = defaultProperties[i];
            String propertyId = staticProperty.getProperty("propertyid");
            if (id.equals(propertyId)) {
                DashboardFilterProperty prop = new DashboardFilterProperty(propertyId,this);
                prop.setStaticProperty(true);
                return prop;
            }
        }
        return null;
     }
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.