当前位置: 首页>>代码示例>>Java>>正文


Java Layout类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Layout的典型用法代码示例。如果您正苦于以下问题:Java Layout类的具体用法?Java Layout怎么用?Java Layout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Layout类属于org.eclipse.swt.widgets包,在下文中一共展示了Layout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLayoutMargin

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
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);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:19,代码来源:SizeConstrainedComposite.java

示例2: testCorrectPanelIsShownForFacetedProject

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
@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");
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:22,代码来源:DeployPropertyPageTest.java

示例3: ArtifactEditor

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
/**
 * 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");
}
 
开发者ID:google,项目名称:depan,代码行数:33,代码来源:ArtifactEditor.java

示例4: PropertyEditor

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
/**
 * 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");
}
 
开发者ID:google,项目名称:depan,代码行数:33,代码来源:PropertyEditor.java

示例5: DirectoryEditor

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
/**
 * 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");
}
 
开发者ID:google,项目名称:depan,代码行数:33,代码来源:DirectoryEditor.java

示例6: makeLayoutTight

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:22,代码来源:SWTUtil.java

示例7: PatchedCompositeReflectionAccessor

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
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);
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:19,代码来源:PatchedCompositeReflectionAccessor.java

示例8: LayoutWrapper

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
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);
    }
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:23,代码来源:LayoutWrapper.java

示例9: InstallProgressMonitorPart

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
/**
 * 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);
				}
        	}
        }
    };
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:23,代码来源:ProgressPage.java

示例10: createPropertiesComposite

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
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 );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:22,代码来源:JDBCSelectionPageHelper.java

示例11: updateCompositeLayout

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:TreeSelectionDialog.java

示例12: createLayout

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
@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);
        }
    };
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:BaseSourceViewer.java

示例13: createShell

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:cogtool,项目名称:cogtool,代码行数:33,代码来源:View.java

示例14: createPropertiesComposite

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
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);
}
 
开发者ID:terraframe,项目名称:geoprism,代码行数:23,代码来源:GeodashboardSelectionPageHelper.java

示例15: createClientLayout

import org.eclipse.swt.widgets.Layout; //导入依赖的package包/类
protected Layout createClientLayout() {
    FormLayout clientLayout = new FormLayout();
    clientLayout.marginWidth = 8;
    clientLayout.marginHeight = 8;
    clientLayout.spacing = 8;
    return clientLayout;
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:8,代码来源:DataModelFormPage.java


注:本文中的org.eclipse.swt.widgets.Layout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。