Package com.google.refine.model

Examples of com.google.refine.model.ColumnGroup


            }

            int columnGroupCount = project.columnModel.columnGroups.size();
            _oldColumnGroups = new ArrayList<ColumnGroup>(columnGroupCount);
            for (int i = columnGroupCount - 1; i >= 0; i--) {
                ColumnGroup columnGroup = project.columnModel.columnGroups.get(i);
               
                _oldColumnGroups.add(columnGroup);
               
                if (columnGroup.startColumnIndex <= _columnIndex) {
                    if (columnGroup.startColumnIndex + columnGroup.columnSpan > _columnIndex) {
                        // the new column is inserted right in the middle of the group
                        project.columnModel.columnGroups.set(i, new ColumnGroup(
                            columnGroup.startColumnIndex,
                            columnGroup.columnSpan + 1,
                            columnGroup.keyColumnIndex < _columnIndex ?
                                columnGroup.keyColumnIndex :
                                (columnGroup.keyColumnIndex + 1)
                        ));
                    }
                } else {
                    // the new column precedes this whole group
                    project.columnModel.columnGroups.set(i, new ColumnGroup(
                        columnGroup.startColumnIndex + 1,
                        columnGroup.columnSpan,
                        columnGroup.keyColumnIndex + 1
                    ));
                }
View Full Code Here


           
            int columnGroupCount = project.columnModel.columnGroups.size();
            int columnCountChange = _columnNames.size() - (_removeOriginalColumn ? 1 : 0);
            _oldColumnGroups = new ArrayList<ColumnGroup>(columnGroupCount);
            for (int i = columnGroupCount - 1; i >= 0; i--) {
                ColumnGroup columnGroup = project.columnModel.columnGroups.get(i);
               
                _oldColumnGroups.add(columnGroup);
               
                if (columnGroup.startColumnIndex <= _columnIndex) {
                    if (columnGroup.startColumnIndex + columnGroup.columnSpan > _columnIndex) {
                        // the column being split is in the middle of the group
                       
                        if (columnGroup.keyColumnIndex == _columnIndex) {
                            if (_removeOriginalColumn) {
                                // the key column is being split and removed
                                project.columnModel.columnGroups.remove(i);
                            } else {
                                project.columnModel.columnGroups.set(i, new ColumnGroup(
                                    columnGroup.startColumnIndex,
                                    columnGroup.columnSpan + columnCountChange,
                                    columnGroup.keyColumnIndex
                                ));
                            }
                        } else {
                            project.columnModel.columnGroups.set(i, new ColumnGroup(
                                columnGroup.startColumnIndex,
                                columnGroup.columnSpan + columnCountChange,
                                columnGroup.keyColumnIndex < _columnIndex ?
                                    columnGroup.keyColumnIndex :
                                    (columnGroup.keyColumnIndex + columnCountChange)
                            ));
                        }
                    }
                } else {
                    // the new column precedes this whole group
                    project.columnModel.columnGroups.set(i, new ColumnGroup(
                        columnGroup.startColumnIndex + columnCountChange,
                        columnGroup.columnSpan,
                        columnGroup.keyColumnIndex + columnCountChange
                    ));
                }
View Full Code Here

    public void apply(Project project) {
        synchronized (project) {
            int columnGroupCount = project.columnModel.columnGroups.size();
            _oldColumnGroups = new ArrayList<ColumnGroup>(columnGroupCount);
            for (int i = columnGroupCount - 1; i >= 0; i--) {
                ColumnGroup columnGroup = project.columnModel.columnGroups.get(i);
               
                _oldColumnGroups.add(columnGroup);
               
                if (columnGroup.startColumnIndex <= _oldColumnIndex) {
                    if (columnGroup.startColumnIndex + columnGroup.columnSpan > _oldColumnIndex) {
                        // the group starts before or at _oldColumnIndex
                        // but spans to include _oldColumnIndex
                       
                        if (columnGroup.keyColumnIndex == _oldColumnIndex) {
                            // the key column is removed, so we remove the whole group
                            project.columnModel.columnGroups.remove(i);
                        } else {
                            // otherwise, the group's span has been reduced by 1
                            project.columnModel.columnGroups.set(i, new ColumnGroup(
                                columnGroup.startColumnIndex,
                                columnGroup.columnSpan - 1,
                                columnGroup.keyColumnIndex < _oldColumnIndex ?
                                    columnGroup.keyColumnIndex :
                                    (columnGroup.keyColumnIndex - 1)
                            ));
                        }
                    }
                } else {
                    // the column removed precedes this whole group
                    project.columnModel.columnGroups.set(i, new ColumnGroup(
                        columnGroup.startColumnIndex - 1,
                        columnGroup.columnSpan,
                        columnGroup.keyColumnIndex - 1
                    ));
                }
View Full Code Here

TOP

Related Classes of com.google.refine.model.ColumnGroup

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.