Package org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel

Examples of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup


                        // If the previous entry is a column group - move above
                        // it.
                        if (columnGroupModel != null
                                && columnGroupModel
                                        .isPartOfAGroup(previousColumnEntryIndex)) {
                            ColumnGroup previousColumnGroup = columnGroupModel
                                    .getColumnGroupByIndex(previousColumnEntryIndex);
                            toPositions.add(firstPositionInGroup
                                    - previousColumnGroup.getSize());
                        } else {
                            toPositions.add(firstPositionInGroup - 1);
                        }
                    } else {
                        // If is first member of the unbreakable group, can't
                        // move up i.e. out of the group
                        if (columnGroupModel != null
                                && columnGroupModel
                                        .isPartOfAnUnbreakableGroup(columnEntryIndex)
                                && !ColumnGroupUtils.isInTheSameGroup(
                                        columnEntryIndex,
                                        previousColumnEntryIndex,
                                        columnGroupModel)) {
                            return;
                        }

                        // If previous entry is an unbreakable column group -
                        // move above it
                        if (columnGroupModel != null
                                && columnGroupModel
                                        .isPartOfAnUnbreakableGroup(previousColumnEntryIndex)
                                && !ColumnGroupUtils.isInTheSameGroup(
                                        columnEntryIndex,
                                        previousColumnEntryIndex,
                                        columnGroupModel)) {
                            ColumnGroup previousColumnGroup = columnGroupModel
                                    .getColumnGroupByIndex(previousColumnEntryIndex);
                            toPositions.add(firstPositionInGroup
                                    - previousColumnGroup.getSize());
                        } else {
                            toPositions.add(firstPositionInGroup - 1);
                        }
                    }
                }
View Full Code Here


                    if (columnGroupMoved) {
                        // If the next entry is a column group - move past it.
                        if (columnGroupModel != null
                                && columnGroupModel
                                        .isPartOfAGroup(nextColumnEntryIndex)) {
                            ColumnGroup nextColumnGroup = columnGroupModel
                                    .getColumnGroupByIndex(nextColumnEntryIndex);
                            toPositions.add(lastPositionInGroup
                                    + nextColumnGroup.getSize());
                        } else {
                            toPositions.add(lastPositionInGroup + 1);
                        }
                    } else {
                        // If is last member of the unbreakable group, can't
                        // move down i.e. out of the group
                        if (columnGroupModel != null
                                && columnGroupModel
                                        .isPartOfAnUnbreakableGroup(columnEntryIndex)
                                && !ColumnGroupUtils.isInTheSameGroup(
                                        columnEntryIndex, nextColumnEntryIndex,
                                        columnGroupModel)) {
                            return;
                        }

                        // If next entry is an unbreakable column group - move
                        // past it
                        if (columnGroupModel != null
                                && columnGroupModel
                                        .isPartOfAnUnbreakableGroup(nextColumnEntryIndex)
                                && !ColumnGroupUtils.isInTheSameGroup(
                                        columnEntryIndex, nextColumnEntryIndex,
                                        columnGroupModel)) {
                            ColumnGroup nextColumnGroup = columnGroupModel
                                    .getColumnGroupByIndex(nextColumnEntryIndex);
                            toPositions.add(lastPositionInGroup
                                    + nextColumnGroup.getSize());
                        } else {
                            toPositions.add(lastPositionInGroup + 1);
                        }
                    }
                }
View Full Code Here

        }
    }

    public static boolean isInTheSameGroup(int fromColumnIndex,
            int toColumnIndex, ColumnGroupModel model) {
        ColumnGroup fromColumnGroup = model
                .getColumnGroupByIndex(fromColumnIndex);
        ColumnGroup toColumnGroup = model.getColumnGroupByIndex(toColumnIndex);

        return fromColumnGroup != null && toColumnGroup != null
                && fromColumnGroup == toColumnGroup;
    }
View Full Code Here

     *         it's group
     */
    public static boolean isStaticOrFirstVisibleColumn(int columnIndex,
            ILayer layer, IUniqueIndexLayer underlyingLayer,
            ColumnGroupModel model) {
        ColumnGroup columnGroup = model.getColumnGroupByIndex(columnIndex);

        if (columnGroup.getStaticColumnIndexes().size() == 0) {
            return isFirstVisibleColumnIndexInGroup(columnIndex, layer,
                    underlyingLayer, model);
        } else {
            return model.isStaticColumn(columnIndex);
        }
View Full Code Here

     * Inclusive of the columnIndex passed as the parameter.
     */
    public static List<Integer> getVisibleIndexesToTheRight(int columnIndex,
            ILayer layer, IUniqueIndexLayer underlyingLayer,
            ColumnGroupModel model) {
        ColumnGroup columnGroup = model.getColumnGroupByIndex(columnIndex);

        if (columnGroup.isCollapsed()) {
            return Collections.emptyList();
        }

        List<Integer> columnIndexesInGroup = columnGroup.getMembers();
        int columnPosition = underlyingLayer
                .getColumnPositionByIndex(columnIndex);
        List<Integer> visibleColumnIndexesOnRight = new ArrayList<Integer>();

        for (Integer currentIndex : columnIndexesInGroup) {
View Full Code Here

        assertEquals(3, getColumnIndexesInGroup(fromColumnIndex).size());
    }

    @Test
    public void shouldDragFirstCellRightAndAddColumnToGroup() {
        ColumnGroup columnGroup = modelFixture.getColumnGroupByIndex(0);
        columnGroup.removeColumn(0);
        assertEquals(1, getColumnIndexesInGroup(1).size());

        modelFixture.insertColumnIndexes(ColumnGroupModelFixture.TEST_GROUP_1,
                2);
        assertEquals(2, getColumnIndexesInGroup(1).size());
View Full Code Here

        Assert.assertEquals(1, columnIndexesInGroup.get(1).intValue());
    }

    @Test
    public void noColumnGroup() throws Exception {
        ColumnGroup columnGroup = model.getColumnGroupByIndex(100);
        Assert.assertNull(columnGroup);
    }
View Full Code Here

        Assert.assertEquals(1, model.getCollapsedColumnCount());
    }

    @Test
    public void removeColumnFromGroup() {
        ColumnGroup columnGroup = model.getColumnGroupByIndex(12);
        List<Integer> columnIndexesInGroup = columnGroup.getMembers();

        Assert.assertTrue(columnIndexesInGroup.contains(12));
        Assert.assertTrue(columnGroup.removeColumn(12));

        columnGroup = model.getColumnGroupByIndex(13);
        columnIndexesInGroup = columnGroup.getMembers();
        Assert.assertEquals(1, columnIndexesInGroup.size());
        Assert.assertTrue(columnGroup.removeColumn(13));

        Assert.assertFalse(model.isPartOfAGroup(12));
    }
View Full Code Here

        Assert.assertTrue(model.isPartOfAnUnbreakableGroup(0));
    }

    @Test
    public void shouldNotRemoveFromAnUnbreakableGroup() throws Exception {
        ColumnGroup columnGroup = model.getColumnGroupByIndex(7);
        columnGroup.setUnbreakable(true);
        Assert.assertFalse(columnGroup.removeColumn(7));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.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.