Package org.drools.guvnor.client.widgets.drools.decoratedgrid.CellValue

Examples of org.drools.guvnor.client.widgets.drools.decoratedgrid.CellValue.GroupedCellValue


    @SuppressWarnings("rawtypes")
    public void testDataGrouping() {
        //[1][-][3] --> [1][x][x]
        //[1][2][*] --> [-][2][3]
        //[-][2][3] -->
        GroupedCellValue gcv;
        CellValue< ? extends Comparable< ? >> cv = data.get( 0 ).get( 0 );

        data.setMerged( true );
        data.applyModelGrouping( cv );

        assertEquals( data.size(),
                      2 );

        cv = data.get( 0 ).get( 0 );
        assertTrue( cv instanceof GroupedCellValue );
        gcv = (GroupedCellValue) cv;
        assertFalse( gcv.hasMultipleValues() );
        assertEquals( cv.getValue(),
                      "1" );
        cv = data.get( 0 ).get( 1 );
        assertTrue( cv instanceof GroupedCellValue );
        gcv = (GroupedCellValue) cv;
        assertTrue( gcv.hasMultipleValues() );
        cv = data.get( 0 ).get( 2 );
        assertTrue( cv instanceof GroupedCellValue );
        gcv = (GroupedCellValue) cv;
        assertTrue( gcv.hasMultipleValues() );
        assertEquals( cv.getValue(),
                      "3" );

        cv = data.get( 1 ).get( 0 );
        assertFalse( cv instanceof GroupedCellValue );
View Full Code Here


    @SuppressWarnings("rawtypes")
    public void testDataGrouping() {
        //[1][-][3] --> [1][x][3]
        //[1][2][3] --> [-][2][3]
        //[-][2][3] -->
        GroupedCellValue gcv;
        CellValue< ? extends Comparable< ? >> cv = data.get( 0 ).get( 0 );

        data.setMerged( true );
        data.applyModelGrouping( cv );

        assertEquals( data.size(),
                      2 );

        cv = data.get( 0 ).get( 0 );
        assertTrue( cv instanceof GroupedCellValue );
        gcv = (GroupedCellValue) cv;
        assertFalse( gcv.hasMultipleValues() );
        assertEquals( cv.getValue(),
                      "1" );
        cv = data.get( 0 ).get( 1 );
        assertTrue( cv instanceof GroupedCellValue );
        gcv = (GroupedCellValue) cv;
        assertTrue( gcv.hasMultipleValues() );
        cv = data.get( 0 ).get( 2 );
        assertTrue( cv instanceof GroupedCellValue );
        gcv = (GroupedCellValue) cv;
        assertFalse( gcv.hasMultipleValues() );
        assertEquals( cv.getValue(),
                      "3" );

        cv = data.get( 1 ).get( 0 );
        assertFalse( cv instanceof GroupedCellValue );
View Full Code Here

    @SuppressWarnings({"rawtypes", "unchecked"})
    private DynamicDataRow cloneDynamicDataRow(GroupedDynamicDataRow sourceRowData) {
        GroupedDynamicDataRow rowData = new GroupedDynamicDataRow();
        for ( int iCol = 0; iCol < sourceRowData.size(); iCol++ ) {
            CellValue< ? extends Comparable< ? >> sourceCell = sourceRowData.get( iCol );
            GroupedCellValue cell = sourceCell.convertToGroupedCell();
            if ( sourceCell instanceof GroupedCellValue ) {
                GroupedCellValue groupedSourceCell = (GroupedCellValue) sourceCell;
                if ( groupedSourceCell.isGrouped() ) {
                    cell.addState( CellState.GROUPED );
                }
                if ( groupedSourceCell.isOtherwise() ) {
                    cell.addState( CellState.OTHERWISE );
                }
            }
            rowData.add( cell );
        }
View Full Code Here

                    cell.removeState( CellState.OTHERWISE );
                }

                //Copy data that is changing for an event to update the underlying model
                if ( cell instanceof GroupedCellValue ) {
                    GroupedCellValue gcv = (GroupedCellValue) cell;
                    for ( int iChildValueIndex = 0; iChildValueIndex < gcv.getGroupedCells().size(); iChildValueIndex++ ) {
                        changedRow.add( data.get( c ) );
                        changedBlock.add( changedRow );
                    }
                } else {
                    changedRow.add( data.get( c ) );
                    changedBlock.add( changedRow );
                }
            }
        }
        Coordinate originSelected = new Coordinate( rowMapper.mapToAbsoluteRow( firstSelection.getRow() ),
                                                    firstSelection.getCol() );
        changedData.put( originSelected,
                         changedBlock );

        //---Clear dependent cells' values---
        final Context context = new Context( 0,
                                             firstSelection.getCol(),
                                             null );
        final Set<Integer> dependentColumnIndexes = this.dropDownManager.getDependentColumnIndexes( context );
        for ( Integer dependentColumnIndex : dependentColumnIndexes ) {
            changedBlock = new ArrayList<List<CellValue< ? extends Comparable< ? >>>>();
            for ( CellValue< ? extends Comparable< ? >> cell : selections ) {
                changedRow = new ArrayList<CellValue< ? extends Comparable< ? >>>();
                Coordinate dc = new Coordinate( cell.getCoordinate().getRow(),
                                                dependentColumnIndex );
                if ( !columns.get( dc.getCol() ).isSystemControlled() ) {
                    data.set( dc,
                              null );
                    if ( value != null ) {
                        cell.removeState( CellState.OTHERWISE );
                    }

                    //Copy data that is changing for an event to update the underlying model
                    if ( cell instanceof GroupedCellValue ) {
                        GroupedCellValue gcv = (GroupedCellValue) cell;
                        for ( int iChildValueIndex = 0; iChildValueIndex < gcv.getGroupedCells().size(); iChildValueIndex++ ) {
                            changedRow.add( data.get( dc ) );
                            changedBlock.add( changedRow );
                        }
                    } else {
                        changedRow.add( data.get( dc ) );
View Full Code Here

                    }
                }

                //Copy data that is changing for an event to update the underlying model
                if ( cell instanceof GroupedCellValue ) {
                    GroupedCellValue gcv = (GroupedCellValue) cell;
                    for ( int iChildValueIndex = 0; iChildValueIndex < gcv.getGroupedCells().size(); iChildValueIndex++ ) {
                        List<CellValue< ? extends Comparable< ? >>> changedRow = new ArrayList<CellValue< ? extends Comparable< ? >>>();
                        changedRow.add( data.get( c ) );
                        changedData.add( changedRow );
                    }
                } else {
View Full Code Here

                tce.addClassName( resources.cellTableCellOtherwise() );
            } else {
                tce.removeClassName( resources.cellTableCellOtherwise() );
            }
            if ( cellData instanceof GroupedCellValue ) {
                GroupedCellValue gcv = (GroupedCellValue) cellData;
                if ( gcv.hasMultipleValues() ) {
                    tce.addClassName( resources.cellTableCellMultipleValues() );
                }
            } else {
                tce.removeClassName( resources.cellTableCellMultipleValues() );
            }
View Full Code Here

            //Re-apply applicable styling
            if ( cell.isOtherwise() ) {
                tce.addClassName( cellOtherwiseStyle );
            }
            if ( cell instanceof GroupedCellValue ) {
                GroupedCellValue gcv = (GroupedCellValue) cell;
                if ( gcv.hasMultipleValues() ) {
                    tce.addClassName( cellMultipleValuesStyle );
                }
            }
        }
    }
View Full Code Here

    @SuppressWarnings({"unchecked", "rawtypes"})
    public boolean addChildRow(DynamicDataRow childRow) {
        for ( int iCol = 0; iCol < childRow.size(); iCol++ ) {
            if ( this.get( iCol ) instanceof GroupedCellValue ) {
                GroupedCellValue gcv = (GroupedCellValue) this.get( iCol );
                gcv.addCellToGroup( childRow.get( iCol ) );
            }
        }
        return this.groupedRows.add( childRow );
    }
View Full Code Here

            CellValue< ? extends Comparable< ? >> cell = columnData.get( iRowIndex );
            if ( row instanceof GroupedDynamicDataRow ) {
                GroupedDynamicDataRow groupedRow = (GroupedDynamicDataRow) row;

                //Setting value on a GroupedCellValue causes all children to assume the same value
                GroupedCellValue gcv = cell.convertToGroupedCell();
                groupedRow.add( index,
                                gcv );

                //So set the children's values accordingly
                for ( int iGroupedRow = 0; iGroupedRow < groupedRow.getChildRows().size(); iGroupedRow++ ) {
                    cell = columnData.get( iRowIndex );
                    gcv.addCellToGroup( cell );
                    groupedRow.getChildRows().get( iGroupedRow ).set( index,
                                                                      cell );
                    iRowIndex++;
                }
            } else {
View Full Code Here

        int startRowIndex = startCell.getCoordinate().getRow();
        int endRowIndex = findMergedCellExtent( startCell.getCoordinate() ).getRow();
        int colIndex = startCell.getCoordinate().getCol();

        //Delete grouped rows replacing with a single "grouped" row
        GroupedCellValue groupedCell;
        DynamicDataRow row = data.get( startRowIndex );
        GroupedDynamicDataRow groupedRow = new GroupedDynamicDataRow();
        for ( int iCol = 0; iCol < row.size(); iCol++ ) {
            groupedCell = row.get( iCol ).convertToGroupedCell();
            if ( iCol == colIndex ) {
                groupedCell.addState( CellState.GROUPED );
            } else {
                groupedCell.removeState( CellState.GROUPED );
            }
            groupedRow.add( groupedCell );
        }

        //Add individual cells to "grouped" row
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.widgets.drools.decoratedgrid.CellValue.GroupedCellValue

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.