afreechart/src/main/java/org/afree/chart/block/FlowArrangement.java
/**
     * Arranges the blocks without any constraints. This puts all blocks into a
     * single row.
     * 
     * @param container
     *            the container.
     * @param canvas
     *            the graphics device.
     * 
     * @return The size after the arrangement.
     */
Arranges the blocks without any constraints. This puts all blocks into a
single row.

@param container
the container.
@param canvas
the graphics device.

@return The size after the arrangement.
Arranges the blocks without any constraints . This puts all blocks into a single row . @param container the container . @param canvas the graphics device . @return The size after the arrangement .
protected Size2D arrangeNN(BlockContainer container, Canvas canvas) {
        double x = 0.0;
        double width = 0.0;
        double maxHeight = 0.0;
        List blocks = container.getBlocks();
        int blockCount = blocks.size();
        if (blockCount > 0) {
            Size2D[] sizes = new Size2D[blocks.size()];
            for (int i = 0; i < blocks.size(); i++) {
                Block block = (Block) blocks.get(i);
                sizes[i] = block.arrange(canvas, RectangleConstraint.NONE);
                width = width + sizes[i].getWidth();
                maxHeight = Math.max(sizes[i].height, maxHeight);
                block.setBounds(new RectShape(x, 0.0, sizes[i].width,
                        sizes[i].height));
                x = x + sizes[i].width + this.horizontalGap;
            }
            if (blockCount > 1) {
                width = width + this.horizontalGap * (blockCount - 1);
            }
            if (this.verticalAlignment != VerticalAlignment.TOP) {
                for (int i = 0; i < blocks.size(); i++) {
                    if (this.verticalAlignment == VerticalAlignment.CENTER) {
                    } else if (this.verticalAlignment == VerticalAlignment.BOTTOM) {
                    }
                }
            }
        }
        return new Size2D(width, maxHeight);
    }
protected Size2D arrangeNN ( BlockContainer container , Canvas canvas ) { double x = 0.0 ; double width = 0.0 ; double maxHeight = 0.0 ; List blocks = container . getBlocks ( ) ; int blockCount = blocks . size ( ) ; if ( blockCount > 0 ) { Size2D [ ] sizes = new Size2D [ blocks . size ( ) ] ; for ( int i = 0 ; i < blocks . size ( ) ; i ++ ) { Block block = ( Block ) blocks . get ( i ) ; sizes [ i ] = block . arrange ( canvas , RectangleConstraint . NONE ) ; width = width + sizes [ i ] . getWidth ( ) ; maxHeight = Math . max ( sizes [ i ] . height , maxHeight ) ; block . setBounds ( new RectShape ( x , 0.0 , sizes [ i ] . width , sizes [ i ] . height ) ) ; x = x + sizes [ i ] . width + this . horizontalGap ; } if ( blockCount > 1 ) { width = width + this . horizontalGap * ( blockCount - 1 ) ; } if ( this . verticalAlignment != VerticalAlignment . TOP ) { for ( int i = 0 ; i < blocks . size ( ) ; i ++ ) { if ( this . verticalAlignment == VerticalAlignment . CENTER ) { } else if ( this . verticalAlignment == VerticalAlignment . BOTTOM ) { } } } } return new Size2D ( width , maxHeight ) ; }
Arranges the blocks without any constraints.
Arranges the blocks without any constraints .
// Block b = (Block) blocks.get(i); // TODO: shift block down by half // TODO: shift block down to bottom