Class VControl

java.lang.Object
org.eclipse.nebula.cwt.v.VControl
Direct Known Subclasses:
VButton, VLabel, VNative, VPanel, VSpacer

public abstract class VControl
extends java.lang.Object
A VControl is a class wich wraps an SWT Button to create a widget that acts as much like a native Button as possible while adding the following features:
  • The appearance of Label when the mouse is not over it and it does not have the focus or selection (if style is SWT.TOGGLE).
  • Can fit seemlessly into a larger visual piece - simple set the image to that of its background and adjust the image's offset if necessary.
  • Can draw polygons and ovals.
  • Can center or otherwise align its visual display (text, image, polygon or oval).
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  VControl.Type  
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) org.eclipse.swt.graphics.Color background  
    (package private) org.eclipse.swt.graphics.Rectangle bounds  
    static boolean carbon
    true if the platform is Carbon, false otherwise
    (package private) org.eclipse.swt.widgets.Composite composite  
    (package private) boolean customToolTip  
    (package private) java.util.Map<java.lang.String,​java.lang.Object> dataMap  
    (package private) boolean disposed  
    (package private) org.eclipse.swt.graphics.Color fill  
    (package private) org.eclipse.swt.graphics.Font font  
    (package private) org.eclipse.swt.graphics.Color foreground  
    static boolean gtk
    true if the platform is GTK, false otherwise
    (package private) org.eclipse.swt.graphics.Image image  
    (package private) org.eclipse.swt.layout.GridData layoutData  
    (package private) java.util.Map<java.lang.Integer,​java.util.List<org.eclipse.swt.widgets.Listener>> listeners  
    (package private) int marginBottom  
    (package private) int marginLeft  
    (package private) int marginRight  
    (package private) int marginTop  
    (package private) org.eclipse.swt.widgets.Menu menu  
    (package private) IControlPainter painter  
    (package private) VPanel parent  
    (package private) int[] points  
    (package private) boolean scaleImage  
    (package private) boolean square  
    static int STATE_ACTIVE  
    static int STATE_ENABLED  
    static int STATE_MOUSE_DOWN  
    static int STATE_SELECTED  
    (package private) SvgDocument svg  
    (package private) java.lang.String text  
    (package private) java.lang.String tooltipText  
    (package private) int visibility  
    static boolean win32
    true if the platform is Win32, false otherwise
    (package private) int xAlign  
    (package private) int yAlign  
  • Constructor Summary

    Constructors 
    Constructor Description
    VControl​(VPanel panel, int style)
    Javadoc out of date // TODO: update javadoc
  • Method Summary

    Modifier and Type Method Description
    (package private) void activate()  
    (package private) void addListener​(int eventType)  
    void addListener​(int eventType, org.eclipse.swt.widgets.Listener listener)  
    (package private) void attachListeners​(boolean keyListeners)  
    org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint)  
    org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)  
    protected static boolean containsControl​(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Composite composite)  
    org.eclipse.swt.widgets.Menu createMenu()  
    (package private) void deactivate()  
    (package private) void detachListeners​(boolean keyListeners)  
    void dispose()  
    protected void filterEvent​(org.eclipse.swt.widgets.Event event)  
    org.eclipse.swt.graphics.Color getBackground()  
    org.eclipse.swt.graphics.Rectangle getBounds()  
    org.eclipse.swt.graphics.Rectangle getClientArea()  
    org.eclipse.swt.graphics.Point getClientSize()  
    org.eclipse.swt.widgets.Composite getComposite()  
    org.eclipse.swt.widgets.Control getControl()  
    java.lang.Object getData​(java.lang.Enum<?> name)  
    <T> T getData​(java.lang.Enum<?> name, java.lang.Class<T> clazz)  
    java.lang.Object getData​(java.lang.String name)  
    <T> T getData​(java.lang.String name, java.lang.Class<T> clazz)  
    org.eclipse.swt.widgets.Display getDisplay()  
    boolean getEnabled()  
    org.eclipse.swt.graphics.Font getFont()  
    org.eclipse.swt.graphics.Color getForeground()  
    org.eclipse.swt.graphics.Image getImage()  
    org.eclipse.swt.layout.GridData getLayoutData()  
    protected org.eclipse.swt.widgets.Listener[] getListeners​(int eventType)  
    org.eclipse.swt.graphics.Point getLocation()  
    org.eclipse.swt.graphics.Rectangle getMargins()  
    org.eclipse.swt.widgets.Menu getMenu()  
    VPanel getParent()  
    org.eclipse.swt.widgets.Shell getShell()  
    org.eclipse.swt.graphics.Point getSize()  
    int getState()  
    int getStyle()  
    java.lang.String getText()  
    java.lang.String getToolTipText()  
    abstract VControl.Type getType()  
    int getVisibility()  
    boolean getVisible()  
    org.eclipse.swt.widgets.Composite getWidget()  
    (package private) void handleEvent​(org.eclipse.swt.widgets.Event event)  
    boolean hasState​(int state)  
    boolean hasStyle​(int style)  
    boolean isActivatable()  
    boolean isDisposed()  
    boolean isEnabled()  
    boolean isSameWidgetAs​(VControl control)  
    boolean isSameWidgetAs​(org.eclipse.swt.widgets.Widget widget)  
    boolean isSquare()  
    boolean isVisible()  
    void moveAbove​(VControl control)  
    void moveBelow​(VControl control)  
    void notifyListeners​(int eventType)  
    void notifyListeners​(int eventType, org.eclipse.swt.widgets.Event event)  
    void paintControl​(org.eclipse.swt.widgets.Event e)  
    void redraw()  
    protected boolean redrawOnActivate()  
    protected boolean redrawOnDeactivate()  
    (package private) void removeListener​(int eventType)  
    void removeListener​(int eventType, org.eclipse.swt.widgets.Listener listener)  
    void setActivatable​(boolean activatable)  
    void setActiveCursor​(org.eclipse.swt.graphics.Cursor cursor)  
    void setAlignment​(int x, int y)  
    void setAlpha​(org.eclipse.swt.graphics.GC gc)  
    void setAlpha​(org.eclipse.swt.graphics.GC gc, int alpha)  
    void setBackground​(org.eclipse.swt.graphics.Color color)  
    void setBounds​(int x, int y, int width, int height)  
    void setBounds​(org.eclipse.swt.graphics.Rectangle bounds)  
    void setCursor​(org.eclipse.swt.graphics.Cursor cursor)  
    void setData​(java.lang.Enum<?> name, java.lang.Object value)  
    void setData​(java.lang.String name, java.lang.Object value)  
    void setEnabled​(boolean enabled)  
    void setFill​(org.eclipse.swt.graphics.Color color)  
    boolean setFocus()  
    protected boolean setFocus​(boolean focus)  
    void setFont​(org.eclipse.swt.graphics.Font font)  
    void setForeground​(org.eclipse.swt.graphics.Color color)  
    void setImage​(SvgDocument svg)  
    void setImage​(org.eclipse.swt.graphics.Image image)  
    void setInactiveCursor​(org.eclipse.swt.graphics.Cursor cursor)  
    void setLayoutData​(org.eclipse.swt.layout.GridData data)  
    void setLocation​(int x, int y)  
    void setLocation​(org.eclipse.swt.graphics.Point location)  
    void setMargins​(int marginWidth, int marginHeight)  
    void setMargins​(int left, int right, int top, int bottom)  
    void setMargins​(org.eclipse.swt.graphics.Rectangle margins)  
    void setOval​(int rx, int ry)  
    void setOval​(int rx, int ry, org.eclipse.swt.graphics.Color fillColor)  
    void setPainter​(IControlPainter painter)  
    void setParent​(VPanel panel)  
    void setPolygon​(int[] points)  
    void setPolygon​(int[] points, org.eclipse.swt.graphics.Color fillColor)  
    void setScaleImage​(boolean scale)  
    void setSize​(org.eclipse.swt.graphics.Point size)  
    void setSquare​(boolean equal)
    if parameter equal is true, the x and y sizes of this VControl will be forced equal, thus drawing a square button
    protected boolean setState​(int state, boolean set)  
    void setStyle​(int style)  
    boolean setStyle​(int style, boolean set)  
    void setText​(java.lang.String text)  
    void setToolTipText​(java.lang.String text)  
    (package private) void setVisibility​(int visibility)  
    void setVisible​(boolean visible)  
    void setVisible​(boolean visible, int duration)  
    void setVisible​(boolean visible, int duration, java.lang.Runnable callback)  
    org.eclipse.swt.graphics.Point toControl​(int x, int y)  
    org.eclipse.swt.graphics.Point toControl​(org.eclipse.swt.graphics.Point point)  
    org.eclipse.swt.graphics.Point toDisplay​(int x, int y)  
    org.eclipse.swt.graphics.Point toDisplay​(org.eclipse.swt.graphics.Point point)  
    java.lang.String toString()  
    void update()  

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • VControl

      public VControl​(VPanel panel, int style)
      Javadoc out of date // TODO: update javadoc
      Parameters:
      panel -
      style -
  • Method Details

    • containsControl

      protected static final boolean containsControl​(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Composite composite)
    • handleEvent

      void handleEvent​(org.eclipse.swt.widgets.Event event)
    • activate

      void activate()
    • addListener

      void addListener​(int eventType)
    • addListener

      public void addListener​(int eventType, org.eclipse.swt.widgets.Listener listener)
    • attachListeners

      void attachListeners​(boolean keyListeners)
    • detachListeners

      void detachListeners​(boolean keyListeners)
    • computeSize

      public org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint)
    • computeSize

      public org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)
    • createMenu

      public org.eclipse.swt.widgets.Menu createMenu()
    • deactivate

      void deactivate()
    • dispose

      public void dispose()
    • getBackground

      public org.eclipse.swt.graphics.Color getBackground()
    • getBounds

      public org.eclipse.swt.graphics.Rectangle getBounds()
    • getClientArea

      public org.eclipse.swt.graphics.Rectangle getClientArea()
    • getClientSize

      public org.eclipse.swt.graphics.Point getClientSize()
    • getComposite

      public org.eclipse.swt.widgets.Composite getComposite()
    • getControl

      public org.eclipse.swt.widgets.Control getControl()
    • getData

      public java.lang.Object getData​(java.lang.Enum<?> name)
    • getData

      public <T> T getData​(java.lang.Enum<?> name, java.lang.Class<T> clazz)
    • getData

      public java.lang.Object getData​(java.lang.String name)
    • getData

      public <T> T getData​(java.lang.String name, java.lang.Class<T> clazz)
    • getDisplay

      public org.eclipse.swt.widgets.Display getDisplay()
    • getEnabled

      public boolean getEnabled()
    • getFont

      public org.eclipse.swt.graphics.Font getFont()
    • getForeground

      public org.eclipse.swt.graphics.Color getForeground()
    • getImage

      public org.eclipse.swt.graphics.Image getImage()
    • getLayoutData

      public org.eclipse.swt.layout.GridData getLayoutData()
    • getListeners

      protected org.eclipse.swt.widgets.Listener[] getListeners​(int eventType)
    • getLocation

      public org.eclipse.swt.graphics.Point getLocation()
    • getMargins

      public org.eclipse.swt.graphics.Rectangle getMargins()
    • getMenu

      public org.eclipse.swt.widgets.Menu getMenu()
    • getParent

      public VPanel getParent()
    • getShell

      public org.eclipse.swt.widgets.Shell getShell()
    • getSize

      public org.eclipse.swt.graphics.Point getSize()
    • getState

      public int getState()
    • getStyle

      public int getStyle()
    • getText

      public java.lang.String getText()
      Returns:
      the text string displayed on this VControl
    • getToolTipText

      public java.lang.String getToolTipText()
    • getType

      public abstract VControl.Type getType()
    • getVisibility

      public int getVisibility()
    • getVisible

      public boolean getVisible()
    • getWidget

      public org.eclipse.swt.widgets.Composite getWidget()
    • filterEvent

      protected void filterEvent​(org.eclipse.swt.widgets.Event event)
    • hasState

      public boolean hasState​(int state)
    • hasStyle

      public boolean hasStyle​(int style)
    • isActivatable

      public boolean isActivatable()
    • isDisposed

      public boolean isDisposed()
    • isEnabled

      public boolean isEnabled()
    • isSameWidgetAs

      public boolean isSameWidgetAs​(VControl control)
    • isSameWidgetAs

      public boolean isSameWidgetAs​(org.eclipse.swt.widgets.Widget widget)
    • isSquare

      public boolean isSquare()
      Returns:
      true if this VControl is to be sized as a square
    • isVisible

      public boolean isVisible()
    • moveAbove

      public void moveAbove​(VControl control)
    • moveBelow

      public void moveBelow​(VControl control)
    • notifyListeners

      public void notifyListeners​(int eventType)
    • notifyListeners

      public void notifyListeners​(int eventType, org.eclipse.swt.widgets.Event event)
    • paintControl

      public final void paintControl​(org.eclipse.swt.widgets.Event e)
    • redraw

      public void redraw()
    • redrawOnActivate

      protected boolean redrawOnActivate()
    • redrawOnDeactivate

      protected boolean redrawOnDeactivate()
    • removeListener

      void removeListener​(int eventType)
    • removeListener

      public void removeListener​(int eventType, org.eclipse.swt.widgets.Listener listener)
    • setActivatable

      public void setActivatable​(boolean activatable)
    • setActiveCursor

      public void setActiveCursor​(org.eclipse.swt.graphics.Cursor cursor)
    • setAlignment

      public void setAlignment​(int x, int y)
      Parameters:
      x -
      y -
    • setAlpha

      public void setAlpha​(org.eclipse.swt.graphics.GC gc)
    • setAlpha

      public void setAlpha​(org.eclipse.swt.graphics.GC gc, int alpha)
    • setBackground

      public void setBackground​(org.eclipse.swt.graphics.Color color)
    • setBounds

      public void setBounds​(int x, int y, int width, int height)
    • setBounds

      public void setBounds​(org.eclipse.swt.graphics.Rectangle bounds)
    • setCursor

      public void setCursor​(org.eclipse.swt.graphics.Cursor cursor)
    • setData

      public void setData​(java.lang.Enum<?> name, java.lang.Object value)
    • setData

      public void setData​(java.lang.String name, java.lang.Object value)
    • setEnabled

      public void setEnabled​(boolean enabled)
    • setFill

      public void setFill​(org.eclipse.swt.graphics.Color color)
    • setFocus

      public boolean setFocus()
    • setFocus

      protected boolean setFocus​(boolean focus)
    • setFont

      public void setFont​(org.eclipse.swt.graphics.Font font)
    • setForeground

      public void setForeground​(org.eclipse.swt.graphics.Color color)
    • setImage

      public void setImage​(org.eclipse.swt.graphics.Image image)
    • setImage

      public void setImage​(SvgDocument svg)
    • setInactiveCursor

      public void setInactiveCursor​(org.eclipse.swt.graphics.Cursor cursor)
    • setLayoutData

      public void setLayoutData​(org.eclipse.swt.layout.GridData data)
    • setLocation

      public void setLocation​(org.eclipse.swt.graphics.Point location)
    • setLocation

      public void setLocation​(int x, int y)
    • setMargins

      public void setMargins​(int marginWidth, int marginHeight)
      Parameters:
      marginWidth -
      marginHeight -
    • setMargins

      public void setMargins​(int left, int right, int top, int bottom)
      Parameters:
      left -
      right -
      top -
      bottom -
    • setMargins

      public void setMargins​(org.eclipse.swt.graphics.Rectangle margins)
    • setOval

      public void setOval​(int rx, int ry)
    • setOval

      public void setOval​(int rx, int ry, org.eclipse.swt.graphics.Color fillColor)
    • setPainter

      public void setPainter​(IControlPainter painter)
    • setParent

      public void setParent​(VPanel panel)
    • setPolygon

      public void setPolygon​(int[] points)
    • setPolygon

      public void setPolygon​(int[] points, org.eclipse.swt.graphics.Color fillColor)
    • setScaleImage

      public void setScaleImage​(boolean scale)
    • setSize

      public void setSize​(org.eclipse.swt.graphics.Point size)
    • setSquare

      public void setSquare​(boolean equal)
      if parameter equal is true, the x and y sizes of this VControl will be forced equal, thus drawing a square button
      Parameters:
      equal -
    • setState

      protected boolean setState​(int state, boolean set)
    • setStyle

      public void setStyle​(int style)
    • setStyle

      public boolean setStyle​(int style, boolean set)
    • setText

      public void setText​(java.lang.String text)
      Parameters:
      text -
    • setToolTipText

      public void setToolTipText​(java.lang.String text)
    • setVisibility

      void setVisibility​(int visibility)
    • setVisible

      public void setVisible​(boolean visible)
    • setVisible

      public void setVisible​(boolean visible, int duration)
    • setVisible

      public void setVisible​(boolean visible, int duration, java.lang.Runnable callback)
    • toControl

      public org.eclipse.swt.graphics.Point toControl​(org.eclipse.swt.graphics.Point point)
    • toControl

      public org.eclipse.swt.graphics.Point toControl​(int x, int y)
    • toDisplay

      public org.eclipse.swt.graphics.Point toDisplay​(org.eclipse.swt.graphics.Point point)
    • toDisplay

      public org.eclipse.swt.graphics.Point toDisplay​(int x, int y)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • update

      public void update()