Java Code Examples for org.eclipse.swt.widgets.Composite#getClientArea()

The following examples show how to use org.eclipse.swt.widgets.Composite#getClientArea() . 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: GanttHeaderSpacedLayout.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected void layout(final Composite composite, final boolean flushCache) {
    if (flushCache || !_calculated) {
        recalculate(composite);
    }

    final Control[] children = composite.getChildren();

    final Rectangle bounds = composite.getClientArea();

    int y = _ganttHeaderSize;
    for (int i = 0; i < children.length; i++) {
        final Control child = children[i];
        final Point wantedSize = child.computeSize(SWT.DEFAULT, SWT.DEFAULT);

        child.setLocation(0, y);
        child.setSize(bounds.width, bounds.height - y);
        y += wantedSize.y;
    }

}
 
Example 2
Source File: StyleChartViewer.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void paintControl( PaintEvent e )
{
	idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, e.gc );
	Composite co = (Composite) e.getSource( );
	Rectangle re = co.getClientArea( );
	Bounds bo = BoundsImpl.create( 0, 0, re.width, re.height );
	bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
	
	Generator gr = Generator.instance( );
	try
	{
		gr.render( idr, gr.build( idr.getDisplayServer( ),
				cm,
				bo,
				null,
				null,
				StyleProcessor.instance( ) ) );
	}
	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}
}
 
Example 3
Source File: DialogCellEditor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void layout(Composite editor, boolean force) {
	Rectangle bounds = editor.getClientArea();
	Point size = hyperlink.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
	if (contents != null) {
		contents.setBounds(0, 0, bounds.width - size.x, bounds.height);
	}
	hyperlink
			.setBounds(bounds.width - size.x, 0, size.x, bounds.height);
}
 
Example 4
Source File: CTreeLayout.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
protected void layout(Composite composite, boolean flushCache) {
	Rectangle area = composite.getClientArea();
	if(area.isEmpty()) return;
	
	if(flushCache) computeSize(composite, -1, -1, flushCache);

	ctree.getHeader().setBounds(
			area.x,
			area.y,
			area.width,
			headerSize.y
		);

	Point origin = ctree.getScrollPosition();
	int height = area.height-headerSize.y;
	ctree.body.setBounds(
			area.x-origin.x,
			area.y+headerSize.y-origin.y,
			(gtk ? Math.max(area.width, headerSize.x) : area.width),
			(gtk ? Math.max(height, contentHeight) : height)
		);
	
	layoutHeader();
	
	layoutContent();
	
	updateScrollBars();
}
 
Example 5
Source File: PromptOverlay.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void layout(Composite composite, boolean flushCache) {
    if (styledText != null && !styledText.isDisposed()) {
        Rectangle bounds = composite.getClientArea();

        int height = bounds.height;
        int perc = (int) (height * percSize); // 30% to the input

        interactiveConsoleTextWidget.setBounds(bounds.x, bounds.y + height - perc, bounds.width,
                perc);
        styledText.setBounds(bounds.x, bounds.y, bounds.width, height - perc);
    }
}
 
Example 6
Source File: FileComboBoxCellEditor.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void layout(Composite editor, boolean force) {
	Rectangle bounds = editor.getClientArea();
	Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
	if (contents != null) {
		contents.setBounds(0, 0, bounds.width - size.x, bounds.height);
	}
	button.setBounds(bounds.width - size.x, 0, size.x, bounds.height);
}
 
Example 7
Source File: ExpressionCellEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void layout( Composite editor, boolean force )
{
	Rectangle bounds = editor.getClientArea( );
	Point size = button.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
	if ( contents != null )
	{
		contents.setBounds( 0, 0, bounds.width - size.x, bounds.height );
	}
	button.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
 
Example 8
Source File: CGridLayout.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void layout( Composite composite, boolean flushCache )
{
	Rectangle rect = composite.getClientArea( );
	layout( composite,
			true,
			rect.x,
			rect.y,
			rect.width,
			rect.height,
			flushCache );
}
 
Example 9
Source File: ExpressionValueCellEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void layout( Composite editor, boolean force )
{
	Rectangle bounds = editor.getClientArea( );
	Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
	expressionText.setBounds( 0,
			0,
			bounds.width - size.x,
			bounds.height );
	btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
 
Example 10
Source File: ExpressionValue.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void layout( Composite editor, boolean force )
{
	Rectangle bounds = editor.getClientArea( );
	Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
	valueText.setBounds( 0, 0, bounds.width - size.x, bounds.height );
	btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
 
Example 11
Source File: ExpressionValueCellEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void layout( Composite editor, boolean force )
{
	Rectangle bounds = editor.getClientArea( );
	Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
	expressionText.setBounds( 0,
			0,
			bounds.width - size.x,
			bounds.height );
	btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
 
Example 12
Source File: AutoDataBindingViewer.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void paintControl( PaintEvent e )
{
	idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, e.gc );
	Composite co = (Composite) e.getSource( );
	Rectangle re = co.getClientArea( );
	Bounds bo = BoundsImpl.create( 0, 0, re.width, re.height );
	bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
	
	RunTimeContext context = new RunTimeContext( );
	context.setULocale( ULocale.getDefault( ) );
	
	String[] set = {
			"Items", "Amounts"};//$NON-NLS-1$ //$NON-NLS-2$
	Object[][] data = {
			{
					"A", "B", "C"//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			}, {
					Integer.valueOf( 7 ), Integer.valueOf( 2 ), Integer.valueOf( 5 )
			}
	};
	dree = new SimpleDataRowExpressionEvaluator( set, data );
	Generator gr = Generator.instance( );
	try
	{
		gr.bindData( dree, cm, context );
		gr.render( idr, gr.build( idr.getDisplayServer( ),
				cm,
				bo,
				null,
				context,
				null ) );
	}
	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}
}
 
Example 13
Source File: ExpressionValueCellEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void layout( Composite editor, boolean force )
{
	Rectangle bounds = editor.getClientArea( );
	Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
	expressionText.setBounds( 0,
			0,
			bounds.width - size.x,
			bounds.height );
	btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
 
Example 14
Source File: TSWizardDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the client area for the given composite according to this
 * layout.
 * 
 * @param c
 *            the composite
 * @return the client area rectangle
 */
public Rectangle getClientArea(Composite c) {
	Rectangle rect = c.getClientArea();
	rect.x = rect.x + marginWidth;
	rect.y = rect.y + marginHeight;
	rect.width = rect.width - 2 * marginWidth;
	rect.height = rect.height - 2 * marginHeight;
	return rect;
}
 
Example 15
Source File: TSWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the client area for the given composite according to this
 * layout.
 * 
 * @param c
 *            the composite
 * @return the client area rectangle
 */
public Rectangle getClientArea(Composite c) {
	Rectangle rect = c.getClientArea();
	rect.x = rect.x + marginWidth;
	rect.y = rect.y + marginHeight;
	rect.width = rect.width - 2 * marginWidth;
	rect.height = rect.height - 2 * marginHeight;
	return rect;
}
 
Example 16
Source File: ModifyDialogTabPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void layout(Composite composite, boolean force) {
	Rectangle rect = composite.getClientArea();
	Control[] children = composite.getChildren();
	for (int i = 0; i < children.length; i++) {
		children[i].setSize(rect.width, rect.height);
	}
}
 
Example 17
Source File: FormatterModifyTabPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void layout(Composite composite, boolean force)
{
	Rectangle rect = composite.getClientArea();
	Control[] children = composite.getChildren();
	for (int i = 0; i < children.length; i++)
	{
		children[i].setSize(rect.width, rect.height);
	}
}
 
Example 18
Source File: TabLineWrapping.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void layout(Composite composite, boolean force) {
    Rectangle rect = composite.getClientArea();
    Control[] children = composite.getChildren();
    for (int i = 0; i < children.length; i++) {
        children[i].setSize(rect.width, rect.height);
    }
}
 
Example 19
Source File: TabPageIndentation.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void layout(Composite composite, boolean force) {
    Rectangle rect = composite.getClientArea();
    Control[] children = composite.getChildren();
    for (int i = 0; i < children.length; i++) {
        children[i].setSize(rect.width, rect.height);
    }
}
 
Example 20
Source File: CopyrightTabPage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void layout(final Composite composite, final boolean force) {
	final Rectangle rect = composite.getClientArea();
	final Control[] children = composite.getChildren();
	for (final Control child : children) {
		child.setSize(rect.width, rect.height);
	}
}