@Deprecated public abstract class StackPresentation extends Object implements ISizeProvider
StackPresentations do not store any persistent state and cannot directly make changes to the workbench. They are given an IStackPresentationSite reference on creation, which allows them to send events and requests to the workbench. However, the workbench is free to ignore these requests. The workbench will call one of the public methods on StackPresentation when (and if) the presentation is expected to change state.
For example, if the user clicks a button that is intended to close a part,
the StackPresentation will send a close request to its site, but should not
assume that the part has been closed until the workbench responds with a call
StackPresentation.remove
.
Modifier and Type | Field and Description |
---|---|
static int |
AS_ACTIVE_FOCUS
Deprecated.
Activation state indicating that one of the parts in the presentation currently has focus
|
static int |
AS_ACTIVE_NOFOCUS
Deprecated.
Activation state indicating that none of the parts in the presentation have focus, but
one of the parts is being used as the context for global menus and toolbars
|
static int |
AS_INACTIVE
Deprecated.
Inactive state.
|
INFINITE
Modifier | Constructor and Description |
---|---|
protected |
StackPresentation(IStackPresentationSite stackSite)
Deprecated.
Constructs a new stack presentation with the given site.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addPart(IPresentablePart newPart,
Object cookie)
Deprecated.
Adds the given part to the stack.
|
Point |
computeMinimumSize()
Deprecated.
replaced by computePreferredSize
|
int |
computePreferredSize(boolean width,
int availableParallel,
int availablePerpendicular,
int preferredResult)
Deprecated.
Returns the best size for this part, given the available width and height
and the workbench's preferred size for the part.
|
abstract void |
dispose()
Deprecated.
Disposes all SWT resources being used by the stack.
|
abstract StackDropResult |
dragOver(Control currentControl,
Point location)
Deprecated.
This method is invoked whenever a part is dragged over the stack's control.
|
abstract Control |
getControl()
Deprecated.
Returns the control for this presentation
|
protected IStackPresentationSite |
getSite()
Deprecated.
Returns the presentation site (not null).
|
int |
getSizeFlags(boolean width)
Deprecated.
Returns a bitwise combination of flags indicating how and when computePreferredSize should
be used.
|
abstract Control[] |
getTabList(IPresentablePart part)
Deprecated.
Returns the tab-key traversal order for the given
IPresentablePart . |
void |
movePart(IPresentablePart toMove,
Object cookie)
Deprecated.
Moves a part to a new location as the result of a drag/drop
operation within this presentation.
|
abstract void |
removePart(IPresentablePart oldPart)
Deprecated.
Removes the given part from the stack.
|
void |
restoreState(IPresentationSerializer context,
IMemento memento)
Deprecated.
Restores the state of this presentation to a previously saved state.
|
void |
saveState(IPresentationSerializer context,
IMemento memento)
Deprecated.
Saves the state of this presentation to the given memento.
|
abstract void |
selectPart(IPresentablePart toSelect)
Deprecated.
Brings the specified part to the foreground.
|
abstract void |
setActive(int newState)
Deprecated.
This is invoked to notify the presentation that its activation
state has changed.
|
abstract void |
setBounds(Rectangle bounds)
Deprecated.
Sets the bounding rectangle for this presentation.
|
abstract void |
setState(int state)
Deprecated.
Sets the state of the presentation.
|
abstract void |
setVisible(boolean isVisible)
Deprecated.
This causes the presentation to become visible or invisible.
|
abstract void |
showPaneMenu()
Deprecated.
Instructs the presentation to display the pane menu
|
void |
showPartList()
Deprecated.
Instructs the presentation to display a list of all parts in the stack, and
allow the user to change the selection using the keyboard.
|
abstract void |
showSystemMenu()
Deprecated.
Instructs the presentation to display the system menu
|
public static final int AS_INACTIVE
public static final int AS_ACTIVE_FOCUS
public static final int AS_ACTIVE_NOFOCUS
protected StackPresentation(IStackPresentationSite stackSite)
stackSite
- the stack siteprotected IStackPresentationSite getSite()
public abstract void setBounds(Rectangle bounds)
bounds
- new bounding rectangle (not null)@Deprecated public Point computeMinimumSize()
public int getSizeFlags(boolean width)
ISizeProvider
If the return value of this function ever changes, the part must call flushLayout
before
the changes will take effect.
getSizeFlags
in interface ISizeProvider
width
- a value of true or false determines whether the return value applies when computing
widths or heights respectively. That is, getSizeFlags(true) will be used when calling
computePreferredSize(true,...)public int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult)
ISizeProvider
Returns the best size for this part, given the available width and height and the workbench's preferred size for the part. Parts can overload this to enforce a minimum size, maximum size, or a quantized set of preferred sizes. If width == true, this method computes a width in pixels. If width == false, this method computes a height. availableParallel and availablePerpendicular contain the space available, and preferredParallel contains the preferred result.
This method returns an answer that is less than or equal to availableParallel and as close to preferredParallel as possible. Return values larger than availableParallel will be truncated.
Most presentations will define a minimum size at all times, and a maximum size that only applies when maximized.
The getSizeFlags method controls how frequently this method will be called and what information will be available when it is. Any subclass that specializes this method should also specialize getSizeFlags. computePreferredSize(width, INFINITE, someSize, 0) returns the minimum size of the control (if any). computePreferredSize(width, INFINITE, someSize, INFINITE) returns the maximum size of the control.
Examples:
{
if (width && preferredResult != INFINITE) {
int result = preferredResult - ((preferredResult + 50) % 100) + 50;
result = Math.max(100, Math.min(result, availableParallel - (availableParallel % 100)));
return result;
}
return preferredResult;
}
In this case, getSizeFlags(boolean width) must return (width ?
SWT.FILL | SWT.MIN: 0)
{return availablePerpendicular < 100 ? 1000 : 100000 / availablePerpendicular;}
getSizeFlags(boolean width) must return SWT.WRAP | SWT.MIN;computePreferredSize
in interface ISizeProvider
width
- indicates whether a width (if true
) or a height
(if false
) is being computedavailableParallel
- available space. This is a width (pixels) if width == true,
and a height (pixels) if width == false. A return value larger
than this will be ignored.availablePerpendicular
- available space perpendicular to the direction being measured
or INFINITE if unbounded (pixels). This is a height if width
== true, or a height if width == false. Implementations will
generally ignore this argument unless they contain wrapping
widgets. Note this argument will only contain meaningful
information if the part returns the SWT.WRAP flag from
getSizeFlags(width)preferredResult
- preferred size of the control (pixels, <= availableParallel).
Set to INFINITE if unknown or unbounded.ISizeProvider.getSizeFlags(boolean)
public abstract void dispose()
public abstract void setActive(int newState)
newState
- one of AS_INACTIVE, AS_ACTIVE, or AS_ACTIVE_NOFOCUSpublic abstract void setVisible(boolean isVisible)
isVisible
- the state to set visibility topublic abstract void setState(int state)
If a presentation wishes to minimize itself, it must call setState on its associated IStackPresentationSite. If the site chooses to respond to the state change, it will call this method at the correct time. The presentation should not call this method directly.
state
- one of the IStackPresentationSite.STATE_* constants.public abstract Control getControl()
public abstract void addPart(IPresentablePart newPart, Object cookie)
newPart
- the new part to add (not null)cookie
- an identifier for a drop location, or null. When the presentation
attaches a cookie to a StackDropResult, that cookie is passed back into
addPart when a part is actually dropped in that location.public abstract void removePart(IPresentablePart oldPart)
oldPart
- the part to remove (not null)public void movePart(IPresentablePart toMove, Object cookie)
toMove
- a part that already belongs to this presentationcookie
- a drop cookie returned by StackPresentation#dragOver
public abstract void selectPart(IPresentablePart toSelect)
toSelect
- the new active part (not null)public abstract StackDropResult dragOver(Control currentControl, Point location)
currentControl
- the control being dragged overlocation
- cursor location (display coordinates)public abstract void showSystemMenu()
public abstract void showPaneMenu()
public void showPartList()
public void saveState(IPresentationSerializer context, IMemento memento)
context
- object that can be used to generate unique IDs for IPresentableParts (this
may be a temporary object - the presentation should not keep any references to it)memento
- memento where the data will be savedpublic void restoreState(IPresentationSerializer context, IMemento memento)
context
- object that can be used to find IPresentableParts given string IDs (this
may be a temporary object - the presentation should not keep any references to it)memento
- memento where the data will be savedpublic abstract Control[] getTabList(IPresentablePart part)
IPresentablePart
.part
- the part
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.