Package org.dashbuilder.dataset.group

Examples of org.dashbuilder.dataset.group.DataSetGroup


    }

    protected T function(String columnId, String newColumnId, AggregateFunctionType function) {
        DataSetOp op = getCurrentOp();
        if (op == null || !(op instanceof DataSetGroup)) {
            dataSetLookup.addOperation(new DataSetGroup());
        }
        DataSetGroup gOp = (DataSetGroup) getCurrentOp();
        gOp.addGroupFunction(new GroupFunction(columnId, newColumnId, function));
        return (T) this;
    }
View Full Code Here


    }

    public T select(String... intervalNames) {
        DataSetOp op = getCurrentOp();
        if (op == null || !(op instanceof DataSetGroup)) {
            dataSetLookup.addOperation(new DataSetGroup());
        }
        DataSetGroup gOp = (DataSetGroup) getCurrentOp();
        gOp.addSelectedIntervalNames(intervalNames);
        return (T) this;
    }
View Full Code Here

     */
    protected void filterApply(String columnId, List<String> values) {
        if (!displayerSettings.isFilterEnabled()) return;

        // For string column filters, create and notify a group interval selection operation.
        DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);
        DataSetGroup _groupSelect = null;
        if (groupOp != null && groupOp.getColumnGroup() != null) {
            _groupSelect = groupOp.cloneInstance();
            _groupSelect.setSelectedIntervalNames(values);

        } else {
            _groupSelect = new DataSetGroup();
            _groupSelect.setSelectedIntervalNames(values);
            _groupSelect.setColumnGroup(new ColumnGroup(columnId, columnId, GroupStrategy.DYNAMIC));
        }
        // Notify to those interested parties the selection event.
        if (displayerSettings.isFilterNotificationEnabled()) {
            for (DisplayerListener listener : listenerList) {
                listener.onGroupIntervalsSelected(this, _groupSelect);
View Full Code Here

     */
    protected void filterReset(String columnId) {
        if (!displayerSettings.isFilterEnabled()) return;

        columnSelectionMap.remove(columnId);
        DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);
        if (groupOp == null || groupOp.getColumnGroup() == null) {
            groupOp = new DataSetGroup();
            groupOp.setColumnGroup(new ColumnGroup(columnId, columnId, GroupStrategy.DYNAMIC));
        }
        // Notify to those interested parties the reset event.
        if (displayerSettings.isFilterNotificationEnabled()) {
            for (DisplayerListener listener : listenerList) {
                listener.onGroupIntervalsReset(this, Arrays.asList(groupOp));
View Full Code Here

    protected void filterReset() {
        if (!displayerSettings.isFilterEnabled()) return;

        List<DataSetGroup> groupOpList = new ArrayList<DataSetGroup>();
        for (String columnId : columnSelectionMap.keySet()) {
            DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);
            if (groupOp == null || groupOp.getColumnGroup() == null) {
                groupOp = new DataSetGroup();
                groupOp.setColumnGroup(new ColumnGroup(columnId, columnId, GroupStrategy.DYNAMIC));
            }
            groupOpList.add(groupOp);

        }
        columnSelectionMap.clear();
View Full Code Here

            if (op.equals(next)) {
                return false;
            }
        }
        // The interval selection op. must be added after the latest selection.
        DataSetGroup clone = op.cloneInstance();
        clone.getGroupFunctions().clear();
        _filter(0, clone, false);
        return true;
    }
View Full Code Here

        int lastSelection = lookupCurrent.getLastGroupOpIndex(0, null, true) + 1;
        int targetGroup = lookupCurrent.getLastGroupOpIndex(lastSelection, cg.getColumnId(), false);

        // If the selection does not exists just add it.
        if (targetGroup == -1) {
            DataSetGroup clone = op.cloneInstance();
            clone.getGroupFunctions().clear();
            _filter(lastSelection, clone, true);
            return true;
        }
        // If there not exists a group op after the target then the target op must be propagated along the selection.
        DataSetGroup targetOp = lookupCurrent.getOperation(targetGroup);
        int latestGroup = lookupCurrent.getLastGroupOpIndex(targetGroup + 1, null, false);
        if (latestGroup == -1) {
            DataSetGroup clone = targetOp.cloneInstance();
            _filter(targetGroup + 1, clone, true);
        }
        // Enable the selection
        _select(targetOp, op.getSelectedIntervalNames());
        return true;
View Full Code Here

            while (it1.hasNext()) {
                GroupOpFilter target = it1.next();

                Iterator<DataSetGroup> it2 = lookupCurrent.getOperationList(DataSetGroup.class).iterator();
                while (it2.hasNext()) {
                    DataSetGroup next = it2.next();
                    if (next == target.groupOp && target.drillDown == drillDown) {
                        it1.remove();
                        next.getSelectedIntervalNames().clear();
                        next.getGroupFunctions().clear();
                        next.getSelectedIntervalNames().addAll(target.intervalNames);
                        next.getGroupFunctions().addAll(target.groupFunctions);
                        opFound = true;
                    }
                }
            }
        }
View Full Code Here

                if (DataSetOpType.GROUP.equals(op.getType())) {
                    if (calculations) throw new IllegalStateException("Group not permitted after a simple function calculation operation.");
                    if (sort) throw new IllegalStateException("Sort operations must be applied ALWAYS AFTER GROUP.");

                    DataSetGroup gOp = (DataSetGroup) op;
                    ColumnGroup columnGroup = gOp.getColumnGroup();
                    if (columnGroup == null) {
                        // No real group requested. Only function calculations on the data set.
                        calculations = true;
                        context.lastOperation = op;
                    } else {
View Full Code Here

            DataSetOp lastOp = context.lastOperation;
            DataSetIndexNode index = context.index;
            DataSet dataSet = context.dataSet;

            if (lastOp instanceof DataSetGroup) {
                DataSetGroup gOp = (DataSetGroup) lastOp;
                ColumnGroup columnGroup = gOp.getColumnGroup();
                if (columnGroup == null) {
                    return _buildDataSet(context, gOp.getGroupFunctions());
                } else {
                    if (!gOp.getSelectedIntervalNames().isEmpty() && gOp.getGroupFunctions().isEmpty()) {
                        return dataSet.trim(index.getRows());
                    } else {
                        return _buildDataSet(context, gOp);
                    }
                }
View Full Code Here

TOP

Related Classes of org.dashbuilder.dataset.group.DataSetGroup

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.