Class LauncherLabel
- 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.launcher.LauncherLabel
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
class LauncherLabel extends org.eclipse.swt.widgets.CanvasInstance of this class are a button with text, image and a nice animation effect
-
-
Field Summary
Fields Modifier and Type Field Description private intanimationStepprivate intbottomMarginprivate static intDEFAULT_MARGINprivate static intDRAW_FLAGSprivate org.eclipse.swt.graphics.Fontfontprivate static intGAPprivate org.eclipse.swt.graphics.Imageimageprivate intleftMarginprivate static intMAX_NUMBER_OF_STEPSprivate intrightMarginprivate java.lang.Stringtextprivate org.eclipse.swt.graphics.PointtextSizeprivate inttopMargin
-
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.PointcomputeSize(int wHint, int hHint, boolean changed)intgetBottomMargin()org.eclipse.swt.graphics.FontgetFont()(package private) org.eclipse.swt.graphics.ImagegetImage()intgetLeftMargin()intgetRightMargin()(package private) java.lang.StringgetText()intgetTopMargin()private org.eclipse.swt.graphics.PointgetTotalSize(int imgWidth, int imgHeight)Compute the size of the content (image + text + gap)(package private) booleanincrementAnimation()Increment the steps of the animationprivate voidonPaint(org.eclipse.swt.events.PaintEvent event)Draw the content of the LLabelvoidsetBottomMargin(int bottomMargin)voidsetFont(org.eclipse.swt.graphics.Font font)(package private) voidsetImage(org.eclipse.swt.graphics.Image image)voidsetLeftMargin(int leftMargin)voidsetRightMargin(int rightMargin)(package private) voidsetText(java.lang.String text)voidsetTopMargin(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
-
-
-
-
Field Detail
-
text
private java.lang.String text
-
image
private org.eclipse.swt.graphics.Image image
-
font
private org.eclipse.swt.graphics.Font font
-
GAP
private static final int GAP
- See Also:
- Constant Field Values
-
DRAW_FLAGS
private static int DRAW_FLAGS
-
DEFAULT_MARGIN
private static final int DEFAULT_MARGIN
- See Also:
- Constant Field Values
-
leftMargin
private int leftMargin
-
topMargin
private int topMargin
-
rightMargin
private int rightMargin
-
bottomMargin
private int bottomMargin
-
textSize
private org.eclipse.swt.graphics.Point textSize
-
MAX_NUMBER_OF_STEPS
private static final int MAX_NUMBER_OF_STEPS
- See Also:
- Constant Field Values
-
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
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 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:
computeSizein classorg.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 widthimgHeight- 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:
getFontin classorg.eclipse.swt.widgets.Control- Returns:
- the font
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)
- Overrides:
setFontin classorg.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
-
-