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

下面列出了怎么用org.eclipse.swt.widgets.Layout的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: wildwebdeveloper   文件: FirefoxAttachTab.java
@Override
public void createControl(Composite parent) {
	super.createControl(parent);
	Control control = getControl();
	if (control instanceof Composite) {
		Composite composite = (Composite)control;
		Link label = new Link(composite, SWT.WRAP);
		label.setText(Messages.firefoxAttachNote);
		Layout layout = composite.getLayout();
		if (layout instanceof GridLayout) {
			GridLayout gridLayout = (GridLayout)layout;
			GridDataFactory.swtDefaults()
				.align(SWT.BEGINNING, SWT.TOP)
				.grab(true, false)
				.indent(0, 10)
				.span(gridLayout.numColumns, 1)
				.applyTo(label);
		}
	}
}
 
源代码2 项目: xds-ide   文件: 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 xLines - space height (in standard font height units)
 */
public static void createVerticalSpacer(Composite parent, double xLines) {
	Label lbl = new Label(parent, SWT.NONE);
	
    GC gc = new GC(parent);
    int cyLine;
    try {
    	cyLine = gc.textExtent("Wq").y; //$NON-NLS-1$
	} finally {
		gc.dispose();
	}
    int cy = (int)((double)cyLine * xLines);
	
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	Layout layout = parent.getLayout();
	if(layout instanceof GridLayout) {
		gd.horizontalSpan = ((GridLayout)parent.getLayout()).numColumns;
	}
	gd.heightHint = cy;
	lbl.setLayoutData(gd);
}
 
源代码3 项目: xds-ide   文件: XFindPreferencePage.java
public static void createVerticalSpacer(Composite parent, double xLines) {
    Label lbl = new Label(parent, SWT.NONE);
    
    GC gc = new GC(parent);
    int cyLine;
    try{
    	cyLine = gc.textExtent("Wq").y; //$NON-NLS-1$
    }
    finally{
    	gc.dispose();
    }
    int cy = (int)((double)cyLine * xLines);
    
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    Layout layout = parent.getLayout();
    if(layout instanceof GridLayout) {
        gd.horizontalSpan = ((GridLayout)parent.getLayout()).numColumns;
    }
    gd.heightHint = cy;
    lbl.setLayoutData(gd);
}
 
源代码4 项目: tlaplus   文件: MainModelPage.java
private void installTopMargin(final Composite body) {
	Composite c = body;
	CTabFolder tabFolder = (c instanceof CTabFolder) ? (CTabFolder) c : null;

	while ((tabFolder == null) && (c.getParent() != null)) {
		c = c.getParent();
		tabFolder = (c instanceof CTabFolder) ? (CTabFolder) c : null;
	}

	if (tabFolder != null) {
		final Layout l = tabFolder.getParent().getLayout();
		if (l instanceof FillLayout) {
			final FillLayout fl = (FillLayout) l;
			fl.marginHeight = 6;
		}
	}
}
 
源代码5 项目: 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");
}
 
源代码6 项目: 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");
}
 
源代码7 项目: ice   文件: ScrollClientComposite.java
/**
 * Recomputes the pads based on the layouts between this {@code Composite}
 * and the {@link #scrolledAncestor}.
 */
private void recomputePads() {
	totalPadLeft = 0;
	totalPadRight = 0;

	PadFinder padFinder = new PadFinder();

	Composite parent = getParent();
	while (parent != null && parent != scrolledAncestor) {

		Layout layout = parent.getLayout();
		totalPadLeft += padFinder.computeLeftPad(layout);
		totalPadRight += padFinder.computeLeftPad(layout);

		parent = parent.getParent();
	}

	return;
}
 
源代码8 项目: 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);
        }
    }
}
 
源代码9 项目: 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);
        }
    };
}
 
源代码10 项目: nebula   文件: ResizableGridRowLayout.java
private void findHeader(Composite row) {
    Control[] children = row.getParent().getChildren();
    for (int i = 0; i < children.length; i++) {
        if (children[i] instanceof Composite) {
            Composite child = (Composite) children[i];
            Layout layout = child.getLayout();
            
            if (layout instanceof HeaderLayout) {
                delegate = (HeaderLayout) layout;
                addListenersToDelegate(row, (HeaderLayout) layout);
                return;
            }
        }
    }
}
 
源代码11 项目: 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;
}
 
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();
}
 
源代码13 项目: 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;
}
 
源代码14 项目: 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);
}
 
源代码15 项目: tracecompass   文件: TimeGraphLegend.java
private static List<GridLayout> getGridLayouts(Composite innerComposite) {
    List<GridLayout> gridLayouts = new ArrayList<>();
    if (innerComposite == null) {
        return gridLayouts;
    }
    Arrays.asList(innerComposite.getChildren()).forEach(control -> {
        if (control instanceof Composite) {
            Layout layout = ((Composite) control).getLayout();
            if (layout instanceof GridLayout) {
                gridLayouts.add((GridLayout) layout);
            }
        }
    });
    return gridLayouts;
}
 
源代码16 项目: 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");
}
 
源代码17 项目: 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");
}
 
public Layout getLayout(int itemCount) {
	// simple layout: a row of items
	GridLayout layout= new GridLayout(itemCount, true);
	layout.horizontalSpacing= 1;
	layout.verticalSpacing= 0;
	layout.marginHeight= 1;
	layout.marginWidth= 1;
	return layout;
}
 
protected void refresh() {
	adjustItemNumber();

	if (fInput == null)
		return;

	if (fInput.fAnnotations == null)
		return;

	if (fInput.fViewer != null)
		fInput.fViewer.addViewportListener(fViewportListener);

	fShell.setRegion(fLayouter.getShellRegion(fInput.fAnnotations.length));

	Layout layout= fLayouter.getLayout(fInput.fAnnotations.length);
	fComposite.setLayout(layout);

	Control[] children= fComposite.getChildren();
	for (int i= 0; i < fInput.fAnnotations.length; i++) {
		Canvas canvas= (Canvas) children[i];
		Item item= new Item();
		item.canvas= canvas;
		item.fAnnotation= fInput.fAnnotations[i];
		canvas.setData(item);
		canvas.redraw();
	}

}
 
源代码20 项目: birt   文件: UIUtil.java
/**
 * Returns the height hint for the given control.
 * 
 * @param hHint
 *            the width hint
 * @param c
 *            the control
 * 
 * @return the height hint
 */
public static int getHeightHint( int hHint, Control c )
{
	if ( c instanceof Composite )
	{
		Layout layout = ( (Composite) c ).getLayout( );
		if ( layout instanceof ColumnLayout )
			return hHint;
	}
	return SWT.DEFAULT;
}
 
源代码21 项目: ice   文件: DataComponentComposite.java
/**
 * Overrides the default behavior to store a reference to the layout. This
 * is required for the following reason: when there are no Entries, a label
 * is displayed. A different layout is necessary to display the label by
 * itself.
 *
 * @param layout
 *            The new layout.
 */
@Override
public void setLayout(Layout layout) {
	super.setLayout(layout);

	// If the layout is not null, store a reference to it so we can revert
	// to it if new EntryComposites are added when the empty label is
	// displayed.
	if (layout != null) {
		this.layout = layout;
	}

	return;
}
 
源代码22 项目: olca-app   文件: ParameterWizard.java
@Override
public void setLayout(Layout layout) {
	if (!(layout instanceof StackLayout))
		throw new UnsupportedOperationException(
				"Only supported for StackLayout");
	super.setLayout(layout);
}
 
源代码23 项目: Pydev   文件: PromptOverlay.java
public CustomPageBookLayout(Layout originalParentLayout) {
    if (originalParentLayout instanceof CustomPageBookLayout) {
        //It's there by some other view of ours (switched directly between them).
        CustomPageBookLayout customPageBookLayout = (CustomPageBookLayout) originalParentLayout;
        this.originalParentLayout = customPageBookLayout.originalParentLayout;
    } else {
        this.originalParentLayout = originalParentLayout;
    }
}
 
源代码24 项目: goclipse   文件: 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
 * @since 3.3
 */
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);
}
 
源代码25 项目: bonita-studio   文件: LaneSection.java
@Override
   protected Layout getLayout() {
final GridLayout layout = new GridLayout(3, false);
layout.verticalSpacing = 10;
layout.horizontalSpacing = 10;
return layout;
   }
 
源代码26 项目: bonita-studio   文件: DiagramSection.java
@Override
   protected Layout getLayout() {
final GridLayout layout = new GridLayout(2, false);
layout.verticalSpacing = 0;
layout.horizontalSpacing = 10;
return layout;
   }
 
源代码27 项目: arx   文件: ComponentTitledFolder.java
/**
 * Creates a new entry in the folder.
 *  
 * @param title
 * @param image
 * @param index
 * @param hideable
 * @param layout
 * @return
 */
public Composite createItem(String title, Image image, int index, boolean hideable, Layout layout) {
    
    Composite composite = new Composite(folder, SWT.NONE);
    composite.setLayout(layout);
    
    CTabItem item = new CTabItem(folder, SWT.NULL, index);
    item.setText(title);
    if (image!=null) item.setImage(image);
    item.setShowClose(false);
    item.setControl(composite);
    entries.add(new TitledFolderEntry(title, composite, image, index, hideable));
    return composite;
}
 
源代码28 项目: nebula   文件: RadioGroup.java
/**
 * @see org.eclipse.swt.widgets.Composite#setLayout(org.eclipse.swt.widgets.Layout)
 */
@Override
public void setLayout(Layout layout) {
	checkWidget();
	return;
}
 
源代码29 项目: nebula   文件: CheckBoxGroup.java
/**
 * @see org.eclipse.swt.widgets.Composite#getLayout()
 */
@Override
public Layout getLayout() {
	return content.getLayout();
}
 
源代码30 项目: nebula   文件: CheckBoxGroup.java
/**
 * @see org.eclipse.swt.widgets.Composite#setLayout(org.eclipse.swt.widgets.Layout)
 */
@Override
public void setLayout(final Layout layout) {
	content.setLayout(layout);
}
 
 类所在包
 同包方法