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);
}
java类org.eclipse.swt.widgets.Layout的实例源码
SizeConstrainedComposite.java 文件源码
项目:team-explorer-everywhere
阅读 29
收藏 0
点赞 0
评论 0
DeployPropertyPageTest.java 文件源码
项目:google-cloud-eclipse
阅读 26
收藏 0
点赞 0
评论 0
@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");
}
ArtifactEditor.java 文件源码
项目:depan
阅读 32
收藏 0
点赞 0
评论 0
/**
* 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");
}
PropertyEditor.java 文件源码
项目:depan
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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");
}
DirectoryEditor.java 文件源码
项目:depan
阅读 35
收藏 0
点赞 0
评论 0
/**
* 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");
}
SWTUtil.java 文件源码
项目:vTM-eclipse
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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;
}
PatchedCompositeReflectionAccessor.java 文件源码
项目:jo-widgets
阅读 26
收藏 0
点赞 0
评论 0
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);
}
LayoutWrapper.java 文件源码
项目:jo-widgets
阅读 37
收藏 0
点赞 0
评论 0
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);
}
}
ProgressPage.java 文件源码
项目:p2-installer
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
}
};
}
JDBCSelectionPageHelper.java 文件源码
项目:birt
阅读 36
收藏 0
点赞 0
评论 0
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 );
}
TreeSelectionDialog.java 文件源码
项目:Pydev
阅读 39
收藏 0
点赞 0
评论 0
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);
}
}
}
BaseSourceViewer.java 文件源码
项目:Pydev
阅读 32
收藏 0
点赞 0
评论 0
@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);
}
};
}
View.java 文件源码
项目:cogtool
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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);
}
GeodashboardSelectionPageHelper.java 文件源码
项目:geoprism
阅读 38
收藏 0
点赞 0
评论 0
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);
}
DataModelFormPage.java 文件源码
项目:eZooKeeper
阅读 28
收藏 0
点赞 0
评论 0
protected Layout createClientLayout() {
FormLayout clientLayout = new FormLayout();
clientLayout.marginWidth = 8;
clientLayout.marginHeight = 8;
clientLayout.spacing = 8;
return clientLayout;
}
ZooKeeperConnectionModelMainFormPage.java 文件源码
项目:eZooKeeper
阅读 36
收藏 0
点赞 0
评论 0
@Override
protected Layout createClientLayout() {
GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 20;
gridLayout.marginWidth = 8;
return gridLayout;
}
BaseZnodeModelDataEditor.java 文件源码
项目:eZooKeeper
阅读 26
收藏 0
点赞 0
评论 0
protected Layout createLayout() {
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = 8;
formLayout.marginWidth = 8;
formLayout.spacing = 8;
return formLayout;
}
ZnodeModelDataFormPage.java 文件源码
项目:eZooKeeper
阅读 29
收藏 0
点赞 0
评论 0
@Override
protected Layout createClientLayout() {
FormLayout clientLayout = (FormLayout) super.createClientLayout();
clientLayout.spacing = 10;
clientLayout.marginBottom = 10;
return clientLayout;
}
JmxConnectionModelMainFormPage.java 文件源码
项目:eZooKeeper
阅读 29
收藏 0
点赞 0
评论 0
@Override
protected Layout createClientLayout() {
GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 20;
gridLayout.marginWidth = 8;
return gridLayout;
}
BaseJmxModelMainFormPage.java 文件源码
项目:eZooKeeper
阅读 33
收藏 0
点赞 0
评论 0
@Override
protected Layout createClientLayout() {
GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 20;
gridLayout.marginWidth = 8;
return gridLayout;
}
SingleVisualInterfaceViewPart.java 文件源码
项目:neoscada
阅读 29
收藏 0
点赞 0
评论 0
private Layout createExtensionGridLayout ()
{
final GridLayout gridLayout = new GridLayout ( 1, false );
gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = gridLayout.marginWidth = 0;
return gridLayout;
}
AttributeControlConfigurations.java 文件源码
项目:avro-schema-editor
阅读 31
收藏 0
点赞 0
评论 0
public Layout getMainLayout() {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 10;
layout.marginWidth = 10;
layout.verticalSpacing = 10;
layout.horizontalSpacing = 10;
return layout;
}
SWTFactory.java 文件源码
项目:egradle
阅读 29
收藏 0
点赞 0
评论 0
/**
* 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);
}
LabeledTextMapComponent.java 文件源码
项目:google-cloud-eclipse
阅读 25
收藏 0
点赞 0
评论 0
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();
}
ItemView.java 文件源码
项目:http4e
阅读 32
收藏 0
点赞 0
评论 0
/**
* 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;
}
GUIHelper.java 文件源码
项目:lider-ahenk-installer
阅读 37
收藏 0
点赞 0
评论 0
/**
*
* @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;
}
GUIHelper.java 文件源码
项目:lider-ahenk-installer
阅读 36
收藏 0
点赞 0
评论 0
/**
*
* @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;
}
WidgetSelectFileList.java 文件源码
项目:turnus
阅读 38
收藏 0
点赞 0
评论 0
@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);
}
GridLayoutUtil.java 文件源码
项目:Kura-MQTT-Client-Utility
阅读 34
收藏 0
点赞 0
评论 0
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);
}
SWTFactory.java 文件源码
项目:tlaplus
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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);
}