Package org.eclipse.sapphire.ui.forms

Examples of org.eclipse.sapphire.ui.forms.CompositeDef


   
    @Override
    public void render()
    {
        final CompositePart part = part();
        final CompositeDef def = part.definition();
       
        final boolean indent = ( def.getIndent().content() && ! ( part.parent() instanceof MasterDetailsContentNodePart ) );
       
        if( indent )
        {
            final Label label = new Label( composite(), SWT.NONE );
            label.setLayoutData( gd() );
           
            register( label );
        }

        final boolean scaleVertically = def.getScaleVertically().content();
        final int width = part.getWidth( -1 );
        final int height = part.getHeight( -1 );
       
        final Composite outerComposite = renderOuterComposite( gdwhint( gdhhint( gdhspan( ( scaleVertically ? gdfill() : gdhfill() ), ( indent ? 1 : 2 ) ), height ), width ) );
       
View Full Code Here


    }
   
    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;
           
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.forms.CompositeDef

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.