Class Header
- 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.nebula.widgets.opal.header.Header
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class Header extends org.eclipse.swt.widgets.CompositeInstances of this class provide a header, which is composed of a text, a description and an image.- Styles:
- BORDER
- Events:
- (none)
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringdescriptionprivate org.eclipse.swt.graphics.ColorgradientEndprivate org.eclipse.swt.graphics.ColorgradientStartprivate org.eclipse.swt.graphics.Imageimageprivate org.eclipse.swt.graphics.ImagepreviousGeneratedImageprivate org.eclipse.swt.graphics.ColorseparatorColorprivate java.lang.Stringtitleprivate org.eclipse.swt.graphics.ColortitleColorprivate org.eclipse.swt.graphics.FonttitleFont
-
Constructor Summary
Constructors Constructor Description Header(org.eclipse.swt.widgets.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcreateContent()Create the content (title, image, description)private voidcreateDescription()Create the descriptionprivate voidcreateImage()Create the imageprivate voidcreateTitle()Create the titleprivate voiddrawBackground()Draw the background (a gradient+a separator)java.lang.StringgetDescription()Returns the receiver's description if it has one, or null if it does not.org.eclipse.swt.graphics.ColorgetGradientEnd()Returns the receiver's gradient end color.org.eclipse.swt.graphics.ColorgetGradientStart()Returns the receiver's gradient start color.org.eclipse.swt.graphics.ImagegetImage()Returns the receiver's image if it has one, or null if it does not.org.eclipse.swt.graphics.ColorgetSeparatorColor()Returns the receiver's separator color.java.lang.StringgetTitle()Returns the receiver's title if it has one, or null if it does not.org.eclipse.swt.graphics.ColorgetTitleColor()Returns the title's color.org.eclipse.swt.graphics.FontgetTitleFont()Returns the title's font.private voidinitFontAndColors()private voidredrawComposite()Redraw the compositevoidsetDescription(java.lang.String description)Sets the receiver's description to the argument, which may be null indicating that no description should be displayed.voidsetGradientEnd(org.eclipse.swt.graphics.Color gradientEnd)Sets the receiver's gradient end color.voidsetGradientStart(org.eclipse.swt.graphics.Color gradientStart)Sets the receiver's gradient start color.voidsetImage(org.eclipse.swt.graphics.Image image)Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.voidsetLayout(org.eclipse.swt.widgets.Layout layout)voidsetSeparatorColor(org.eclipse.swt.graphics.Color separatorColor)Sets the receiver's separator color.voidsetTitle(java.lang.String title)Sets the receiver's title to the argument, which may be null indicating that no title should be displayed.voidsetTitleColor(org.eclipse.swt.graphics.Color headerColor)Sets the receiver's title color.voidsetTitleFont(org.eclipse.swt.graphics.Font headerFont)Sets the receiver's title font.-
Methods 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
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, 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, isAutoScalable, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
image
private org.eclipse.swt.graphics.Image image
-
title
private java.lang.String title
-
description
private java.lang.String description
-
titleFont
private org.eclipse.swt.graphics.Font titleFont
-
titleColor
private org.eclipse.swt.graphics.Color titleColor
-
previousGeneratedImage
private org.eclipse.swt.graphics.Image previousGeneratedImage
-
gradientEnd
private org.eclipse.swt.graphics.Color gradientEnd
-
gradientStart
private org.eclipse.swt.graphics.Color gradientStart
-
separatorColor
private org.eclipse.swt.graphics.Color separatorColor
-
-
Constructor Detail
-
Header
public Header(org.eclipse.swt.widgets.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
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to construct- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
-
-
Method Detail
-
initFontAndColors
private void initFontAndColors()
-
redrawComposite
private void redrawComposite()
Redraw the composite
-
createContent
private void createContent()
Create the content (title, image, description)
-
createTitle
private void createTitle()
Create the title
-
createImage
private void createImage()
Create the image
-
createDescription
private void createDescription()
Create the description
-
drawBackground
private void drawBackground()
Draw the background (a gradient+a separator)
-
setLayout
public void setLayout(org.eclipse.swt.widgets.Layout layout)
- Overrides:
setLayoutin classorg.eclipse.swt.widgets.Composite- See Also:
Composite.setLayout(org.eclipse.swt.widgets.Layout)
-
getDescription
public java.lang.String getDescription()
Returns the receiver's description if it has one, or null if it does not.- Returns:
- the receiver's description if it has one, or null if it does not
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getGradientEnd
public org.eclipse.swt.graphics.Color getGradientEnd()
Returns the receiver's gradient end color.- Returns:
- the receiver's gradient end color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getGradientStart
public org.eclipse.swt.graphics.Color getGradientStart()
Returns the receiver's gradient start color.- Returns:
- the receiver's gradient start color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getImage
public org.eclipse.swt.graphics.Image getImage()
Returns the receiver's image if it has one, or null if it does not.- Returns:
- the receiver's image if it has one, or null if it does not
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSeparatorColor
public org.eclipse.swt.graphics.Color getSeparatorColor()
Returns the receiver's separator color.- Returns:
- the receiver's separator color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getTitle
public java.lang.String getTitle()
Returns the receiver's title if it has one, or null if it does not.- Returns:
- the receiver's title if it has one, or null if it does not
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getTitleColor
public org.eclipse.swt.graphics.Color getTitleColor()
Returns the title's color.- Returns:
- the title's color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getTitleFont
public org.eclipse.swt.graphics.Font getTitleFont()
Returns the title's font.- Returns:
- the title's font.
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setDescription
public void setDescription(java.lang.String description)
Sets the receiver's description to the argument, which may be null indicating that no description should be displayed.- Parameters:
description- the description of the header (may be null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setGradientEnd
public void setGradientEnd(org.eclipse.swt.graphics.Color gradientEnd)
Sets the receiver's gradient end color.- Parameters:
gradientEnd- the receiver's gradient end color- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setGradientStart
public void setGradientStart(org.eclipse.swt.graphics.Color gradientStart)
Sets the receiver's gradient start color.- Parameters:
gradientStart- the receiver's gradient start color- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.- Parameters:
image- the image to display on the receiver (may be null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSeparatorColor
public void setSeparatorColor(org.eclipse.swt.graphics.Color separatorColor)
Sets the receiver's separator color.- Parameters:
separatorColor- the receiver's separator color- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setTitle
public void setTitle(java.lang.String title)
Sets the receiver's title to the argument, which may be null indicating that no title should be displayed.- Parameters:
title- the title- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setTitleColor
public void setTitleColor(org.eclipse.swt.graphics.Color headerColor)
Sets the receiver's title color.- Parameters:
headerColor- the receiver's title color- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setTitleFont
public void setTitleFont(org.eclipse.swt.graphics.Font headerFont)
Sets the receiver's title font.- Parameters:
headerFont- the receiver's title font- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
-