Class Section
- All Implemented Interfaces:
Drawable
In case of the TITLE_BAR style, Section renders the title bar in a way compatible with the rest of the workbench. Since it is a widget, all the colors must be supplied directly. When created by the form toolkit, these colors are supplied by the toolkit. The toolkit initializes these colors based on the system colors. For this reason, it is recommended to create the section by the toolkit instead of through its own constructor.
Since 3.1, it is possible to set a control to be used for section
description. If used, DESCRIPTION style should not be set. A
typical way to take advantage of the new method is to set an instance of
FormText to provide for hyperlinks and images in the description
area.
- Since:
- 3.0
-
Field Summary
FieldsFields inherited from class org.eclipse.ui.forms.widgets.ExpandableComposite
CLIENT_INDENT, clientVerticalSpacing, COMPACT, descriptionVerticalSpacing, EXPANDED, FOCUS_TITLE, GAP, LEFT_TEXT_CLIENT_ALIGNMENT, marginHeight, marginWidth, NO_TITLE, NO_TITLE_FOCUS_BOX, SHORT_TITLE_BAR, textLabel, TITLE_BAR, titleBarTextMarginWidth, toggle, TREE_NODE, TWISTIE, VGAPFields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current description text.Returns the control used to render the description.Returns the control that is used as a separator between the title and the client, or null if not set.Returns the title bar background when TITLE_BAR style is used.Returns the title bar border color when TITLE_BAR style is used.Returns the title bar gradient background color when TITLE_BAR style is used.protected voidinternalSetExpanded(boolean expanded) Performs the expansion state change for the expandable control.protected voidIf TITLE_BAR or SHORT_TITLE_BAR style is used, title bar decoration will be painted behind the text in this method.protected voidreflow()Reflows this section and all the parents up the hierarchy until a SharedScrolledComposite is reached.voidsetBackground(Color bg) Sets the background of the section.final voidsetBackgroundImage(Image image) Background image is used for the title gradient - does nothing.voidsetDescription(String description) Sets the description text.voidsetDescriptionControl(Control descriptionControl) Sets the description control of this section.voidsetForeground(Color fg) Sets the foreground of the section and the description control if there is one.voidsetSeparatorControl(Control separator) Sets the separator control of this section.voidsetTitleBarBackground(Color color) Sets the color of the title bar background when TITLE_BAR style is used.voidsetTitleBarBorderColor(Color color) Sets the color of the title bar border when TITLE_BAR style is used.voidSets the color of the title bar gradient background when TITLE_BAR style is used.Methods inherited from class org.eclipse.ui.forms.widgets.ExpandableComposite
addExpansionListener, computeSize, forceFocus, getClient, getExpansionStyle, getText, getTextClient, getTextClientHeightDifference, getTitleBarForeground, hasTitleBar, isExpanded, isFixedStyle, removeExpansionListener, setActiveToggleColor, setClient, setEnabled, setExpanded, setExpanded, setFont, setLayout, setMenu, setText, setTextClient, setTitleBarForeground, setToggleColor, setToolTipTextMethods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIMEMethods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBounds, setBounds, setCapture, setCursor, setDragDetect, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Field Details
-
DESCRIPTION
public static final int DESCRIPTIONDescription style. If used, description will be rendered below the title.- See Also:
-
-
Constructor Details
-
Section
Creates a new section instance in the provided parent.- Parameters:
parent- the parent compositestyle- the style to use
-
-
Method Details
-
internalSetExpanded
protected void internalSetExpanded(boolean expanded) Description copied from class:ExpandableCompositePerforms the expansion state change for the expandable control.- Overrides:
internalSetExpandedin classExpandableComposite- Parameters:
expanded- the expansion state
-
reflow
protected void reflow()Reflows this section and all the parents up the hierarchy until a SharedScrolledComposite is reached. -
setDescription
Sets the description text. Has no effect if DESCRIPTION style was not used to create the control.- Parameters:
description- new description text; notnull
-
getDescription
Returns the current description text.- Returns:
- description text or
nullif DESCRIPTION style was not used to create the control.
-
setSeparatorControl
Sets the separator control of this section. The separator must not be null and must be a direct child of this container. If defined, separator will be placed below the title text and will remain visible regardless of the expansion state.- Parameters:
separator- the separator that will be placed below the title text.
-
getSeparatorControl
Returns the control that is used as a separator between the title and the client, or null if not set.- Overrides:
getSeparatorControlin classExpandableComposite- Returns:
- separator control or null if not set.
-
setBackground
Sets the background of the section.- Overrides:
setBackgroundin classExpandableComposite- Parameters:
bg- the new background
-
setForeground
Sets the foreground of the section and the description control if there is one.- Overrides:
setForegroundin classExpandableComposite- Parameters:
fg- the new foreground.
-
getDescriptionControl
Returns the control used to render the description. In 3.1, this method was promoted to public.- Overrides:
getDescriptionControlin classExpandableComposite- Returns:
- description control or
nullif DESCRIPTION style was not used to create the control and description control was not set by the client. - See Also:
-
setDescriptionControl
Sets the description control of this section. The control must not be null and must be a direct child of this container. If defined, control will be placed below the title text and the separator and will be hidden in the collapsed state.This method and
DESCRIPTIONstyle are mutually exclusive. Use the method only if you want to create the description control yourself.- Parameters:
descriptionControl- the control that will be placed below the title text.- Since:
- 3.1
-
setTitleBarBorderColor
Sets the color of the title bar border when TITLE_BAR style is used.- Parameters:
color- the title bar border color
-
setTitleBarBackground
Sets the color of the title bar background when TITLE_BAR style is used. This color is used as a starting color for the vertical gradient.- Parameters:
color- the title bar border background
-
setTitleBarGradientBackground
Sets the color of the title bar gradient background when TITLE_BAR style is used. This color is used at the height where title controls end (toggle, tool bar).- Parameters:
color- the title bar gradient background
-
getTitleBarBorderColor
Returns the title bar border color when TITLE_BAR style is used.- Returns:
- the title bar border color
-
getTitleBarGradientBackground
Returns the title bar gradient background color when TITLE_BAR style is used.- Returns:
- the title bar gradient background
-
getTitleBarBackground
Returns the title bar background when TITLE_BAR style is used.- Returns:
- the title bar background
-
onPaint
Description copied from class:ExpandableCompositeIf TITLE_BAR or SHORT_TITLE_BAR style is used, title bar decoration will be painted behind the text in this method. The default implementation does nothing - subclasses are responsible for rendering the title area.- Overrides:
onPaintin classExpandableComposite- Parameters:
e- the paint event
-
setBackgroundImage
Background image is used for the title gradient - does nothing.- Overrides:
setBackgroundImagein classControl- Parameters:
image- the new image (or null)
-