Package com._1c.g5.lwt
Class LightComposite
- java.lang.Object
-
- com._1c.g5.lwt.AbstractLightControl
-
- com._1c.g5.lwt.LightComposite
-
- All Implemented Interfaces:
ILightComposite
,ILightControl
- Direct Known Subclasses:
AbstractLightContentComposite
,AbstractLightScrollbar
,LightUpDownButton
public class LightComposite extends AbstractLightControl implements ILightComposite
Default implementation ofILightComposite
.
-
-
Constructor Summary
Constructors Constructor Description LightComposite()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends ILightControl>
TaddChild(T control)
Adds the child control to this composite.<T extends ILightControl>
TaddChild(T control, int index)
Adds the child control to this composite.<T extends ILightControl>
TaddChildAfter(T control, ILightControl sibling)
Adds the child control to this composite after the given sibling.void
addLayerAbove(ILightComposite layer, ILightComposite sibling)
void
addLayerBehind(ILightComposite layer, ILightComposite sibling)
org.eclipse.swt.graphics.Point
computeSize(org.eclipse.swt.graphics.GC gc, int width, int height, boolean flushCache)
Computes the size of this control.ILightControl
controlFromPoint(int x, int y)
Finds the control under the given point.void
dispose()
Disposes this control.ILightControl
getActiveControl()
Gets the active child control of this composite.int
getChildCount()
Gets the child count.Iterable<ILightControl>
getChildren()
Gets the children.Iterable<ILightComposite>
getLayers()
ILightLayout
getLayout()
Gets the layout of this composite.void
layout()
void
layout(org.eclipse.swt.graphics.GC gc)
Layouts this composite using its layout, if any.void
paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Paints the given rectangle of this control.ILightControl
removeChild(int index)
void
removeChild(ILightControl control)
Removes the child control.void
revealRectangle(org.eclipse.swt.graphics.Rectangle rectangle, boolean partial, boolean recursive)
void
setActiveControl(ILightControl control)
Sets the active control for this composite.void
setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the bounds of this control.boolean
setFocus(FocusSource focusSource)
Sets the focus to this control.void
setLayout(ILightLayout layout)
Sets the layout of this composite.org.eclipse.swt.graphics.Point
translatePointFromControl(ILightControl child, org.eclipse.swt.graphics.Point point)
Translate the point in the given child control coordinates to the coordinates of this composite.org.eclipse.swt.graphics.Point
translatePointToControl(ILightControl child, org.eclipse.swt.graphics.Point point)
Translate the point in the coordinates of this composite to the coordinates of the given child control.org.eclipse.swt.graphics.Rectangle
translateRectangleFromControl(ILightControl child, org.eclipse.swt.graphics.Rectangle rectangle)
Translate the rectangle in the given child control coordinates to the coordinates of this composite.org.eclipse.swt.graphics.Rectangle
translateRectangleToControl(ILightControl child, org.eclipse.swt.graphics.Rectangle rectangle)
Translate the rectangle in the coordinates of this composite to the coordinates of the given child control.boolean
traverse(ILightControl control, TraverseDirection direction)
Traverses this composite starting at the given control in the given direction.boolean
traverse(TraverseDirection direction)
Traverses this composite in the given direction.-
Methods inherited from class com._1c.g5.lwt.AbstractLightControl
addControlListener, getBounds, getCursor, getData, getLayoutData, getOverlay, getParent, getTooltip, getVisibleBounds, handleEvent, 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.ILightComposite
getMainLayer
-
Methods inherited from interface com._1c.g5.lwt.ILightControl
addControlListener, getBounds, getCursor, getData, getLayoutData, getParent, getTooltip, getVisibleBounds, handleEvent, initialize, invalidate, invalidate, isDisposed, isEnabled, isFocused, isVisible, removeControlListener, setCursor, setData, setEnabled, setLayoutData, setParent, setTooltip, setVisible
-
-
-
-
Method Detail
-
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.
-
getChildCount
public int getChildCount()
Description copied from interface:ILightComposite
Gets the child count.- Specified by:
getChildCount
in interfaceILightComposite
- Returns:
- the number of direct children of this composite.
-
getChildren
public Iterable<ILightControl> getChildren()
Description copied from interface:ILightComposite
Gets the children.- Specified by:
getChildren
in interfaceILightComposite
- Returns:
- the direct children of this composite.
-
addChild
public <T extends ILightControl> T addChild(T control)
Description copied from interface:ILightComposite
Adds the child control to this composite.- Specified by:
addChild
in interfaceILightComposite
- Parameters:
control
- the control to add.- Returns:
- the control added.
-
addChild
public <T extends ILightControl> T addChild(T control, int index)
Description copied from interface:ILightComposite
Adds the child control to this composite.- Specified by:
addChild
in interfaceILightComposite
- Parameters:
control
- the control to add.index
- the index to add the control at.- Returns:
- the control added.
-
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.
-
addChildAfter
public <T extends ILightControl> T addChildAfter(T control, ILightControl sibling)
Description copied from interface:ILightComposite
Adds the child control to this composite after the given sibling.- Specified by:
addChildAfter
in interfaceILightComposite
- Parameters:
control
- the control to add.sibling
- the sibling to add the control after,null
to prepend the control to the children.- Returns:
- the control added.
-
removeChild
public void removeChild(ILightControl control)
Description copied from interface:ILightComposite
Removes the child control.- Specified by:
removeChild
in interfaceILightComposite
- Parameters:
control
- the control to remove.
-
removeChild
public ILightControl removeChild(int index)
- Specified by:
removeChild
in interfaceILightComposite
-
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.
-
setActiveControl
public void setActiveControl(ILightControl control)
Description copied from interface:ILightComposite
Sets the active control for this composite. The given control may be the indirect child of this composite. This composite should not try to change the focus as the focus may be already set.- Specified by:
setActiveControl
in interfaceILightComposite
- Parameters:
control
- the new active control.
-
getActiveControl
public ILightControl getActiveControl()
Description copied from interface:ILightComposite
Gets the active child control of this composite.- Specified by:
getActiveControl
in interfaceILightComposite
- Returns:
- the active control.
- See Also:
ILightComposite.setActiveControl(com._1c.g5.lwt.ILightControl)
-
traverse
public boolean traverse(ILightControl control, TraverseDirection direction)
Description copied from interface:ILightComposite
Traverses this composite starting at the given control in the given direction.- Specified by:
traverse
in interfaceILightComposite
- Parameters:
control
- the control to start from.direction
- the direction to traverse in.- Returns:
true
if traversal was successful and the focus was set to one of the child controls,false
otherwise.
-
traverse
public boolean traverse(TraverseDirection direction)
Description copied from interface:ILightComposite
Traverses this composite in the given direction.- Specified by:
traverse
in interfaceILightComposite
- Parameters:
direction
- the direction to traverse in.- Returns:
true
if traversal was successful and the focus was set to one of the child controls,false
otherwise.
-
getLayout
public ILightLayout getLayout()
Description copied from interface:ILightComposite
Gets the layout of this composite.- Specified by:
getLayout
in interfaceILightComposite
- Returns:
- the associated layout or
null
if no layout is set.
-
setLayout
public void setLayout(ILightLayout layout)
Description copied from interface:ILightComposite
Sets the layout of this composite.- Specified by:
setLayout
in interfaceILightComposite
- Parameters:
layout
- the new layout.
-
layout
public void layout(org.eclipse.swt.graphics.GC gc)
Description copied from interface:ILightComposite
Layouts this composite using its layout, if any.- Specified by:
layout
in interfaceILightComposite
- Parameters:
gc
- theGC
to do the measurements with.
-
layout
public void layout()
-
controlFromPoint
public ILightControl controlFromPoint(int x, int y)
Description copied from interface:ILightComposite
Finds the control under the given point.- Specified by:
controlFromPoint
in interfaceILightComposite
- Parameters:
x
- the x coordinate of the point.y
- the y coordinate of the point.- Returns:
- found child control, this composite or
null
if nothing found under the point and this composite is transparent for the mouse events.
-
translatePointFromControl
public org.eclipse.swt.graphics.Point translatePointFromControl(ILightControl child, org.eclipse.swt.graphics.Point point)
Description copied from interface:ILightComposite
Translate the point in the given child control coordinates to the coordinates of this composite.- Specified by:
translatePointFromControl
in interfaceILightComposite
- Parameters:
child
- the child control to translate the point from or this composite.point
- the point to translate.- Returns:
- the translated point or
null
if the given child control is neither a child of this composite nor this composite.
-
translateRectangleFromControl
public org.eclipse.swt.graphics.Rectangle translateRectangleFromControl(ILightControl child, org.eclipse.swt.graphics.Rectangle rectangle)
Description copied from interface:ILightComposite
Translate the rectangle in the given child control coordinates to the coordinates of this composite.- Specified by:
translateRectangleFromControl
in interfaceILightComposite
- Parameters:
child
- the child to translate the rectangle from or this composite.rectangle
- the rectangle to translate.- Returns:
- the translated rectangle or
null
if the given child is neither a child of this composite nor this composite.
-
translatePointToControl
public org.eclipse.swt.graphics.Point translatePointToControl(ILightControl child, org.eclipse.swt.graphics.Point point)
Description copied from interface:ILightComposite
Translate the point in the coordinates of this composite to the coordinates of the given child control.- Specified by:
translatePointToControl
in interfaceILightComposite
- Parameters:
child
- the child to translate the point to or this composite.point
- the point to translate.- Returns:
- the translated point or
null
if the given child is neither a child of this composite nor this composite.
-
translateRectangleToControl
public org.eclipse.swt.graphics.Rectangle translateRectangleToControl(ILightControl child, org.eclipse.swt.graphics.Rectangle rectangle)
Description copied from interface:ILightComposite
Translate the rectangle in the coordinates of this composite to the coordinates of the given child control.- Specified by:
translateRectangleToControl
in interfaceILightComposite
- Parameters:
child
- the child to translate the point to or this composite.rectangle
- the rectangle to translate.- Returns:
- the translated rectangle or
null
if the given child is neither a child of this composite nor this composite.
-
getLayers
public Iterable<ILightComposite> getLayers()
- Specified by:
getLayers
in interfaceILightComposite
-
addLayerAbove
public void addLayerAbove(ILightComposite layer, ILightComposite sibling)
- Specified by:
addLayerAbove
in interfaceILightComposite
-
addLayerBehind
public void addLayerBehind(ILightComposite layer, ILightComposite sibling)
- Specified by:
addLayerBehind
in interfaceILightComposite
-
revealRectangle
public void revealRectangle(org.eclipse.swt.graphics.Rectangle rectangle, boolean partial, boolean recursive)
- Specified by:
revealRectangle
in interfaceILightComposite
-
dispose
public void dispose()
Description copied from interface:ILightControl
Disposes this control.- Specified by:
dispose
in interfaceILightControl
- Overrides:
dispose
in classAbstractLightControl
-
-