|
org.eclipse.swt.custom
Class ViewForm
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.custom.ViewForm
-
All Implemented Interfaces:
-
Adaptable
- public class ViewForm
- extends
Composite
Instances of this class implement a Composite that positions and sizes
children and allows programmatic control of layout and border parameters.
ViewForm is used in the workbench to lay out a view's label/menu/toolbar
local bar.
Note that although this class is a subclass of Composite , it
does not make sense to set a layout on it.
-
Styles:
- BORDER, FLAT
-
Events:
- (None)
IMPORTANT: This class is not intended to be subclassed.
Field Summary
|
int
|
horizontalSpacing
horizontalSpacing specifies the number of pixels between the right edge of
one cell and the left edge of its neighbouring cell to the right. |
int
|
marginHeight
marginHeight specifies the number of pixels of vertical margin that will be
placed along the top and bottom edges of the form. |
int
|
marginWidth
marginWidth specifies the number of pixels of horizontal margin that will
be placed along the left and right edges of the form. |
int
|
verticalSpacing
verticalSpacing specifies the number of pixels between the bottom edge of
one cell and the top edge of its neighbouring cell underneath. |
Constructor Summary
|
ViewForm
(
Composite parent,
int style)
Constructs a new instance of this class given its parent and a style value
describing its behavior and appearance. |
Method Summary
|
protected void
|
checkSubclass
()
|
Rectangle
|
computeTrim
(int x,
int y,
int width,
int height)
Given a desired client area for the receiver
(as described by the arguments), returns the bounding
rectangle which would be required to produce that client
area. |
Rectangle
|
getClientArea
()
Returns a rectangle which describes the area of the
receiver which is capable of displaying data (that is,
not covered by the "trimmings"). |
Control
|
getContent
()
Returns the content area. |
Control
|
getTopCenter
()
Returns Control that appears in the top center of the pane. |
Control
|
getTopLeft
()
Returns the Control that appears in the top left corner of the pane. |
Control
|
getTopRight
()
Returns the control in the top right corner of the pane. |
void
|
setBorderVisible
(boolean show)
Specify whether the border should be displayed or not. |
void
|
setContent
(
Control content)
Sets the content. |
void
|
setLayout
(
Layout layout)
Sets the layout which is associated with the receiver to be the argument
which may be null. |
void
|
setTopCenter
(
Control topCenter)
Set the control that appears in the top center of the pane. |
void
|
setTopCenterSeparate
(boolean show)
If true, the topCenter will always appear on a separate line by itself,
otherwise the topCenter will appear in the top row if there is room and
will be moved to the second row if required. |
void
|
setTopLeft
(
Control c)
Set the control that appears in the top left corner of the pane. |
void
|
setTopRight
(
Control c)
Set the control that appears in the top right corner of the pane. |
Methods inherited from class org.eclipse.swt.widgets.
Composite
|
changed,
computeSize,
getAdapter,
getBackgroundMode,
getChildren,
getLayout,
getLayoutDeferred,
getTabList,
isLayoutDeferred,
layout,
layout,
layout,
layout,
setBackgroundMode,
setFocus,
setTabList
|
Methods inherited from class org.eclipse.swt.widgets.
Control
|
addControlListener,
addFocusListener,
addKeyListener,
addMouseListener,
addTraverseListener,
computeSize,
forceFocus,
getBackground,
getBackgroundImage,
getBorderWidth,
getBounds,
getCursor,
getEnabled,
getFont,
getForeground,
getLayoutData,
getLocation,
getMenu,
getMonitor,
getParent,
getShell,
getSize,
getToolTipText,
getVisible,
isEnabled,
isFocusControl,
isVisible,
moveAbove,
moveBelow,
pack,
pack,
redraw,
removeControlListener,
removeFocusListener,
removeKeyListener,
removeMouseListener,
removeTraverseListener,
setBackground,
setBackgroundImage,
setBounds,
setBounds,
setCursor,
setEnabled,
setFont,
setForeground,
setLayoutData,
setLocation,
setLocation,
setMenu,
setRedraw,
setSize,
setSize,
setToolTipText,
setVisible,
toControl,
toControl,
toDisplay,
toDisplay
|
Methods inherited from class org.eclipse.swt.widgets.
Widget
|
addDisposeListener,
addListener,
checkWidget,
dispose,
getData,
getData,
getDisplay,
getStyle,
isDisposed,
notifyListeners,
removeDisposeListener,
removeListener,
setData,
setData,
toString
|
marginWidth
public int marginWidth
- marginWidth specifies the number of pixels of horizontal margin that will
be placed along the left and right edges of the form. The default value is
0.
marginHeight
public int marginHeight
- marginHeight specifies the number of pixels of vertical margin that will be
placed along the top and bottom edges of the form. The default value is 0.
horizontalSpacing
public int horizontalSpacing
- horizontalSpacing specifies the number of pixels between the right edge of
one cell and the left edge of its neighbouring cell to the right. The
default value is 1.
verticalSpacing
public int verticalSpacing
- verticalSpacing specifies the number of pixels between the bottom edge of
one cell and the top edge of its neighbouring cell underneath. The default
value is 1.
ViewForm
public ViewForm(
Composite parent,
int style)
- Constructs a new instance of this class given its parent and a style value
describing its behavior and appearance.
The style value is either one of the style constants defined in class
SWT which is applicable to instances of this class, or must
be built by bitwise OR'ing together (that is, using the
int "|" operator) two or more of those SWT
style constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherited from superclasses.
-
Parameters:
-
parent - a widget which will be the parent of the new instance (cannot
be null) -
style - the style of widget to construct
-
Throws:
-
IllegalArgumentException
-
- ERROR_NULL_ARGUMENT - if the parent is null
-
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the parent
-
See Also:
-
SWT.BORDER ,
SWT.FLAT ,
Widget.getStyle()
checkSubclass
protected void checkSubclass()
-
-
Overrides:
-
checkSubclass
in class
Widget
-
computeTrim
public
Rectangle computeTrim(int x,
int y,
int width,
int height)
-
Description copied from class:
Scrollable
- Given a desired client area for the receiver
(as described by the arguments), returns the bounding
rectangle which would be required to produce that client
area.
In other words, it returns a rectangle such that, if the
receiver's bounds were set to that rectangle, the area
of the receiver which is capable of displaying data
(that is, not covered by the "trimmings") would be the
rectangle described by the arguments (relative to the
receiver's parent).
-
-
Overrides:
-
computeTrim
in class
Scrollable
-
-
Parameters:
-
x - the desired x coordinate of the client area -
y - the desired y coordinate of the client area -
width - the desired width of the client area -
height - the desired height of the client area
-
Returns:
- the required bounds to produce the given client area
-
See Also:
-
Scrollable.getClientArea()
getClientArea
public
Rectangle getClientArea()
-
Description copied from class:
Scrollable
- Returns a rectangle which describes the area of the
receiver which is capable of displaying data (that is,
not covered by the "trimmings").
-
-
Overrides:
-
getClientArea
in class
Scrollable
-
-
Returns:
- the client area
-
See Also:
-
Scrollable.computeTrim(int, int, int, int)
getContent
public
Control getContent()
- Returns the content area.
-
-
Returns:
- the control in the content area of the pane or null
getTopCenter
public
Control getTopCenter()
- Returns Control that appears in the top center of the pane. Typically this
is a toolbar.
-
-
Returns:
- the control in the top center of the pane or null
getTopLeft
public
Control getTopLeft()
- Returns the Control that appears in the top left corner of the pane.
Typically this is a label such as CLabel.
-
-
Returns:
- the control in the top left corner of the pane or null
getTopRight
public
Control getTopRight()
- Returns the control in the top right corner of the pane. Typically this is
a Close button or a composite with a Menu and Close button.
-
-
Returns:
- the control in the top right corner of the pane or null
setContent
public void setContent(
Control content)
- Sets the content. Setting the content to null will remove it from the pane -
however, the creator of the content must dispose of the content.
-
-
Parameters:
-
content - the control to be displayed in the content area or null
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the control is not a child of
this ViewForm
setLayout
public void setLayout(
Layout layout)
- Sets the layout which is associated with the receiver to be the argument
which may be null.
Note: No Layout can be set on this Control because it already manages the
size and position of its children.
-
-
Overrides:
-
setLayout
in class
Composite
-
-
Parameters:
-
layout - the receiver's new layout or null
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
setTopCenter
public void setTopCenter(
Control topCenter)
- Set the control that appears in the top center of the pane. Typically this
is a toolbar. The topCenter is optional. Setting the topCenter to null will
remove it from the pane - however, the creator of the topCenter must
dispose of the topCenter.
-
-
Parameters:
-
topCenter - the control to be displayed in the top center or null
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the control is not a child of
this ViewForm
setTopLeft
public void setTopLeft(
Control c)
- Set the control that appears in the top left corner of the pane. Typically
this is a label such as CLabel. The topLeft is optional. Setting the top
left control to null will remove it from the pane - however, the creator of
the control must dispose of the control.
-
-
Parameters:
-
c - the control to be displayed in the top left corner or null
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the control is not a child of
this ViewForm
setTopRight
public void setTopRight(
Control c)
- Set the control that appears in the top right corner of the pane. Typically
this is a Close button or a composite with a Menu and Close button. The
topRight is optional. Setting the top right control to null will remove it
from the pane - however, the creator of the control must dispose of the
control.
-
-
Parameters:
-
c - the control to be displayed in the top right corner or null
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
- ERROR_INVALID_ARGUMENT - if the control is not a child of
this ViewForm
setBorderVisible
public void setBorderVisible(boolean show)
- Specify whether the border should be displayed or not.
-
-
Parameters:
-
show - true if the border should be displayed
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
setTopCenterSeparate
public void setTopCenterSeparate(boolean show)
- If true, the topCenter will always appear on a separate line by itself,
otherwise the topCenter will appear in the top row if there is room and
will be moved to the second row if required.
-
-
Parameters:
-
show - true if the topCenter will always appear on a separate line by
itself
-
Throws:
-
SWTException -
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the
thread that created the receiver
Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2008. All rights reserved.
|
|