Package org.uguess.birt.report.engine.spreadsheet.model

Examples of org.uguess.birt.report.engine.spreadsheet.model.Sheet


  public Sheet removeSheet( Object obj )
  {
    int index = getSheetIndex( obj );

    Sheet sheet = null;
    if ( index >= 0 && index < sheets.size( ) )
    {
      sheet = sheets.remove( index );
    }
View Full Code Here


  {
    int index = getSheetIndex( obj );

    if ( index >= 0 && index < sheets.size( ) )
    {
      Sheet sheet = sheets.get( index );
      sheet.setName( newName );
      return true;
    }

    return false;
  }
View Full Code Here

    public void end(IReportContent rc) {
        if (exportSingleSheet && singleContainer != null) {
            long span = System.currentTimeMillis();

            // process single sheet here.
            Sheet modelSheet = Transformer.toSheet(singleContainer,
                    1000,
                    fixedColumnWidth * 1000);
            exportSheet(modelSheet);

            if (DEBUG) {
                logger.log(Level.INFO, "------------export total single sheet using " //$NON-NLS-1$
                        + (System.currentTimeMillis() - span) + " ms"); //$NON-NLS-1$
            }
        }

        if (aggregateOnFirstLevel && singleContainer != null) {

            Set<Integer> pageNums = multiPageContainer.keySet();
            for (Integer pag : pageNums) {
                singleContainer = multiPageContainer.get(pag);
                long span = System.currentTimeMillis();
                // process single sheet here.
                Sheet modelSheet = Transformer.toSheet(singleContainer,
                        1000,
                        fixedColumnWidth * 1000);
                exportSheet(modelSheet);

                if (DEBUG) {
View Full Code Here

                                + (currentPageIndex) + "] using " //$NON-NLS-1$
                                + (System.currentTimeMillis() - span) + " ms"); //$NON-NLS-1$
                    }
                } else {
                    // export body frame
                    Sheet modelSheet = Transformer.toSheet(bodyFrame,
                            1000,
                            fixedColumnWidth * 1000);
                    exportSheet(modelSheet);

                    if (DEBUG) {
                        logger.log(Level.INFO, "------------export sheet[" //$NON-NLS-1$
                                + (currentPageIndex) + "] using " //$NON-NLS-1$
                                + (System.currentTimeMillis() - span) + " ms"); //$NON-NLS-1$
                    }
                }
            } else {
                if (exportSingleSheet) {
                    // aggregate only
                    if (singleContainer == null) {
                        singleContainer = new AggregateFrame();
                        singleContainer.setRight(currentFrame.getRight() - currentFrame.getLeft());
                        singleContainer.setBottom(currentFrame.getBottom() - currentFrame.getTop());
                    } else {
                        int yOff = singleContainer.getBottom();
                        singleContainer.setBottom(yOff + currentFrame.getBottom() - currentFrame.getTop());

                        if (currentFrame instanceof AreaFrame) {
                            ((AreaFrame) currentFrame).setYOffset(yOff);
                        }
                    }

                    singleContainer.addChild(currentFrame);
                    if (currentFrame instanceof AreaFrame) {
                        ((AreaFrame) currentFrame).setParent(singleContainer);
                    }

                    if (DEBUG) {
                        logger.log(Level.INFO, "------------aggregate sheet[" //$NON-NLS-1$
                                + (currentPageIndex) + "] using " //$NON-NLS-1$
                                + (System.currentTimeMillis() - span) + " ms"); //$NON-NLS-1$
                    }
                } else if (aggregateOnFirstLevel) {
                    PageArea pa = (PageArea) currentFrame.getData();
                    IContainerArea header = pa.getHeader();

                    singleContainer = multiPageContainer.get(AggregateFinder.get().getPageNum());
                    // aggregate only
                    if (singleContainer == null) {
                        singleContainer = new AggregateFrame();
                        singleContainer.setRight(currentFrame.getRight() - currentFrame.getLeft());
                        singleContainer.setBottom(currentFrame.getBottom() - currentFrame.getTop());
                        multiPageContainer.put(new Integer(AggregateFinder.get().getPageNum()), singleContainer);
                    } else {
                        int yOff = singleContainer.getBottom();
                        singleContainer.setBottom(yOff + currentFrame.getBottom() - currentFrame.getTop());

                        if (currentFrame instanceof AreaFrame) {
                            ((AreaFrame) currentFrame).setYOffset(yOff);
                        }
                    }

                    singleContainer.addChild(currentFrame);
                    if (currentFrame instanceof AreaFrame) {
                        ((AreaFrame) currentFrame).setParent(singleContainer);
                    }

                    if (DEBUG) {
                        logger.log(Level.INFO, "------------aggregate sheet[" //$NON-NLS-1$
                                + (currentPageIndex) + "] using " //$NON-NLS-1$
                                + (System.currentTimeMillis() - span) + " ms"); //$NON-NLS-1$
                    }
                } else {
                    // one page completed, process it.
                    Sheet modelSheet = Transformer.toSheet(currentFrame,
                            1000,
                            fixedColumnWidth * 1000);
                    exportSheet(modelSheet);

                    if (DEBUG) {
View Full Code Here

        if (frame == null) {
            return null;
        }

        // TODO use real or automatic sheet name
        Sheet sheet = SheetImpl.create("x", frame.getStyle()); //$NON-NLS-1$
        Cell defaultCell = sheet.getDefaultCell();

        // compute fragments
        List<Integer> xFrags = new ArrayList<Integer>();
        List<Integer> yFrags = new ArrayList<Integer>();
        computeFragments(xFrags, yFrags, frame);

        if (fixedColumnWidth > 0 && xFrags.size() > 0) {
            // fill up the not-used columns
            Collections.sort(xFrags);

            int max = xFrags.get(xFrags.size() - 1);

            for (int i = 0; i < max; i += fixedColumnWidth) {
                Integer cut = new Integer(i);
                if (!xFrags.contains(cut)) {
                    xFrags.add(cut);
                }
            }
        }

        Collections.sort(xFrags);
        Collections.sort(yFrags);

        // initialize sheet row/column by fragments count
        int old = 0;
        int current = 0;
        int xCellCount = xFrags.size() - 1;
        int yCellCount = yFrags.size() - 1;

        current = xFrags.get(0);
        for (int i = 0; i < xCellCount; i++) {
            old = current;
            current = xFrags.get(i + 1);
            sheet.setColumnWidth(i, (current - old));
        }

        current = yFrags.get(0);
        for (int i = 0; i < yCellCount; i++) {
            old = current;
            current = yFrags.get(i + 1);
            sheet.setRowHeight(i, (current - old));
        }

        // layout children
        layoutChildren(xFrags,
                yFrags,
                sheet,
                defaultCell,
                frame,
                frame.getStyle(),
                0,
                0);

        if (fixedColumnWidth > 0) {
            // fill up extra columns during layout
            int max = sheet.getActiveColumnRange();

            for (int i = xFrags.size() - 1; i <= max; i++) {
                sheet.setColumnWidth(i, fixedColumnWidth);
            }
        }

        return sheet;
    }
View Full Code Here

    if ( index < 0 || index > sheets.size( ) )
    {
      index = sheets.size( );
    }

    Sheet sheet = SheetImpl.create( name, StyleImpl.createEmpty( ) );
    sheets.add( index, sheet );
    return sheet;
  }
View Full Code Here

  public Sheet getSheet( Object objIndex )
  {
    int index = getSheetIndex( objIndex );

    Sheet sheet = null;
    if ( index >= 0 && index < sheets.size( ) )
    {
      sheet = sheets.get( index );
    }
View Full Code Here

    else if ( anchor instanceof String )
    {
      String name = (String) anchor;
      for ( int i = 0; i < sheets.size( ); i++ )
      {
        Sheet sheet = sheets.get( i );
        if ( ( name == null && sheet.getName( ) == null )
            || ( name != null && name.equals( sheet.getName( ) ) ) )
        {
          index = i;
          break;
        }
      }
View Full Code Here

TOP

Related Classes of org.uguess.birt.report.engine.spreadsheet.model.Sheet

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.