|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.presentations.StackPresentation
This represents an object that can supply trim around a IPresentablePart. Clients can implement subclasses to provide the appearance for editor workbooks, view folders, fast views, and detached windows.
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
.
Field Summary | |
---|---|
static int |
AS_ACTIVE_FOCUS
Activation state indicating that one of the parts in the presentation currently has focus |
static int |
AS_ACTIVE_NOFOCUS
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
Inactive state. |
Fields inherited from interface org.eclipse.ui.ISizeProvider |
---|
INFINITE |
Constructor Summary | |
---|---|
protected |
StackPresentation(IStackPresentationSite stackSite)
Constructs a new stack presentation with the given site. |
Method Summary | |
---|---|
abstract void |
addPart(IPresentablePart newPart,
Object cookie)
Adds the given part to the stack. |
Point |
computeMinimumSize()
Deprecated. replaced by computePreferredSize |
int |
computePreferredSize(boolean width,
int availableParallel,
int availablePerpendicular,
int preferredResult)
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()
Disposes all SWT resources being used by the stack. |
abstract StackDropResult |
dragOver(Control currentControl,
Point location)
This method is invoked whenever a part is dragged over the stack's control. |
abstract Control |
getControl()
Returns the control for this presentation |
protected IStackPresentationSite |
getSite()
Returns the presentation site (not null). |
int |
getSizeFlags(boolean width)
Returns a bitwise combination of flags indicating how and when computePreferredSize should be used. |
abstract Control[] |
getTabList(IPresentablePart part)
Returns the tab-key traversal order for the given IPresentablePart . |
void |
movePart(IPresentablePart toMove,
Object cookie)
Moves a part to a new location as the result of a drag/drop operation within this presentation. |
abstract void |
removePart(IPresentablePart oldPart)
Removes the given part from the stack. |
void |
restoreState(IPresentationSerializer context,
IMemento memento)
Restores the state of this presentation to a previously saved state. |
void |
saveState(IPresentationSerializer context,
IMemento memento)
Saves the state of this presentation to the given memento. |
abstract void |
selectPart(IPresentablePart toSelect)
Brings the specified part to the foreground. |
abstract void |
setActive(int newState)
This is invoked to notify the presentation that its activation state has changed. |
abstract void |
setBounds(Rectangle bounds)
Sets the bounding rectangle for this presentation. |
abstract void |
setState(int state)
Sets the state of the presentation. |
abstract void |
setVisible(boolean isVisible)
This causes the presentation to become visible or invisible. |
abstract void |
showPaneMenu()
Instructs the presentation to display the pane menu |
void |
showPartList()
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()
Instructs the presentation to display the system menu |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int AS_INACTIVE
public static final int AS_ACTIVE_FOCUS
public static final int AS_ACTIVE_NOFOCUS
Constructor Detail |
protected StackPresentation(IStackPresentationSite stackSite)
stackSite
- the stack siteMethod Detail |
protected IStackPresentationSite getSite()
public abstract void setBounds(Rectangle bounds)
bounds
- new bounding rectangle (not null)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 (=true) or a height (=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 IPresentationSite. 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 IPresentationSite.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
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.