| org.eclipse.ui.internal.layout.TrimLayout
TrimLayout | public class TrimLayout extends Layout implements ICachingLayout,ITrimManager(Code) | | Lays out the children of a Composite. One control occupies the center of the
composite, and any number of controls may be attached to the top, bottom, and
sides. This is a common layout for application windows, which typically have
a central work area and a number of small widgets (toolbars, status lines,
etc.) attached to the edge.
Unlike most other SWT layouts, this layout does not require layout data to be
attached to each child control. Instead, member functions on the Layout are
used to control the positioning of controls within the layout.
The interface to this layout is intended to easily support drag-and-drop.
Trim widgets can be added, removed, or inserted between other existing
widgets and the layout will adjust accordingly. If one side of the layout
contains no trim widgets, the central area will expand to reclaim the unused
space.
This layout must be told about every widget that it is supposed to arrange.
If the composite contains additional widgets, they will not be moved by the
layout and may be arranged through other means.
since: 3.0 |
Constructor Summary | |
public | TrimLayout() Creates a new (initially empty) trim layout. |
Method Summary | |
public void | addTrim(IWindowTrim control, int areaId) | public void | addTrim(IWindowTrim trim, int areaId, IWindowTrim beforeMe) Parameters: trim - new window trim to be added Parameters: areaId - the area ID Parameters: beforeMe - if null, the control will be inserted as the last trim widgeton this side of the layout. | public void | addTrim(int areaId, IWindowTrim trim) | public void | addTrim(int areaId, IWindowTrim trim, IWindowTrim beforeMe) | protected Point | computeSize(Composite composite, int wHint, int hHint, boolean flushCache) | public List | disableTrim(IWindowTrim ignoreMe) Disables the controls associated with visible trim elements. | public void | enableTrim(List disabledControls) Enables the controls in the list. | public void | flush(Control dirtyControl) | public void | forceLayout() | public List | getAllTrim() | public int[] | getAreaIds() | public List | getAreaTrim(int areaId) | public Control | getCenterControl() | public int | getPreferredArea(String trimId) | public IWindowTrim | getPreferredLocation(String trimId) | public IWindowTrim | getTrim(String id) | public TrimArea | getTrimArea(int areaId) | public int | getTrimAreaId(Control trimControl) Returns the location of the given trim control. | public Rectangle | getTrimRect(Composite window, int areaId) Return a trim area rectangle. | protected void | layout(Composite composite, boolean flushCache) | public void | removeTrim(IWindowTrim toRemove) | public void | setCenterControl(Control center) Sets the widget that will occupy the central area of the layout. | public void | setMargins(int marginWidth, int marginHeight) Sets the empty space around the outside of the layout. | public void | setPreferredLocations(int areaId, List preferredLocations) Remember the persisted locations for the trim. | public void | setSpacing(int left, int right, int top, int bottom) Sets the empty space surrounding the center area. | public void | setTrimSize(int areaId, int size) Sets the trimSize (pixels) for the given side of the layout. | public void | setTrimVisible(IWindowTrim trim, boolean visible) | public void | updateAreaTrim(int id, List trim, boolean removeExtra) |
BOTTOM_ID | final public static Integer BOTTOM_ID(Code) | | Trim area ID.
|
NONTRIM_ID | final public static Integer NONTRIM_ID(Code) | | Trim area ID.
|
TrimLayout | public TrimLayout()(Code) | | Creates a new (initially empty) trim layout.
|
addTrim | public void addTrim(IWindowTrim trim, int areaId, IWindowTrim beforeMe)(Code) | | Parameters: trim - new window trim to be added Parameters: areaId - the area ID Parameters: beforeMe - if null, the control will be inserted as the last trim widgeton this side of the layout. Otherwise, the control will beinserted before the given widget. See Also: TrimLayout.getAreaIds() |
computeSize | protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)(Code) | | |
disableTrim | public List disableTrim(IWindowTrim ignoreMe)(Code) | | Disables the controls associated with visible trim elements. This
is only used during long-running WorkbenchWindow operations to prevent users
from changing the environment while the operation (i.e. a long-running editor
'save') is in progress.
The expected life-cycle is to first call this this method to disable any visible
trim (and caching the elements that had to be disabled) followed by a call to
'enableTrim' passing in the list returned from this method.
Parameters: ignoreMe - Since the current UI has a disable button in the StatusLinewe allow the caller to designate one piece of trim to ignore The list of trim controls that were disabled during this call |
enableTrim | public void enableTrim(List disabledControls)(Code) | | Enables the controls in the list. This list is expected to be a non-modified
List as returned from a call to 'disableTrim'.
Parameters: disabledControls - The list of controls to enable |
flush | public void flush(Control dirtyControl)(Code) | | |
forceLayout | public void forceLayout()(Code) | | Force a layout of the trim
|
getAreaIds | public int[] getAreaIds()(Code) | | |
getAreaTrim | public List getAreaTrim(int areaId)(Code) | | |
getCenterControl | public Control getCenterControl()(Code) | | Returns the control in the center of this layout
the center area control. |
getPreferredArea | public int getPreferredArea(String trimId)(Code) | | If the given id has a cached location return its preferred side
Parameters: trimId - The id of the trim to be tested The areaId of a cached id or -1 if no cache info exists |
getPreferredLocation | public IWindowTrim getPreferredLocation(String trimId)(Code) | | If the given id has a cached location return an existing trim
element that it should be placed before (if any)
Parameters: trimId - The id of the trim to be tested The trim to be inserted before or null if no cached info exists |
getTrimArea | public TrimArea getTrimArea(int areaId)(Code) | | Return the trim area associated with the given id
Parameters: areaId - The id of the trim area to get The TrimArea or null if the id is not found |
getTrimAreaId | public int getTrimAreaId(Control trimControl)(Code) | | Returns the location of the given trim control. For example, returns
SWT.LEFT if the control is docked on the left, SWT.RIGHT if docked on the
right, etc. Returns SWT.DEFAULT if the given control is not a trim
control.
Parameters: trimControl - control to query The area ID of this control. If the control is not part of ourtrim, return SWT.DEFAULT. See Also: TrimLayout.getAreaIds() |
getTrimRect | public Rectangle getTrimRect(Composite window, int areaId)(Code) | | Return a trim area rectangle.
Parameters: window - the window that has the trim Parameters: areaId - the side it's on the area rectangle. since: 3.2 See Also: TrimLayout.getAreaIds() |
layout | protected void layout(Composite composite, boolean flushCache)(Code) | | |
setCenterControl | public void setCenterControl(Control center)(Code) | | Sets the widget that will occupy the central area of the layout.
Typically, this will be a composite that contains the main widgetry of
the application.
Parameters: center - control that will occupy the center of the layout, or null ifnone |
setMargins | public void setMargins(int marginWidth, int marginHeight)(Code) | | Sets the empty space around the outside of the layout. This whitespace is
located outside the trim widgets.
Parameters: marginWidth - Parameters: marginHeight - |
setPreferredLocations | public void setPreferredLocations(int areaId, List preferredLocations)(Code) | | Remember the persisted locations for the trim. This allows the code
to site the trim in its preferred (i.e. cached) location on creation
Parameters: areaId - The id of the trim area being defined Parameters: preferredLocations - A list of trim ID's |
setSpacing | public void setSpacing(int left, int right, int top, int bottom)(Code) | | Sets the empty space surrounding the center area. This whitespace is
located between the trim and the central widget.
Parameters: left - pixel width Parameters: right - pixel width Parameters: top - pixel width Parameters: bottom - pixel width |
setTrimSize | public void setTrimSize(int areaId, int size)(Code) | | Sets the trimSize (pixels) for the given side of the layout. If
SWT.DEFAULT, then the trim size will be computed from child controls.
Parameters: areaId - the area ID Parameters: size - in pixels See Also: TrimLayout.getAreaIds() |
updateAreaTrim | public void updateAreaTrim(int id, List trim, boolean removeExtra)(Code) | | |
|
|