Java 类org.eclipse.swt.widgets.Layout 实例源码

项目:team-explorer-everywhere    文件:SizeConstrainedComposite.java   
private Point getLayoutMargin() {
    final Layout layout = getLayout();

    if (layout == null) {
        return new Point(0, 0);
    } else if (layout instanceof GridLayout) {
        final GridLayout gridLayout = (GridLayout) layout;
        return new Point(gridLayout.marginWidth, gridLayout.marginHeight);
    } else if (layout instanceof FillLayout) {
        final FillLayout fillLayout = (FillLayout) layout;
        return new Point(fillLayout.marginWidth, fillLayout.marginHeight);
    } else if (layout instanceof FormLayout) {
        final FormLayout formLayout = (FormLayout) layout;
        return new Point(formLayout.marginWidth, formLayout.marginHeight);
    }

    return new Point(0, 0);
}
项目:google-cloud-eclipse    文件:DeployPropertyPageTest.java   
@Test
public void testCorrectPanelIsShownForFacetedProject() {
  DeployPropertyPage page = new DeployPropertyPage(loginService, googleApiFactory);
  Shell parent = shellTestResource.getShell();
  page.setElement(getProject());
  page.createControl(parent);
  page.setVisible(true);
  Composite preferencePageComposite = (Composite) parent.getChildren()[0];
  for (Control control : preferencePageComposite.getChildren()) {
    if (control instanceof Composite) {
      Composite maybeDeployPageComposite = (Composite) control;
      Layout layout = maybeDeployPageComposite.getLayout();
      if (layout instanceof StackLayout) {
        StackLayout stackLayout = (StackLayout) layout;
        assertThat(stackLayout.topControl, instanceOf(getPanelClass()));
        return;
      }
    }
  }
  fail("Did not find the deploy preferences panel");
}
项目:depan    文件:ArtifactEditor.java   
/**
 * Creates a new {@link ArtifactEditor}.
 *
 * @param parent parent Container.
 * @param style SWT style for the container.
 * @param swtTextStyle SWT style for textboxes. Useful to set them
 *        SWT.READ_ONLY for instance.
 */
public ArtifactEditor(
    Composite parent, Integer style, Integer swtTextStyle) {
  super(parent, style, swtTextStyle);
  // widgets
  icon = new Label(this, SWT.NONE);
  Label labelName = new Label(this, SWT.NONE);
  path = new Text(this, swtTextStyle);

  // layout
  Layout layout = new GridLayout(3, false);
  this.setLayout(layout);

  GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
  iconGridData.minimumHeight = 16;
  iconGridData.minimumWidth = 16;
  icon.setLayoutData(iconGridData);
  labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
  path.setLayoutData(
      new GridData(SWT.FILL, SWT.FILL, true, false));

  // content
  icon.setImage(MavenActivator.IMAGE_MAVEN);
  labelName.setText("Path");
}
项目:depan    文件:PropertyEditor.java   
/**
 * Creates a new {@link PropertyEditor}.
 *
 * @param parent parent Container.
 * @param style SWT style for the container.
 * @param swtTextStyle SWT style for textboxes. Useful to set them
 *        SWT.READ_ONLY for instance.
 */
public PropertyEditor(
    Composite parent, Integer style, Integer swtTextStyle) {
  super(parent, style, swtTextStyle);
  // widgets
  icon = new Label(this, SWT.NONE);
  Label labelName = new Label(this, SWT.NONE);
  path = new Text(this, swtTextStyle);

  // layout
  Layout layout = new GridLayout(3, false);
  this.setLayout(layout);

  GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
  iconGridData.minimumHeight = 16;
  iconGridData.minimumWidth = 16;
  icon.setLayoutData(iconGridData);
  labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
  path.setLayoutData(
      new GridData(SWT.FILL, SWT.FILL, true, false));

  // content
  icon.setImage(MavenActivator.IMAGE_MAVEN);
  labelName.setText("Path");
}
项目:depan    文件:DirectoryEditor.java   
/**
 * Creates a new <code>DirectoryEditor</code>.
 *
 * @param parent parent Container.
 * @param style SWT style for the container.
 * @param swtTextStyle SWT style for textboxes. Useful to set them
 *        SWT.READ_ONLY for instance.
 */
public DirectoryEditor(
    Composite parent, Integer style, Integer swtTextStyle) {
  super(parent, style, swtTextStyle);
  // widgets
  icon = new Label(this, SWT.NONE);
  Label labelName = new Label(this, SWT.NONE);
  path = new Text(this, swtTextStyle);

  // layout
  Layout layout = new GridLayout(3, false);
  this.setLayout(layout);

  GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
  iconGridData.minimumHeight = 16;
  iconGridData.minimumWidth = 16;
  icon.setLayoutData(iconGridData);
  labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
  path.setLayoutData(
      new GridData(SWT.FILL, SWT.FILL, true, false));

  // content
  icon.setImage(FileSystemActivator.IMAGE_DIRECTORY);
  labelName.setText("Path");
}
项目:vTM-eclipse    文件:SWTUtil.java   
/**
 * Alter a grid layout so that it has no spacing between controls, and no
 * margins.
 * @param layout The layout to alter.
 * @return The layout passed in.
 */
public static Layout makeLayoutTight( Layout layout )
{
   if( layout instanceof GridLayout ) {  
      GridLayout gridLayout = (GridLayout) layout;
      gridLayout.marginBottom = 0;
      gridLayout.marginHeight = 0;
      gridLayout.marginLeft = 0;
      gridLayout.marginRight = 0;
      gridLayout.marginTop = 0;
      gridLayout.marginWidth = 0;
      gridLayout.horizontalSpacing = 0;
      gridLayout.verticalSpacing = 0;
   }
   return layout;
}
项目:jo-widgets    文件:PatchedCompositeReflectionAccessor.java   
PatchedCompositeReflectionAccessor() throws NoSuchMethodException, NoSuchFieldException {
    this.runSkinMethod = Display.class.getDeclaredMethod("runSkin");
    runSkinMethod.setAccessible(true);

    this.computeSizeMethod = Layout.class.getDeclaredMethod(
            "computeSize",
            Composite.class,
            int.class,
            int.class,
            boolean.class);
    computeSizeMethod.setAccessible(true);

    this.minimumSizeMethod = Composite.class.getDeclaredMethod("minimumSize", int.class, int.class, boolean.class);
    minimumSizeMethod.setAccessible(true);

    this.stateField = Widget.class.getDeclaredField("state");
    stateField.setAccessible(true);
}
项目:jo-widgets    文件:LayoutWrapper.java   
public LayoutWrapper(final Layout layout) {
    super();
    Assert.paramNotNull(layout, "layout");
    this.layout = new FormLayout();
    this.layoutListeners = new HashSet<ILayoutListener>();
    try {
        this.computeSizeMethod = layout.getClass().getDeclaredMethod(
                "computeSize",
                Composite.class,
                int.class,
                int.class,
                boolean.class);
        this.computeSizeMethod.setAccessible(true);

        this.layoutMethod = layout.getClass().getDeclaredMethod("layout", Composite.class, boolean.class);
        this.layoutMethod.setAccessible(true);

    }
    catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
项目:p2-installer    文件:ProgressPage.java   
/**
 * Constructor
 * 
 * @param parent Parent
 * @param layout Layout
 */
public InstallProgressMonitorPart(Composite parent, Layout layout) {
    super(parent, layout, false);

    // Replace the cancel handler with one that can
    // prompt for confirmation.
    fCancelListener = new Listener() {
        public void handleEvent(Event e) {
            if (canCancel()) {
                setCanceled(true);
                if (fCancelComponent != null) {
                    fCancelComponent.setEnabled(false);
                }
            }
        }
    };
}
项目:birt    文件:JDBCSelectionPageHelper.java   
private void createPropertiesComposite( Composite content )
{
    GridData gridData;

    porpertyGroupComposite = new Composite( content, SWT.NONE );

    gridData = new GridData( GridData.FILL_HORIZONTAL
            | GridData.GRAB_HORIZONTAL );
    gridData.horizontalSpan = 4;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.exclude = true;
    porpertyGroupComposite.setLayoutData( gridData );
    GridLayout layout = new GridLayout( );
    // layout.horizontalSpacing = layout.verticalSpacing = 0;
    layout.marginWidth = layout.marginHeight = 0;
    layout.numColumns = 5;
    Layout parentLayout = porpertyGroupComposite.getParent( ).getLayout( );
    if ( parentLayout instanceof GridLayout )
        layout.horizontalSpacing = ( (GridLayout) parentLayout ).horizontalSpacing;
    porpertyGroupComposite.setLayout( layout );
}
项目:Pydev    文件:TreeSelectionDialog.java   
private void updateCompositeLayout(Composite composite) {
    Layout l = composite.getLayout();
    if (l instanceof GridLayout) {
        GridLayout layout = (GridLayout) l;
        layout.marginHeight = convertVerticalDLUsToPixels(getDefaultMargins());
        layout.marginWidth = convertHorizontalDLUsToPixels(getDefaultMargins());
        layout.verticalSpacing = convertVerticalDLUsToPixels(getDefaultSpacing());
        layout.horizontalSpacing = convertHorizontalDLUsToPixels(getDefaultSpacing());
        composite.setLayout(layout);
    }
    for (Control t : composite.getChildren()) {
        if (t instanceof Composite) {
            updateCompositeLayout((Composite) t);
        }
    }
}
项目:Pydev    文件:BaseSourceViewer.java   
@Override
protected Layout createLayout() {
    //Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=438641
    return new RulerLayout(GAP_SIZE_1) {
        @Override
        protected void layout(Composite composite, boolean flushCache) {
            StyledText textWidget = getTextWidget();
            if (textWidget == null) {
                Log.log("Error: textWidget is already null. SourceViewer: " + BaseSourceViewer.this + " control: "
                        + BaseSourceViewer.this.getControl());
                return;
            }
            super.layout(composite, flushCache);
        }
    };
}
项目:cogtool    文件:View.java   
/**
 * Support for creating the view's window.
 * <p>
 * This is called by createShell(Rectangle) in most of our subclasses,
 * but needs to be a static method in each of them, hence we can't use
 * overriding, and instead have this as a helper to be called explicitly.
 *
 * @param bounds if null, use a default position, and otherwise use this as
 *               position and size of the window
 * @param width  if bounds is null, use this as the default width; otherwise
 *               the value of <code>width</code> is ignored
 * @param height if bounds is null, use this as the default height; otherwise
 *               the value of <code>height</code> is ignored
 * @param layout the Layout used by the window
 * @return       the new window
 */
protected static Shell createShell(Rectangle bounds,
                                   int width,
                                   int height,
                                   Layout layout)
{
    return WindowUtil.createNormalWindow(WindowUtil.GLOBAL_DISPLAY,
                                         "",
                                         ((bounds != null)
                                                 ? bounds
                                                 : new Rectangle(0,
                                                                 0,
                                                                 width,
                                                                 height)),
                                         (bounds != null),
                                         layout);
}
项目:geoprism    文件:GeodashboardSelectionPageHelper.java   
private void createPropertiesComposite(Composite content)
{
  GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
  gridData.horizontalSpan = 4;
  gridData.horizontalAlignment = SWT.FILL;
  gridData.exclude = true;

  GridLayout layout = new GridLayout();
  layout.marginWidth = layout.marginHeight = 0;
  layout.numColumns = 5;

  Layout parentLayout = content.getLayout();

  if (parentLayout instanceof GridLayout)
  {
    layout.horizontalSpacing = ( (GridLayout) parentLayout ).horizontalSpacing;
  }

  porpertyGroupComposite = new Composite(content, SWT.NONE);
  porpertyGroupComposite.setLayoutData(gridData);
  porpertyGroupComposite.setLayout(layout);
}
项目:eZooKeeper    文件:DataModelFormPage.java   
protected Layout createClientLayout() {
    FormLayout clientLayout = new FormLayout();
    clientLayout.marginWidth = 8;
    clientLayout.marginHeight = 8;
    clientLayout.spacing = 8;
    return clientLayout;
}
项目:eZooKeeper    文件:ZooKeeperConnectionModelMainFormPage.java   
@Override
protected Layout createClientLayout() {
    GridLayout gridLayout = new GridLayout(1, true);
    gridLayout.verticalSpacing = 20;
    gridLayout.marginWidth = 8;
    return gridLayout;
}
项目:eZooKeeper    文件:BaseZnodeModelDataEditor.java   
protected Layout createLayout() {
    FormLayout formLayout = new FormLayout();
    formLayout.marginHeight = 8;
    formLayout.marginWidth = 8;
    formLayout.spacing = 8;       
    return formLayout;
}
项目:eZooKeeper    文件:ZnodeModelDataFormPage.java   
@Override
protected Layout createClientLayout() {
    FormLayout clientLayout = (FormLayout) super.createClientLayout();
    clientLayout.spacing = 10;
    clientLayout.marginBottom = 10;
    return clientLayout;
}
项目:eZooKeeper    文件:JmxConnectionModelMainFormPage.java   
@Override
protected Layout createClientLayout() {
    GridLayout gridLayout = new GridLayout(1, true);
    gridLayout.verticalSpacing = 20;
    gridLayout.marginWidth = 8;
    return gridLayout;
}
项目:eZooKeeper    文件:BaseJmxModelMainFormPage.java   
@Override
protected Layout createClientLayout() {
    GridLayout gridLayout = new GridLayout(1, true);
    gridLayout.verticalSpacing = 20;
    gridLayout.marginWidth = 8;
    return gridLayout;
}
项目:neoscada    文件:SingleVisualInterfaceViewPart.java   
private Layout createExtensionGridLayout ()
{
    final GridLayout gridLayout = new GridLayout ( 1, false );

    gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
    gridLayout.marginHeight = gridLayout.marginWidth = 0;

    return gridLayout;
}
项目:avro-schema-editor    文件:AttributeControlConfigurations.java   
public Layout getMainLayout() {
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 10;
    layout.marginWidth = 10;
    layout.verticalSpacing = 10;
    layout.horizontalSpacing = 10;
    return layout;
}
项目:egradle    文件:SWTFactory.java   
/**
 * Creates a vertical spacer for separating components. If applied to a
 * <code>GridLayout</code>, this method will automatically span all of the
 * columns of the parent to make vertical space
 * 
 * @param parent
 *            the parent composite to add this spacer to
 * @param numlines
 *            the number of vertical lines to make as space
 */
public static void createVerticalSpacer(Composite parent, int numlines) {
    Label lbl = new Label(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    Layout layout = parent.getLayout();
    if (layout instanceof GridLayout) {
        gd.horizontalSpan = ((GridLayout) parent.getLayout()).numColumns;
    }
    gd.heightHint = numlines;
    lbl.setLayoutData(gd);
}
项目:google-cloud-eclipse    文件:LabeledTextMapComponent.java   
private void init() {
  composite = toolkit.createComposite(parent, SWT.NULL);
  Layout layout = new GridLayout(3, false);
  composite.setLayout(layout);
  composite.setLayoutData(gridData);
  texts.clear();
  parent.layout();
}
项目:http4e    文件:ItemView.java   
/**
 * GUI's
 */
private Control getItemControl( CTabFolder folder){
   Layout layout = new GridLayout();
   ((GridLayout) layout).numColumns = 1;

   Composite itemComposite = new Composite(folder, SWT.NULL);
   itemComposite.setLayout(layout);

   buildTopControl(itemComposite);
   buildBottomControl(itemComposite);

   return itemComposite;
}
项目:lider-ahenk-installer    文件:GUIHelper.java   
/**
 * 
 * @param parent
 * @param layout
 * @param layoutData
 * @return
 */
public static Composite createComposite(Composite parent, Layout layout, Object layoutData) {
    Composite c = new Composite(parent, SWT.NONE);
    c.setLayoutData(layoutData);
    c.setLayout(layout);
    c.setBackground(getApplicationBackground());
    return c;
}
项目:lider-ahenk-installer    文件:GUIHelper.java   
/**
 * 
 * @param parent
 * @param layout
 * @param layoutData
 * @return
 */
public static Group createGroup(Composite parent, Layout layout, Object layoutData) {
    Group g = new Group(parent, SWT.NONE);
    g.setLayoutData(layoutData);
    g.setLayout(layout);
    g.setBackground(getApplicationBackground());
    return g;
}
项目:turnus    文件:WidgetSelectFileList.java   
@Override
protected void createWidgets(String text, String toolTip, List<String> initialValue) {
    Layout layout = new GridLayout(1, false);
    GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
    composite = new Composite(this, SWT.SHADOW_NONE);
    composite.setLayout(layout);
    composite.setLayoutData(data);
}
项目:Kura-MQTT-Client-Utility    文件:GridLayoutUtil.java   
public static GridLayoutUtil onGridLayout(Composite composite) {
    final Layout layout = composite.getLayout();
    if (layout instanceof GridLayout) {
        return new GridLayoutUtil((GridLayout) layout);
    }
    throw new IllegalStateException(
            "Composite has to have a GridLayout. Has " + layout);
}
项目:tlaplus    文件:SWTFactory.java   
/**
 * Creates a vertical spacer for separating components. If applied to a 
 * <code>GridLayout</code>, this method will automatically span all of the columns of the parent
 * to make vertical space
 * 
 * @param parent the parent composite to add this spacer to
 * @param numlines the number of vertical lines to make as space
 */
public static void createVerticalSpacer(Composite parent, int numlines) {
    Label lbl = new Label(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    Layout layout = parent.getLayout();
    if(layout instanceof GridLayout) {
        gd.horizontalSpan = ((GridLayout)parent.getLayout()).numColumns;
    }
    gd.heightHint = numlines;
    lbl.setLayoutData(gd);
}
项目:swtbrowser    文件:HTMLBrowser.java   
/**
 * Returns the root layout
 * @param scroller
 * @return
 */
private Layout getRootLayout(ScrolledComposite scroller) {
    int offset = scroller.getVerticalBar().getSize().x;
    offset = offset == 0 ? 30 : offset;
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 2;
    layout.marginHeight = 2;
    layout.marginTop = 2;
    layout.marginBottom = 2;
    layout.marginLeft = 2;
    layout.marginRight = 2 + offset;
    return layout;
}
项目:depan    文件:FieldEditor.java   
/**
 * @param parent parent Container.
 * @param style SWT style for the container.
 * @param swtTextStyle SWT style for textboxes. Useful to set them
 *        SWT.READ_ONLY for instance.
 */
public FieldEditor(Composite parent, Integer style, Integer swtTextStyle) {
  super(parent, style, swtTextStyle);
  // widgets
  icon = new Label(this, SWT.NONE);
  name = new Text(this, swtTextStyle);
  Label labelType = new Label(this, SWT.NONE);
  type = new TypeEditor(this, SWT.NONE, swtTextStyle);
  Label labelContainer = new Label(this, SWT.NONE);
  container = new TypeEditor(this, SWT.NONE, swtTextStyle);

  // layout
  Layout layout = new GridLayout(2, false);
  this.setLayout(layout);

  GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
  iconGridData.minimumHeight = 16;
  iconGridData.minimumWidth = 16;
  icon.setLayoutData(iconGridData);
  name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
  labelType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
  type.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
  labelContainer.setLayoutData(
      new GridData(SWT.FILL, SWT.CENTER, false, false));
  container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

  // content
  icon.setImage(JavaActivator.IMAGE_FIELD);
  labelType.setText("Type");
  labelContainer.setText("Container");
}
项目:depan    文件:MethodEditor.java   
public MethodEditor(Composite parent, Integer style, Integer swtTextStyle) {
  super(parent, style, swtTextStyle);
  icon = new Label(this, SWT.NONE);
  name = new Text(this, swtTextStyle);
  Label labelSignature = new Label(this, SWT.NONE);
  signature = new Text(this, swtTextStyle);
  Label labelContainer = new Label(this, SWT.NONE);
  container = new TypeEditor(this, SWT.NONE, swtTextStyle);

  Layout layout = new GridLayout(2, false);
  this.setLayout(layout);

  GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
  iconGridData.minimumHeight = 16;
  iconGridData.minimumWidth = 16;
  icon.setLayoutData(iconGridData);
  name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
  labelSignature.setLayoutData(
      new GridData(SWT.FILL, SWT.CENTER, false, false));
  signature.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
  labelContainer.setLayoutData(
      new GridData(SWT.FILL, SWT.CENTER, false, false));
  container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

  icon.setImage(JavaActivator.IMAGE_METHOD);
  labelSignature.setText("Signature");
  labelContainer.setText("Class");
}
项目:PerformanceHat    文件:ControlFactoryImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Composite createComposite(final Composite parent, final Layout layout) {
  final Composite composite = new Composite(parent, SWT.NONE);
  composite.setLayout(layout);
  return composite;
}
项目:PerformanceHat    文件:ControlFactoryImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public Composite createComposite(final Composite parent, final Layout layout, final Object layoutData) {
  final Composite composite = createComposite(parent, layout);
  composite.setLayoutData(layoutData);
  return composite;
}
项目:limpet    文件:StackedPane.java   
@Override
public void setLayout(Layout layout)
{
  if (!(layout instanceof StackLayout))
  {
    throw new IllegalArgumentException("Only support StackLayout");
  }
  super.setLayout(layout);
}
项目:vTM-eclipse    文件:SWTUtil.java   
/**
 * Removes the margins of the passed in GridLayout.
 * @param layout The layout to remove the margins of.
 * @return The passed in GridLayout
 */
public static Layout removeLayoutMargins( Layout layout ) 
{
   if( layout instanceof GridLayout ) {    
      GridLayout gridLayout = (GridLayout) layout;
      gridLayout.marginBottom = 0;
      gridLayout.marginHeight = 0;
      gridLayout.marginLeft = 0;
      gridLayout.marginRight = 0;
      gridLayout.marginTop = 0;
      gridLayout.marginWidth = 0;
   }
   return layout;
}
项目:durian-swt    文件:Layouts.java   
/** Checks that the layout of the composite has the proper class, then returns the cast layout. */
@SuppressWarnings("unchecked")
private static <T extends Layout> T getLayout(Composite composite, Class<T> clazz) {
    Layout layout = composite.getLayout();
    if (layout == null || !clazz.isAssignableFrom(layout.getClass())) {
        throw new IllegalArgumentException("Expected parent to have layout " + clazz.getName() + ", but was " + layout + ".");
    }
    return (T) layout;
}
项目:jo-widgets    文件:PatchedComposite.java   
private Point patchedComputeSizeImpl(final int wHint, final int hHint, boolean changed)
        throws IllegalAccessException, InvocationTargetException {
    checkWidget();
    runSkinMethod.invoke(getDisplay());
    final Point size;
    final Layout layout = getLayout();
    if (layout != null) {
        int state = stateField.getInt(this);
        if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
            changed |= (state & LAYOUT_CHANGED) != 0;
            state &= ~LAYOUT_CHANGED;
            stateField.setInt(this, state);
            size = (Point) computeSizeMethod.invoke(layout, this, wHint, hHint, changed);
        }
        else {
            size = new Point(wHint, hHint);
        }
    }
    else {
        size = (Point) minimumSizeMethod.invoke(this, wHint, hHint, changed);
        if (size.x == 0) {
            size.x = DEFAULT_WIDTH; // Do this only when layout is null
        }
        if (size.y == 0) {
            size.y = DEFAULT_HEIGHT;
        }
    }
    if (wHint != SWT.DEFAULT) {
        size.x = wHint;
    }
    if (hHint != SWT.DEFAULT) {
        size.y = hHint;
    }
    final Rectangle trim = computeTrim(0, 0, size.x, size.y);
    return new Point(trim.width, trim.height);
}
项目:jo-widgets    文件:WorkbenchApplicationTree.java   
@Override
public void setLayout(final Layout layout) {
    // prevent setting layout when wrapped by jo-widgets
    // TODO MG check widget wrapping with already set layout
    if (layout instanceof FillLayout) {
        super.setLayout(layout);
    }
}