org.eclipse.swt.widgets.Layout Java Examples
The following examples show how to use
org.eclipse.swt.widgets.Layout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainModelPage.java From tlaplus with MIT License | 6 votes |
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; } } }
Example #2
Source File: BaseSourceViewer.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@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); } }; }
Example #3
Source File: TreeSelectionDialog.java From Pydev with Eclipse Public License 1.0 | 6 votes |
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); } } }
Example #4
Source File: ArtifactEditor.java From depan with Apache License 2.0 | 6 votes |
/** * 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"); }
Example #5
Source File: ScrollClientComposite.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * 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; }
Example #6
Source File: XFindPreferencePage.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
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); }
Example #7
Source File: FirefoxAttachTab.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@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); } } }
Example #8
Source File: SWTFactory.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
/** * 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); }
Example #9
Source File: PropertyEditor.java From depan with Apache License 2.0 | 6 votes |
/** * 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"); }
Example #10
Source File: ComponentTitledFolder.java From arx with Apache License 2.0 | 5 votes |
/** * 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; }
Example #11
Source File: SingleVisualInterfaceViewPart.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private Layout createExtensionGridLayout () { final GridLayout gridLayout = new GridLayout ( 1, false ); gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0; gridLayout.marginHeight = gridLayout.marginWidth = 0; return gridLayout; }
Example #12
Source File: LabeledTextMapComponent.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
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(); }
Example #13
Source File: SWTFactory.java From tlaplus with MIT License | 5 votes |
/** * 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); }
Example #14
Source File: ItemView.java From http4e with Apache License 2.0 | 5 votes |
/** * 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; }
Example #15
Source File: TimeGraphLegend.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
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; }
Example #16
Source File: FieldEditor.java From depan with Apache License 2.0 | 5 votes |
/** * @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"); }
Example #17
Source File: MethodEditor.java From depan with Apache License 2.0 | 5 votes |
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"); }
Example #18
Source File: AnnotationExpansionControl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example #19
Source File: AnnotationExpansionControl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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(); } }
Example #20
Source File: UIUtil.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * 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; }
Example #21
Source File: DataComponentComposite.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * 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; }
Example #22
Source File: ParameterWizard.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public void setLayout(Layout layout) { if (!(layout instanceof StackLayout)) throw new UnsupportedOperationException( "Only supported for StackLayout"); super.setLayout(layout); }
Example #23
Source File: PromptOverlay.java From Pydev with Eclipse Public License 1.0 | 5 votes |
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; } }
Example #24
Source File: SWTFactory.java From goclipse with Eclipse Public License 1.0 | 5 votes |
/** * 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); }
Example #25
Source File: LaneSection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Layout getLayout() { final GridLayout layout = new GridLayout(3, false); layout.verticalSpacing = 10; layout.horizontalSpacing = 10; return layout; }
Example #26
Source File: DiagramSection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Layout getLayout() { final GridLayout layout = new GridLayout(2, false); layout.verticalSpacing = 0; layout.horizontalSpacing = 10; return layout; }
Example #27
Source File: ResizableGridRowLayout.java From nebula with Eclipse Public License 2.0 | 5 votes |
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; } } } }
Example #28
Source File: ListExplanationComposite.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void setLayout(Layout layout) { // this composite controls its layout itself }
Example #29
Source File: ProjectOptionComposite.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void setLayout(Layout layout) { // NOP }
Example #30
Source File: SimpleRoundedComposite.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void setLayout(Layout layout) { // this composite controls its layout itself }