Class LauncherLabel

  • All Implemented Interfaces:
    org.eclipse.swt.graphics.Drawable

    class LauncherLabel
    extends org.eclipse.swt.widgets.Canvas
    Instance of this class are a button with text, image and a nice animation effect
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int animationStep  
      private int bottomMargin  
      private static int DEFAULT_MARGIN  
      private static int DRAW_FLAGS  
      private org.eclipse.swt.graphics.Font font  
      private static int GAP  
      private org.eclipse.swt.graphics.Image image  
      private int leftMargin  
      private static int MAX_NUMBER_OF_STEPS  
      private int rightMargin  
      private java.lang.String text  
      private org.eclipse.swt.graphics.Point textSize  
      private int topMargin  
      • Fields inherited from class org.eclipse.swt.widgets.Composite

        embeddedHandle
      • Fields inherited from class org.eclipse.swt.widgets.Widget

        handle
    • Constructor Summary

      Constructors 
      Constructor Description
      LauncherLabel​(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
      org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)  
      int getBottomMargin()  
      org.eclipse.swt.graphics.Font getFont()  
      (package private) org.eclipse.swt.graphics.Image getImage()  
      int getLeftMargin()  
      int getRightMargin()  
      (package private) java.lang.String getText()  
      int getTopMargin()  
      private org.eclipse.swt.graphics.Point getTotalSize​(int imgWidth, int imgHeight)
      Compute the size of the content (image + text + gap)
      (package private) boolean incrementAnimation()
      Increment the steps of the animation
      private void onPaint​(org.eclipse.swt.events.PaintEvent event)
      Draw the content of the LLabel
      void setBottomMargin​(int bottomMargin)  
      void setFont​(org.eclipse.swt.graphics.Font font)  
      (package private) void setImage​(org.eclipse.swt.graphics.Image image)  
      void setLeftMargin​(int leftMargin)  
      void setRightMargin​(int rightMargin)  
      (package private) void setText​(java.lang.String text)  
      void setTopMargin​(int topMargin)  
      • 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, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, 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, 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • text

        private java.lang.String text
      • image

        private org.eclipse.swt.graphics.Image image
      • font

        private org.eclipse.swt.graphics.Font font
      • DRAW_FLAGS

        private static int DRAW_FLAGS
      • leftMargin

        private int leftMargin
      • topMargin

        private int topMargin
      • rightMargin

        private int rightMargin
      • bottomMargin

        private int bottomMargin
      • textSize

        private org.eclipse.swt.graphics.Point textSize
      • animationStep

        private int animationStep
    • Constructor Detail

      • LauncherLabel

        LauncherLabel​(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 SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

        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
    • Method Detail

      • onPaint

        private void onPaint​(org.eclipse.swt.events.PaintEvent event)
        Draw the content of the LLabel
        Parameters:
        event - paintevent
      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(int wHint,
                                                          int hHint,
                                                          boolean changed)
        Overrides:
        computeSize in class org.eclipse.swt.widgets.Control
        See Also:
        Control.computeSize(int, int, boolean)
      • getTotalSize

        private org.eclipse.swt.graphics.Point getTotalSize​(int imgWidth,
                                                            int imgHeight)
        Compute the size of the content (image + text + gap)
        Parameters:
        imgWidth - image width
        imgHeight - image height
        Returns:
        the size of the content
      • getText

        java.lang.String getText()
        Returns:
        the text
      • setText

        void setText​(java.lang.String text)
        Parameters:
        text - the text to set
      • getImage

        org.eclipse.swt.graphics.Image getImage()
        Returns:
        the image
      • setImage

        void setImage​(org.eclipse.swt.graphics.Image image)
        Parameters:
        image - the image to set
      • getFont

        public org.eclipse.swt.graphics.Font getFont()
        Overrides:
        getFont in class org.eclipse.swt.widgets.Control
        Returns:
        the font
      • setFont

        public void setFont​(org.eclipse.swt.graphics.Font font)
        Overrides:
        setFont in class org.eclipse.swt.widgets.Canvas
        Parameters:
        font - the font to set
      • incrementAnimation

        boolean incrementAnimation()
        Increment the steps of the animation
        Returns:
        true if animation keeps running, false otherwise
      • getLeftMargin

        public int getLeftMargin()
        Returns:
        the left margin
      • setLeftMargin

        public void setLeftMargin​(int leftMargin)
        Parameters:
        leftMargin - the left margin to set
      • getTopMargin

        public int getTopMargin()
        Returns:
        the top margin
      • setTopMargin

        public void setTopMargin​(int topMargin)
        Parameters:
        topMargin - the top margin to set
      • getRightMargin

        public int getRightMargin()
        Returns:
        the right margin
      • setRightMargin

        public void setRightMargin​(int rightMargin)
        Parameters:
        rightMargin - the right margin to set
      • getBottomMargin

        public int getBottomMargin()
        Returns:
        the bottom margin
      • setBottomMargin

        public void setBottomMargin​(int bottomMargin)
        Parameters:
        bottomMargin - the bottom margin to set