}
protected void render( final Composite composite )
{
final CompositePart part = part();
final CompositeDef def = part.definition();
composite.setBackground( resources().color( part.getBackgroundColor() ) );
composite.setBackgroundMode( SWT.INHERIT_DEFAULT );
composite.setLayout( glayout( 1, 0, 0 ) );
final boolean scrollVertically = def.getScrollVertically().content();
final boolean scrollHorizontally = def.getScrollHorizontally().content();
if( scrollVertically || scrollHorizontally )
{
final int style
= ( scrollVertically ? SWT.V_SCROLL : SWT.NONE ) |
( scrollHorizontally ? SWT.H_SCROLL : SWT.NONE );
this.scrolledComposite = new ScrolledComposite( composite, style );
this.scrolledComposite.setExpandHorizontal( true );
this.scrolledComposite.setExpandVertical( true );
// ScrolledComposite does not seem to inherit background color like other controls, so
// we need to set it explicitly.
this.scrolledComposite.setBackground( composite.getBackground() );
this.scrolledComposite.setBackgroundMode( SWT.INHERIT_DEFAULT );
}
final int marginLeft = def.getMarginLeft().content();
final int marginRight = def.getMarginRight().content();
final int marginTop = def.getMarginTop().content();
final int marginBottom = def.getMarginBottom().content();
this.innerComposite = new Composite( ( this.scrolledComposite != null ? this.scrolledComposite : composite ), SWT.NONE ) {
public Point computeSize (int wHint, int hHint, boolean changed) {
if (this.getChildren().length == 0) {
return new Point(0, 0);
}
return super.computeSize(wHint, hHint, changed);
}
};
this.innerComposite.setLayout( glayout( 2, marginLeft, marginRight, marginTop, marginBottom ) );
if( this.scrolledComposite != null )
{
this.scrolledComposite.setContent( this.innerComposite );
this.scrolledComposite.setLayoutData( gdfill() );
}
else
{
this.innerComposite.setLayoutData( gdfill() );
}
final ISapphireDocumentation doc = def.getDocumentation().content();
if( doc != null )
{
ISapphireDocumentationDef docdef = null;