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 AbstractGroupStrategys. 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 voidaddExpandListener(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 theExpandListenerinterface.(package private) voidaddToolItem(PGroupToolItem toolitem)org.eclipse.swt.graphics.PointcomputeSize(int arg0, int arg1, boolean arg2)org.eclipse.swt.graphics.RectanglecomputeTrim(int x, int y, int width, int height)org.eclipse.swt.graphics.ColorgetBackground()org.eclipse.swt.graphics.RectanglegetClientArea()booleangetExpanded()Returns the expanded/collapsed state.org.eclipse.swt.graphics.ImagegetImage()Returns the image.intgetImagePosition()Returns the image position.intgetLinePosition()Returns the line position.AbstractGroupStrategygetStrategy()Returns the strategy.java.lang.StringgetText()Returns the text.intgetTogglePosition()Returns the toggle position.AbstractRenderergetToggleRenderer()Returns the toggle renderer ornull.AbstractToolItemRenderergetToolItemRenderer()PGroupToolItem[]getToolItems()(package private) org.eclipse.swt.graphics.ColorinternalGetBackground()voidremoveExpandListener(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) voidremoveToolItem(PGroupToolItem toolitem)voidsetBackground(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.voidsetExpanded(boolean expanded)Sets the expanded state of the group.voidsetFont(org.eclipse.swt.graphics.Font font)voidsetImage(org.eclipse.swt.graphics.Image image)Sets the image.voidsetImagePosition(int imagePosition)Sets the image position.voidsetLinePosition(int linePosition)Sets the line position.voidsetStrategy(AbstractGroupStrategy strategy)Sets the strategy.voidsetText(java.lang.String text)Sets the text.voidsetTogglePosition(int togglePosition)Sets the toggle position.voidsetToggleRenderer(AbstractRenderer toggleRenderer)Sets the toggle renderer.voidsetToolItemRenderer(AbstractToolItemRenderer toolItemRenderer)Methods 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, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
getHorizontalBar, getScrollbarsMode, getVerticalBarMethods 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, updateMethods 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
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.To ensure that the color of corners is equal to one of the underlying control invoke the parent composites
Composite.setBackgroundMode(int)withSWT.INHERIT_DEFAULTorSWT.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:
getBackgroundin 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_DEFAULTorSWT.INHERIT_DEFAULTNote: If a new strategy is set on the receiver it may overwrite the existing background color.
- Overrides:
setBackgroundin 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 tonullthe 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:
setFontin 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:
computeSizein 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 theExpandListenerinterface.- 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.LEFTandSWT.RIGHT(mutually exclusive).SWT.TOPis 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.LEFTandSWT.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.BOTTOMandSWT.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:
computeTrimin classorg.eclipse.swt.widgets.Scrollable
-
getClientArea
public org.eclipse.swt.graphics.Rectangle getClientArea()- Overrides:
getClientAreain classorg.eclipse.swt.widgets.Scrollable
-
addToolItem
-
removeToolItem
-
getToolItemRenderer
-
setToolItemRenderer
-
getToolItems
-