Package org.jboss.dashboard.displayer.table

Examples of org.jboss.dashboard.displayer.table.DataSetTable


            getBundle(bundles, l).setProperty(parentKey + ".unit", value);
        }
    }

    protected void processTableDisplayer(TableDisplayer tableDisplayer, String parentKey, Map<Locale,Properties> bundles) throws Exception {
        DataSetTable table = tableDisplayer.getTable();
        DataProperty groupByProp = table.getGroupByProperty();
        if (groupByProp != null) {
            DomainConfiguration domainConfig = new DomainConfiguration(groupByProp);
            processDomain(domainConfig, parentKey + ".groupBy", bundles);
        }
        for (int columnIndex=0; columnIndex<table.getColumnCount(); columnIndex++) {
            DataProperty columnProperty = table.getOriginalDataProperty(columnIndex);
            if (columnProperty == null) continue;

            TableColumn column = table.getColumn(columnIndex);
            Map<Locale,String> columnName = column.getNameI18nMap();
            for (Locale l : columnName.keySet()) {
                String value = columnName.get(l);
                getBundle(bundles, l).setProperty(parentKey + ".column."+ columnIndex + ".name", value);
            }
View Full Code Here


    }


    protected String getSortIcon(TableColumn column, int columnIndex) {
        // Sorting in case of a Data Set Table Model.
        DataSetTable dst = (DataSetTable) tableHandler.getTable();
        if (isColumnSortable(column)) {
            DataSetTableModel dsModel = (DataSetTableModel) dst.getModel();
            String modelIndex = Integer.toString(dsModel.getColumnPosition(column.getPropertyId()));
            ComparatorByCriteria comparator = tableHandler.getTableComparator();
            int order = 0;
            if (comparator.existCriteria(modelIndex)) order = comparator.getSortCriteriaOrdering(modelIndex);
            switch(order) {
View Full Code Here

        return showGroupByConfig;
    }

    public int getGroupBySelectedColumnIndex() {
        if (groupBySelectedColumnIndex < 0) {
            DataSetTable dataSetTable = (DataSetTable) table;
            int [] nonGroupByColumns = dataSetTable.getNonGroupByColumnIndexes();
            if (nonGroupByColumns.length > 0) groupBySelectedColumnIndex = nonGroupByColumns[0];
        }
        return groupBySelectedColumnIndex;
    }
View Full Code Here

        groupBySelectedColumnIndex = -1;
        showGroupByConfig = false;
    }

    public void actionSaveTable(CommandRequest request) throws Exception {
        DataSetTable dataSetTable = (DataSetTable) table;
        String groupByPropId = request.getRequestObject().getParameter("groupbyproperty");
        String closeGroupByConfig = request.getRequestObject().getParameter("closegroupbyconfig");
        if (groupByPropId != null && !groupByPropId.equals("-1") && showGroupByConfig) {
            // Capture the group by domain configuration.
            DomainConfiguration config = new DomainConfiguration();
            DomainConfigurationParser parser = new DomainConfigurationParser(config);
            parser.parse(request);
            config.apply(dataSetTable.getGroupByProperty());
            dataSetTable.setGroupByShowTotals(Boolean.valueOf(request.getRequestObject().getParameter("groupbyshowtotals")).booleanValue());
            dataSetTable.setGroupByTotalsHtmlStyle(request.getRequestObject().getParameter("groupbytotalshtmlstyle"));           

            // Get for the selected non-group by column the scalar function to apply.
            if (dataSetTable.getNonGroupByColumnIndexes().length > 0) {
                int currentSelectedColumnIndex = Integer.parseInt(request.getRequestObject().getParameter("groupbyfunctionindex"));
                if (currentSelectedColumnIndex == groupBySelectedColumnIndex) {
                    String functionCode = request.getRequestObject().getParameter("groupbyfunctioncode");
                    DataProperty originalDataProperty = dataSetTable.getOriginalDataProperty(groupBySelectedColumnIndex);
                    if (originalDataProperty.getDomain().isScalarFunctionSupported(functionCode)) {
                        dataSetTable.setGroupByFunctionCode(groupBySelectedColumnIndex, functionCode);
                    }
                } else {
                    groupBySelectedColumnIndex = currentSelectedColumnIndex;
                }
            }
            // Refresh the group by after applying the changes.
            dataSetTable.refreshGroupBy();

            // Close the group by config if requested.
            if (closeGroupByConfig != null && closeGroupByConfig.equals("true")) {
                showGroupByConfig = false;
            }
View Full Code Here

        }
        super.actionSaveTable(request);
    }
                    
    public void actionSelectGroupByProperty(CommandRequest request) throws Exception {
        DataSetTable dataSetTable =(DataSetTable) table;
        String groupByPropId = request.getRequestObject().getParameter("groupbyproperty");
        groupBySelectedColumnIndex = -1;
        dataSetTable.setCurrentPage(1);

        if (groupByPropId == null || groupByPropId.equals("-1")) {
            dataSetTable.setGroupByProperty(null);
            showGroupByConfig = false;
            setStructuralChangesAllowed(true);
        } else {
            dataSetTable.setGroupByProperty(dataSetTable.getOriginalDataSet().getPropertyById(groupByPropId).cloneProperty());
            showGroupByConfig = true;
            setStructuralChangesAllowed(false);

            // Close the column edition When edit the group by.
            selectedColumnIndex = null;
View Full Code Here

        }
    }

    public void actionSelectGroupByPropertyFunction(CommandRequest request) throws Exception {
        // Capture the group by domain configuration.
        DataSetTable dataSetTable =(DataSetTable) table;
        DomainConfiguration config = new DomainConfiguration();
        DomainConfigurationParser parser = new DomainConfigurationParser(config);
        parser.parse(request);
        config.apply(dataSetTable.getGroupByProperty());
        dataSetTable.setGroupByShowTotals(Boolean.valueOf(request.getRequestObject().getParameter("groupbyshowtotals")).booleanValue());
        dataSetTable.setGroupByTotalsHtmlStyle(request.getRequestObject().getParameter("groupbytotalshtmlstyle"));

        // Get the selected property for the group by function setup.
        groupBySelectedColumnIndex = Integer.parseInt(request.getRequestObject().getParameter("groupbyfunctionindex"));
    }
View Full Code Here

* Table formatter which formats cell values using the data set properties.
*/
public class DataSetTableFormatter extends TableFormatter {

    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

    }

    protected void renderFragment(String fragment) {
        super.renderFragment(fragment);

        DataSetTable table = (DataSetTable) tableHandler.getTable();
        if ("bodyend".equals(fragment) && table.showGroupByTotals()) includePage("/components/bam/displayer/table/table_groupby_totals.jsp");
        else if ("tablestartcontents".equals(fragment) && tableHandler.isEditMode()) includePage("/components/bam/displayer/table/table_groupby_selector.jsp");
    }
View Full Code Here

        return showGroupByConfig;
    }

    public int getGroupBySelectedColumnIndex() {
        if (groupBySelectedColumnIndex < 0) {
            DataSetTable dataSetTable = (DataSetTable) table;
            int [] nonGroupByColumns = dataSetTable.getNonGroupByColumnIndexes();
            if (nonGroupByColumns.length > 0) groupBySelectedColumnIndex = nonGroupByColumns[0];
        }
        return groupBySelectedColumnIndex;
    }
View Full Code Here

        groupBySelectedColumnIndex = -1;
        showGroupByConfig = false;
    }

    public void actionSaveTable(CommandRequest request) throws Exception {
        DataSetTable dataSetTable = (DataSetTable) table;
        String groupByPropId = request.getRequestObject().getParameter("groupbyproperty");
        String closeGroupByConfig = request.getRequestObject().getParameter("closegroupbyconfig");
        if (groupByPropId != null && !groupByPropId.equals("-1") && showGroupByConfig) {
            // Capture the group by domain configuration.
            DomainConfiguration config = new DomainConfiguration();
            DomainConfigurationParser parser = new DomainConfigurationParser(config);
            parser.parse(request);
            config.apply(dataSetTable.getGroupByProperty());
            dataSetTable.setGroupByShowTotals(Boolean.valueOf(request.getRequestObject().getParameter("groupbyshowtotals")).booleanValue());
            dataSetTable.setGroupByTotalsHtmlStyle(request.getRequestObject().getParameter("groupbytotalshtmlstyle"));           

            // Get for the selected non-group by column the scalar function to apply.
            if (dataSetTable.getNonGroupByColumnIndexes().length > 0) {
                int currentSelectedColumnIndex = Integer.parseInt(request.getRequestObject().getParameter("groupbyfunctionindex"));
                if (currentSelectedColumnIndex == groupBySelectedColumnIndex) {
                    String functionCode = request.getRequestObject().getParameter("groupbyfunctioncode");
                    DataProperty originalDataProperty = dataSetTable.getOriginalDataProperty(groupBySelectedColumnIndex);
                    if (originalDataProperty.getDomain().isScalarFunctionSupported(functionCode)) {
                        dataSetTable.setGroupByFunctionCode(groupBySelectedColumnIndex, functionCode);
                    }
                } else {
                    groupBySelectedColumnIndex = currentSelectedColumnIndex;
                }
            }
            // Refresh the group by after applying the changes.
            dataSetTable.refreshGroupBy();

            // Close the group by config if requested.
            if (closeGroupByConfig != null && closeGroupByConfig.equals("true")) {
                showGroupByConfig = false;
            }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.displayer.table.DataSetTable

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.