Eclipse Platform
Release 3.6

org.eclipse.jface.layout
Class RowDataFactory

java.lang.Object
  extended by org.eclipse.jface.layout.RowDataFactory

public final class RowDataFactory
extends Object

This class provides a convenient shorthand for creating and initialising RowData. This offers several benefits over creating RowData the normal way:

Since:
3.5

Method Summary
 void applyTo(Control control)
          Sets the layout data on the given control.
 RowDataFactory copy()
          Creates a copy of the receiver.
static RowData copyData(RowData data)
          Returns a copy of the given RowData
 RowData create()
          Creates a new GridData instance.
static RowDataFactory createFrom(RowData data)
          Creates a new RowDataFactory that creates copies of the given RowData by default.
 RowDataFactory exclude(boolean shouldExclude)
          Instructs the GridLayout to ignore this control when performing layouts.
 RowDataFactory hint(int xHint, int yHint)
          Sets the width and height hints.
 RowDataFactory hint(Point hint)
          Sets the width and height hints.
static RowDataFactory swtDefaults()
          Creates a new RowDataFactory initialized with the SWT defaults.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

swtDefaults

public static RowDataFactory swtDefaults()
Creates a new RowDataFactory initialized with the SWT defaults.

Initial values are:

Returns:
a new GridDataFactory instance

createFrom

public static RowDataFactory createFrom(RowData data)
Creates a new RowDataFactory that creates copies of the given RowData by default.

Parameters:
data - RowData to copy
Returns:
a new RowDataFactory that creates copies of the argument by default

copyData

public static RowData copyData(RowData data)
Returns a copy of the given RowData

Parameters:
data - RowData to copy
Returns:
a copy of the argument

exclude

public RowDataFactory exclude(boolean shouldExclude)
Instructs the GridLayout to ignore this control when performing layouts.

Parameters:
shouldExclude - true iff the control should be excluded from layouts
Returns:
this

create

public RowData create()
Creates a new GridData instance. All attributes of the GridData instance will be initialised by the factory.

Returns:
a new GridData instance

copy

public RowDataFactory copy()
Creates a copy of the receiver.

Returns:
a copy of the receiver

applyTo

public void applyTo(Control control)
Sets the layout data on the given control. Creates a new RowData instance and assigns it to the control by calling control.setLayoutData.

Parameters:
control - control whose layout data will be initialised

hint

public RowDataFactory hint(int xHint,
                           int yHint)
Sets the width and height hints. The width and height hints override the control's preferred size. If either hint is set to SWT.DEFAULT, the control's preferred size is used.

Parameters:
xHint - horizontal hint (pixels), or SWT.DEFAULT to use the control's preferred size
yHint - vertical hint (pixels), or SWT.DEFAULT to use the control's preferred size
Returns:
this

hint

public RowDataFactory hint(Point hint)
Sets the width and height hints. The width and height hints override the control's preferred size. If either hint is set to SWT.DEFAULT, the control's preferred size is used.

Parameters:
hint - size (pixels) to be used instead of the control's preferred size. If the x or y values are set to SWT.DEFAULT, the control's computeSize() method will be used to obtain that dimension of the preferred size.
Returns:
this

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.