Package com._1c.g5.lwt.controls
Class LightCheckbox
- java.lang.Object
-
- com._1c.g5.lwt.AbstractLightControl
-
- com._1c.g5.lwt.controls.LightCheckbox
-
- All Implemented Interfaces:
IEditable
,ILightControl
public class LightCheckbox extends AbstractLightControl implements IEditable
Light checkbox control.
-
-
Constructor Summary
Constructors Constructor Description LightCheckbox()
Instantiates a new light checkbox.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStateChangedListener(IChangedListener<LightCheckbox,Boolean> listener)
Adds the state changed listener.org.eclipse.swt.graphics.Point
computeSize(org.eclipse.swt.graphics.GC gc, int width, int height, boolean flushCache)
Computes the size of this control.org.eclipse.swt.graphics.Color
getBackgroundColor()
Returns checkbox background color.org.eclipse.swt.graphics.Color
getBorderColor()
Returns checkbox border color.protected org.eclipse.swt.graphics.Image
getCheckImage()
Returns image to use when checkbox is checked.protected org.eclipse.swt.graphics.Image
getDisabledCheckImage()
Returns image to use when checkbox is checked and disabled.protected org.eclipse.swt.graphics.Image
getDisabledGrayedImage()
Returns image to use when checkbox is grayed and disabled.protected org.eclipse.swt.graphics.Image
getGrayedImage()
Returns image to use when checkbox is grayed.String
getText()
Returns checkbox text.void
handleEvent(org.eclipse.swt.widgets.Event event)
Handles the SWT event, SWT events are pumped to this method if this control is active.boolean
isChecked()
This checkbox check state.boolean
isEditable()
Returns control editable state.boolean
isGrayed()
This checkbox grayed state.void
paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Paints the given rectangle of this control.void
removeStateChangedListener(IChangedListener<LightCheckbox,Boolean> listener)
Removes the state changed listener.void
setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
Sets the background color.void
setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the border color.void
setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the bounds of this control.void
setChecked(boolean checked)
Sets the check state of this checkbox.void
setEditable(boolean isEditable)
Sets control editable state.boolean
setFocus(FocusSource focusSource)
Sets the focus to this control.void
setGrayed(boolean grayed)
Sets the grayed state of this checkbox.void
setText(String text)
Sets this checkbox text.-
Methods inherited from class com._1c.g5.lwt.AbstractLightControl
addControlListener, dispose, getBounds, getCursor, getData, getLayoutData, getOverlay, getParent, getTooltip, getVisibleBounds, invalidate, invalidate, isDisposed, isEnabled, isFocused, isVisible, removeControlListener, setCursor, setData, setEnabled, setFocusable, setLayoutData, setOverlay, setParent, setTooltip, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com._1c.g5.lwt.ILightControl
initialize
-
-
-
-
Method Detail
-
getText
public String getText()
Returns checkbox text.- Returns:
- checkbox text, cannot be
null
.
-
isChecked
public boolean isChecked()
This checkbox check state.- Returns:
true
if checked,false
if unchecked.
-
isGrayed
public boolean isGrayed()
This checkbox grayed state.- Returns:
true
if grayed,false
if not.
-
isEditable
public boolean isEditable()
Description copied from interface:IEditable
Returns control editable state.- Specified by:
isEditable
in interfaceIEditable
- Returns:
true
if control can be edited.
-
getBorderColor
public org.eclipse.swt.graphics.Color getBorderColor()
Returns checkbox border color.- Returns:
- checkbox border color, can be
null
.
-
getBackgroundColor
public org.eclipse.swt.graphics.Color getBackgroundColor()
Returns checkbox background color.- Returns:
- checkbox background color, can be
null
.
-
setText
public void setText(String text)
Sets this checkbox text.- Parameters:
text
- the text to set.
-
setChecked
public void setChecked(boolean checked)
Sets the check state of this checkbox.- Parameters:
checked
-true
if checked,false
if unchecked.
-
setGrayed
public void setGrayed(boolean grayed)
Sets the grayed state of this checkbox.- Parameters:
grayed
-true
if grayed,false
if not.
-
setEditable
public void setEditable(boolean isEditable)
Description copied from interface:IEditable
Sets control editable state.- Specified by:
setEditable
in interfaceIEditable
- Parameters:
isEditable
- -true
if control can be edited.
-
setBorderColor
public void setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the border color.- Parameters:
borderColor
- the new border color.
-
setBackgroundColor
public void setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
Sets the background color.- Parameters:
backgroundColor
- the new background color.
-
addStateChangedListener
public void addStateChangedListener(IChangedListener<LightCheckbox,Boolean> listener)
Adds the state changed listener.- Parameters:
listener
- the listener to add.
-
removeStateChangedListener
public void removeStateChangedListener(IChangedListener<LightCheckbox,Boolean> listener)
Removes the state changed listener.- Parameters:
listener
- the listener to remove.
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Description copied from interface:ILightControl
Paints the given rectangle of this control.- Specified by:
paint
in interfaceILightControl
- Parameters:
gc
- theGC
to paint on.rectangle
- the rectangle to paint.
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC gc, int width, int height, boolean flushCache)
Description copied from interface:ILightControl
Computes the size of this control.- Specified by:
computeSize
in interfaceILightControl
- Overrides:
computeSize
in classAbstractLightControl
- Parameters:
gc
- the GC to do measurements with.width
- the width hint,SWT.DEFAULT
to compute the preferred width.height
- the height hint,SWT.DEFAULT
to compute the preferred height.flushCache
- the flush cache flag, instructs the associated layout to reset all its caches, if any.- Returns:
- the computed size.
-
setBounds
public void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Description copied from interface:ILightControl
Sets the bounds of this control.- Specified by:
setBounds
in interfaceILightControl
- Overrides:
setBounds
in classAbstractLightControl
- Parameters:
bounds
- the new bounds.
-
setFocus
public boolean setFocus(FocusSource focusSource)
Description copied from interface:ILightControl
Sets the focus to this control.- Specified by:
setFocus
in interfaceILightControl
- Overrides:
setFocus
in classAbstractLightControl
- Parameters:
focusSource
- the focus request source.- Returns:
true
if focus was set,false
otherwise.
-
handleEvent
public void handleEvent(org.eclipse.swt.widgets.Event event)
Description copied from interface:ILightControl
Handles the SWT event, SWT events are pumped to this method if this control is active.- Specified by:
handleEvent
in interfaceILightControl
- Overrides:
handleEvent
in classAbstractLightControl
- Parameters:
event
- the event to handle.- See Also:
ILightComposite.setActiveControl(ILightControl)
-
getCheckImage
protected org.eclipse.swt.graphics.Image getCheckImage()
Returns image to use when checkbox is checked.- Returns:
- the image to use when checkbox is checked, cannot be
null
-
getDisabledCheckImage
protected org.eclipse.swt.graphics.Image getDisabledCheckImage()
Returns image to use when checkbox is checked and disabled.- Returns:
- the image to use when checkbox is checked and disabled, cannot be
null
-
getGrayedImage
protected org.eclipse.swt.graphics.Image getGrayedImage()
Returns image to use when checkbox is grayed.- Returns:
- the image to use when checkbox is grayed, cannot be
null
-
getDisabledGrayedImage
protected org.eclipse.swt.graphics.Image getDisabledGrayedImage()
Returns image to use when checkbox is grayed and disabled.- Returns:
- the image to use when checkbox is grayed and disabled, cannot be
null
-
-