Class SwtLightComposite

    • Constructor Detail

      • SwtLightComposite

        public SwtLightComposite​(org.eclipse.swt.widgets.Composite swtComposite)
        Instantiates a new SWT light composite.
        Parameters:
        swtComposite - the SWT composite to attach the light controls support to.
    • Method Detail

      • getSwtLightComposite

        public static SwtLightComposite getSwtLightComposite​(org.eclipse.swt.widgets.Widget widget)
        Obtains the SwtLightComposite for a given widget.
        Parameters:
        widget - the widget to obtain composite of.
        Returns:
        obtained SwtLightComposite if the given widget has an associated SWT light composite, null otherwise.
      • getHostSwtLightComposite

        public static SwtLightComposite getHostSwtLightComposite​(ILightControl control)
        Obtains the hosting SwtLightComposite for the given light control.
        Parameters:
        control - control to obtain the hosting composite of.
        Returns:
        SwtLightComposite if control is hosted inside one, null otherwise.
      • setDesignMode

        public void setDesignMode​(boolean designMode)
      • isDesignMode

        public boolean isDesignMode()
      • getSwtComposite

        public org.eclipse.swt.widgets.Composite getSwtComposite()
        Gets the associated SWT composite.
        Returns:
        the SWT composite.
      • addChild

        public <T extends org.eclipse.swt.widgets.Control> T addChild​(T swtControl)
        Adds the native SWT control to this SWT light composite.
        Parameters:
        swtControl - the SWT control to add.
        Returns:
        the added SWT control.
      • 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 interface ILightControl
        Overrides:
        setBounds in class SwtLightControl
        Parameters:
        bounds - the new bounds.
      • getChildCount

        public int getChildCount()
        Description copied from interface: ILightComposite
        Gets the child count.
        Specified by:
        getChildCount in interface ILightComposite
        Returns:
        the number of 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 interface ILightComposite
        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 interface ILightComposite
        Parameters:
        control - the control to add.
        index - the index to add the control at.
        Returns:
        the control added.
      • 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 interface ILightComposite
        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.
      • 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 interface ILightControl
        Overrides:
        paint in class SwtLightControl
        Parameters:
        gc - the GC to paint on.
        rectangle - the rectangle to paint.
      • 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 interface ILightComposite
        Parameters:
        gc - the GC to do the measurements with.
      • setFocus

        public boolean setFocus​(FocusSource focusSource)
        Description copied from interface: ILightControl
        Sets the focus to this control.
        Specified by:
        setFocus in interface ILightControl
        Overrides:
        setFocus in class SwtLightControl
        Parameters:
        focusSource - the focus request source.
        Returns:
        true if focus was set, false otherwise.
      • 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 interface ILightComposite
        Parameters:
        control - the new active control.
      • 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 interface ILightComposite
        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 interface ILightComposite
        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.
      • 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 interface ILightComposite
        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 interface ILightComposite
        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 interface ILightComposite
        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 interface ILightComposite
        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.
      • controlFromPoint

        public ILightControl controlFromPoint​(int x,
                                              int y)
        Description copied from interface: ILightComposite
        Finds the control under the given point.
        Specified by:
        controlFromPoint in interface ILightComposite
        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.
      • revealRectangle

        public void revealRectangle​(org.eclipse.swt.graphics.Rectangle rectangle,
                                    boolean partial,
                                    boolean recursive)
        Specified by:
        revealRectangle in interface ILightComposite
      • setCursor

        public void setCursor​(org.eclipse.swt.graphics.Cursor cursor)
        Description copied from interface: ILightControl
        Sets the cursor of this control.
        Specified by:
        setCursor in interface ILightControl
        Overrides:
        setCursor in class SwtLightControl
        Parameters:
        cursor - the new cursor or null to reset to default cursor.
      • getCursor

        public org.eclipse.swt.graphics.Cursor getCursor()
        Description copied from interface: ILightControl
        Gets the cursor of this control.
        Specified by:
        getCursor in interface ILightControl
        Overrides:
        getCursor in class SwtLightControl
        Returns:
        the cursor or null if no cursor was set.
      • disposed

        protected void disposed()
        Description copied from class: SwtLightControl
        Invoked when the control is disposed from the SWT side. In other words, the native SWT control is disposed at this point and we do not need to dispose it again. Override this method to customize the detaching logic, it is a good place to remove listeners from the native SWT control and stuff like that.
        Overrides:
        disposed in class SwtLightControl