Class PGroup
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class PGroup
extends org.eclipse.swt.widgets.Canvas
This widget is customizable through alternative AbstractGroupStrategy
s. Each
strategy determines the size and appearance of the widget.
- Styles:
- SMOOTH
- Events:
- Expand, Collapse
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PGroup(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
Modifier and Type Method Description void
addExpandListener(org.eclipse.swt.events.ExpandListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver is expanded or collapsed by sending it one of the messages defined in theExpandListener
interface.(package private) void
addToolItem(PGroupToolItem toolitem)
org.eclipse.swt.graphics.Point
computeSize(int arg0, int arg1, boolean arg2)
org.eclipse.swt.graphics.Rectangle
computeTrim(int x, int y, int width, int height)
org.eclipse.swt.graphics.Color
getBackground()
org.eclipse.swt.graphics.Rectangle
getClientArea()
boolean
getExpanded()
Returns the expanded/collapsed state.org.eclipse.swt.graphics.Image
getImage()
Returns the image.int
getImagePosition()
Returns the image position.int
getLinePosition()
Returns the line position.AbstractGroupStrategy
getStrategy()
Returns the strategy.java.lang.String
getText()
Returns the text.int
getTogglePosition()
Returns the toggle position.AbstractRenderer
getToggleRenderer()
Returns the toggle renderer ornull
.AbstractToolItemRenderer
getToolItemRenderer()
PGroupToolItem[]
getToolItems()
(package private) org.eclipse.swt.graphics.Color
internalGetBackground()
void
removeExpandListener(org.eclipse.swt.events.ExpandListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver are expanded or collapsed.(package private) void
removeToolItem(PGroupToolItem toolitem)
void
setBackground(org.eclipse.swt.graphics.Color color)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setExpanded(boolean expanded)
Sets the expanded state of the group.void
setFont(org.eclipse.swt.graphics.Font font)
void
setImage(org.eclipse.swt.graphics.Image image)
Sets the image.void
setImagePosition(int imagePosition)
Sets the image position.void
setLinePosition(int linePosition)
Sets the line position.void
setStrategy(AbstractGroupStrategy strategy)
Sets the strategy.void
setText(java.lang.String text)
Sets the text.void
setTogglePosition(int togglePosition)
Sets the toggle position.void
setToggleRenderer(AbstractRenderer toggleRenderer)
Sets the toggle renderer.void
setToolItemRenderer(AbstractToolItemRenderer toolItemRenderer)
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIME
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, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
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, dragDetect, dragDetect, forceFocus, getAccessible, 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, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, 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
-
Constructor Details
-
PGroup
public PGroup(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
SWT
which 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 thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.To ensure that the color of corners is equal to one of the underlying control invoke the parent composites
Composite.setBackgroundMode(int)
withSWT.INHERIT_DEFAULT
orSWT.INHERIT_DEFAULT
- 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
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
SWT
,Widget.checkSubclass()
,Widget.getStyle()
-
-
Method Details
-
getBackground
public org.eclipse.swt.graphics.Color getBackground()- Overrides:
getBackground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.getBackground()
-
internalGetBackground
org.eclipse.swt.graphics.Color internalGetBackground() -
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.
To ensure that the color of corners is equal to one of the underlying control invoke the parent composites
Composite.setBackgroundMode(int)
withSWT.INHERIT_DEFAULT
orSWT.INHERIT_DEFAULT
Note: If a new strategy is set on the receiver it may overwrite the existing background color.
- Overrides:
setBackground
in classorg.eclipse.swt.widgets.Control
- Parameters:
color
- the new color (or null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the argument 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
-
getToggleRenderer
Returns the toggle renderer ornull
.- 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
-
setToggleRenderer
Sets the toggle renderer. If the toggle renderer is set tonull
the control will not show a toggle or allow the user to expand/collapse the group by clicking on the title.- Parameters:
toggleRenderer
- the toggleRenderer to set ornull
- 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
-
getStrategy
Returns the strategy.- 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
-
setStrategy
Sets the strategy.- Parameters:
strategy
- the strategy to set- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the strategy is null
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 image.- 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
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image)Sets the image.- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the image is 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
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)- Overrides:
setFont
in classorg.eclipse.swt.widgets.Canvas
- See Also:
Canvas.setFont(org.eclipse.swt.graphics.Font)
-
getText
public java.lang.String getText()Returns the text.- 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
-
setText
public void setText(java.lang.String text)Sets the text.- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the text is null
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
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int arg0, int arg1, boolean arg2)- Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.computeSize(int, int, boolean)
-
getExpanded
public boolean getExpanded()Returns the expanded/collapsed state.- 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
-
setExpanded
public void setExpanded(boolean expanded)Sets the expanded state of the group.- 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
-
addExpandListener
public void addExpandListener(org.eclipse.swt.events.ExpandListener listener)Adds the listener to the collection of listeners who will be notified when the receiver is expanded or collapsed by sending it one of the messages defined in theExpandListener
interface.- Parameters:
listener
- the listener which should be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
ExpandListener
,removeExpandListener(org.eclipse.swt.events.ExpandListener)
-
removeExpandListener
public void removeExpandListener(org.eclipse.swt.events.ExpandListener listener)Removes the listener from the collection of listeners who will be notified when the receiver are expanded or collapsed.- Parameters:
listener
- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
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
- See Also:
ExpandListener
,addExpandListener(org.eclipse.swt.events.ExpandListener)
-
getImagePosition
public int getImagePosition()Returns the image position. The image position is a combination of integer constants OR'ed together.- 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
-
setImagePosition
public void setImagePosition(int imagePosition)Sets the image position. The image position is a combination of integer constants OR'ed together. Valid values areSWT.LEFT
andSWT.RIGHT
(mutually exclusive).SWT.TOP
is hint interpreted by some strategies.- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the strategy is null
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
-
getTogglePosition
public int getTogglePosition()Returns the toggle position. The toggle position is a combination of integer constants OR'ed together.- 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
-
setTogglePosition
public void setTogglePosition(int togglePosition)Sets the toggle position. The toggle position is a combination of integer constants OR'ed together. Valid values areSWT.LEFT
andSWT.RIGHT
(mutually exclusive).- 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
-
getLinePosition
public int getLinePosition()Returns the line position. The line position is a combination of integer constants OR'ed together.- 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
-
setLinePosition
public void setLinePosition(int linePosition)Sets the line position. The line position is a combination of integer constants OR'ed together. Valid values areSWT.BOTTOM
andSWT.CENTER
(mutually exclusive).- 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
-
computeTrim
public org.eclipse.swt.graphics.Rectangle computeTrim(int x, int y, int width, int height)- Overrides:
computeTrim
in classorg.eclipse.swt.widgets.Scrollable
-
getClientArea
public org.eclipse.swt.graphics.Rectangle getClientArea()- Overrides:
getClientArea
in classorg.eclipse.swt.widgets.Scrollable
-
addToolItem
-
removeToolItem
-
getToolItemRenderer
-
setToolItemRenderer
-
getToolItems
-