Class CheckBoxGroup
- 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.widgets.Canvas
-
- org.eclipse.nebula.widgets.opal.checkboxgroup.CheckBoxGroup
-
- All Implemented Interfaces:
java.util.EventListener,org.eclipse.swt.events.PaintListener,org.eclipse.swt.graphics.Drawable,org.eclipse.swt.internal.SWTEventListener
public class CheckBoxGroup extends org.eclipse.swt.widgets.Canvas implements org.eclipse.swt.events.PaintListenerInstances of this class provide an etched border with a title and a checkbox. If the checkbox is checked, the content of the composite is enabled. If the checkbox is unchecked, the content of the composite is disabled, thus not editable.- Styles:
- BORDER
- Events:
- (none)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.swt.widgets.Buttonbuttonprivate org.eclipse.swt.widgets.Compositecontentprivate java.util.List<org.eclipse.swt.events.SelectionListener>selectionListenersprivate booleantransparent
-
Constructor Summary
Constructors Constructor Description CheckBoxGroup(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 voidactivate()Activate the contentvoidaddSelectionListener(org.eclipse.swt.events.SelectionListener listener)Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in theSelectionListenerinterface.private voidcreateCheckBoxButton()voiddeactivate()Deactivate the contentprivate voiddrawWidget(org.eclipse.swt.graphics.GC gc)Draws the widgetprivate booleanfireSelectionListeners(org.eclipse.swt.events.SelectionEvent selectionEvent)Fire the selection listenersorg.eclipse.swt.widgets.CompositegetContent()org.eclipse.swt.graphics.FontgetFont()org.eclipse.swt.widgets.LayoutgetLayout()booleangetSelection()Returnstrueif the receiver is selected, and false otherwisejava.lang.StringgetText()booleanisActivated()booleanisTransparent()voidpaintControl(org.eclipse.swt.events.PaintEvent paintEvent)voidremoveSelectionListener(org.eclipse.swt.events.SelectionListener listener)Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.booleansetFocus()voidsetFont(org.eclipse.swt.graphics.Font font)voidsetLayout(org.eclipse.swt.widgets.Layout layout)voidsetSelection(boolean selection)Sets the selection state of the receivervoidsetText(java.lang.String text)voidsetTransparent(boolean transparent)-
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, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, 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, 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, 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
-
-
-
-
Constructor Detail
-
CheckBoxGroup
public CheckBoxGroup(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 widget which will be the parent of the new instance (cannot be null)style- the style of widget 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
- See Also:
Composite(Composite, int),SWT.BORDER,Widget.getStyle()
-
-
Method Detail
-
createCheckBoxButton
private void createCheckBoxButton()
-
fireSelectionListeners
private boolean fireSelectionListeners(org.eclipse.swt.events.SelectionEvent selectionEvent)
Fire the selection listeners- Parameters:
selectionEvent- mouse event- Returns:
- true if the selection could be changed, false otherwise
-
activate
public void activate()
Activate the content
-
addSelectionListener
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in theSelectionListenerinterface.When
widgetSelectedis called, the item field of the event object is valid. If the receiver has theSWT.CHECKstyle and the check selection changes, the event object detail field contains the valueSWT.CHECK.widgetDefaultSelectedis typically called when an item is double-clicked. The item field of the event object is valid for default selection, but the detail field is not used.- Parameters:
listener- the listener which should be notified when the user changes the receiver's selection- 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:
SelectionListener,removeSelectionListener(org.eclipse.swt.events.SelectionListener),SelectionEvent
-
deactivate
public void deactivate()
Deactivate the content
-
isActivated
public boolean isActivated()
- Returns:
trueif the content is activated,falseotherwise
-
getLayout
public org.eclipse.swt.widgets.Layout getLayout()
- Overrides:
getLayoutin classorg.eclipse.swt.widgets.Composite- See Also:
Composite.getLayout()
-
removeSelectionListener
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.- 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:
SelectionListener,addSelectionListener(org.eclipse.swt.events.SelectionListener)
-
setFocus
public boolean setFocus()
- Overrides:
setFocusin classorg.eclipse.swt.widgets.Composite- See Also:
Composite.setFocus()
-
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)
-
getText
public java.lang.String getText()
- Returns:
- the text of the button
-
setText
public void setText(java.lang.String text)
- Parameters:
text- the text of the button to set
-
getFont
public org.eclipse.swt.graphics.Font getFont()
- Overrides:
getFontin classorg.eclipse.swt.widgets.Control- Returns:
- the font of the button
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)
- Overrides:
setFontin classorg.eclipse.swt.widgets.Canvas- Parameters:
font- the font to set
-
getContent
public org.eclipse.swt.widgets.Composite getContent()
- Returns:
- the content of the group
-
isTransparent
public boolean isTransparent()
-
setTransparent
public void setTransparent(boolean transparent)
-
paintControl
public void paintControl(org.eclipse.swt.events.PaintEvent paintEvent)
- Specified by:
paintControlin interfaceorg.eclipse.swt.events.PaintListener
-
drawWidget
private void drawWidget(org.eclipse.swt.graphics.GC gc)
Draws the widget
-
setSelection
public void setSelection(boolean selection)
Sets the selection state of the receiver- Parameters:
selection- the new selection state
-
getSelection
public boolean getSelection()
Returnstrueif the receiver is selected, and false otherwise- Returns:
- the selection state
-
-