@Override
    public void init( Graphics2D g )
        throws MojoExecutionException
    {
        switch ( alignment )
        {
            case HORIZONTAL:
            {
                for ( Drawable d : getDraw() )
                {
                    d.setDrawingContext( dwContext );

                    Graphics2D sg = (Graphics2D) g.create();

                    try
                    {
                        d.init( sg );
                    }
                    finally
                    {
                        sg.dispose();
                    }

                    dwBounds.width += d.getBounds().width;

                    dwBounds.height = Math.max( d.getBounds().height, dwBounds.height );
                }

                if ( getDraw().size() > 1 )
                {
                    dwBounds.width += padding * ( getDraw().size() - 1 );
                }

                int offset = 0;

                for ( Drawable d : getDraw() )
                {
                    Graphics2D sg =
                            (Graphics2D) g.create(
                                    dwBounds.x + offset, dwBounds.y,
                                    d.getBounds().width, dwBounds.height );

                    try
                    {
                        d.init( sg );
                    }
                    finally
                    {
                        sg.dispose();
                    }

                    offset += d.getBounds().width + padding;
                }

                break;
            }

            case VERTICAL:
            {
                for ( Drawable d : getDraw() )
                {
                    d.setDrawingContext( dwContext );

                    Graphics2D sg = (Graphics2D) g.create();

                    try
                    {
                        d.init( sg );
                    }
                    finally
                    {
                        sg.dispose();
                    }

                    dwBounds.height += d.getBounds().height;

                    dwBounds.width = Math.max( d.getBounds().width, dwBounds.width );
                }

                if ( getDraw().size() > 1 )
                {
                    dwBounds.height += padding * ( getDraw().size() - 1 );
                }

                int offset = 0;

                for ( Drawable d : getDraw() )
                {
                    Graphics2D sg =
                            (Graphics2D) g.create(
                                    dwBounds.x, dwBounds.y + offset,
                                    dwBounds.width, d.getBounds().height );

                    try
                    {
                        d.init( sg );
                    }
                    finally
                    {
                        sg.dispose();
                    }

                    offset += d.getBounds().width + padding;
                }

                break;
            }

            default:
                throw new MojoExecutionException( "Unknown alignment " + alignment );
        }

        super.init( g );
    }