Skip to content

Commit

Permalink
Fix Bugzilla � Bug 282250 [Automation][Regression]NPE was thrown out …
Browse files Browse the repository at this point in the history
…while previewing report in PDF
  • Loading branch information
Gang Liu committed Jul 23, 2009
1 parent 5b9cf4e commit 7144934
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
Expand Up @@ -72,21 +72,26 @@ protected void close( boolean isLastLine ) throws BirtException
if ( isLastLine )
{
checkPageBreak( );
parent.add( this );
parent.update( this );
this.finished = true;
}
else
{
checkPageBreak( );
InlineContainerArea area = cloneArea( );
area.context = context;
area.children = children;
area.setParent( parent );
children = new ArrayList( );
parent.addChild( parent.getChildrenCount( ) - 1, area );
checkPageBreak( );
parent.addChild( area );
parent.update( area );
setPosition( parent.currentIP + parent.getOffsetX( ), parent
/*setPosition( parent.currentIP + parent.getOffsetX( ), parent
.getOffsetY( )
+ parent.currentBP );
+ parent.currentBP );*/
area.finished = true;
currentIP = 0;
height = 0;
}
}

Expand Down Expand Up @@ -116,7 +121,7 @@ public void initialize( ) throws BirtException
vAlign = style.getProperty( IStyle.STYLE_VERTICAL_ALIGN );
currentIP = 0;
currentBP = 0;
parent.add( this );
//parent.add( this );
}

public InlineContainerArea cloneArea( )
Expand All @@ -133,7 +138,6 @@ public void endLine( boolean endParagraph ) throws BirtException
}
if ( lineParent != null )
{
lineParent.removeChild( this );
lineParent.endLine( endParagraph );
initialize( );
}
Expand Down
Expand Up @@ -46,6 +46,7 @@ public LineArea( LineArea area )
{
super( area );
this.baseLevel = area.baseLevel;
this.isInlineStacking = true;
}

public void setBaseLevel( byte baseLevel )
Expand Down
Expand Up @@ -71,24 +71,46 @@ public TextAreaLayout( ContainerArea parent, LayoutContext context,
comp = new TextCompositor( textContent, context.getFontManager( ),
context );
// checks whether the current line is empty or not.
ContainerArea ancestor = parentLM;
do
LineArea lineParent = getLineParent();
boolean isEmptyLine = isEmtpy(lineParent);
comp.setNewLineStatus( isEmptyLine );
}

protected boolean isEmtpy(ContainerArea container)
{
int count = container.getChildrenCount( );
if ( count > 2 )
{
if ( null == ancestor )
{
// should never reach here.
comp.setNewLineStatus( true );
return;
}
if ( !ancestor.isEmpty( ) )
return false;
}
else if ( count == 0 )
{
return true;
}
else
{
AbstractArea child = (AbstractArea)container.getChild( 0 );
{
comp.setNewLineStatus( false );
return;
if(child instanceof ContainerArea)
{
return isEmtpy((ContainerArea)child);
}
else
{
return false;
}
}
}
}

protected LineArea getLineParent( )
{
ContainerArea ancestor = parentLM;
do
{
if ( ancestor instanceof LineArea )
{
comp.setNewLineStatus( ancestor.isEmpty( ) );
return;
return (LineArea) ancestor;
}
ancestor = ancestor.getParent( );
} while ( true );
Expand Down

0 comments on commit 7144934

Please sign in to comment.