org.eclipse.ercp.swt.mobile
Class HyperLink

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.ercp.swt.mobile.HyperLink
All Implemented Interfaces:
Drawable

public class HyperLink
extends Control

Instances of this class represent a selectable user interface object that launchs other applications when activated by the end-user.

This class represents several types of hyperlinks associated with certain functionalities. The end-user can activate the associated program determined by the style. The concrete visual effect and activation behavior vary from platform to platform.

A HyperLink instance accepts general characters as other controls do, but the appearance is implementation and locale dependent, for example, a HyperLink object with the PHONE style might display as follows:
(416) 123-4567
but the actual contents of the object visible to the application through the APIs, e.g. getText(), can be the string "4161234567".

Example

 HyperLink email = new HyperLink(composite, SWT.NONE, HyperLink.EMAIL);
 email.setText("[email protected]");
 HyperLink dialer = new HyperLink(composite, SWT.BORDER | SWT.LEFT,
 		HyperLink.PHONE);
 dialer.setText("3581234567");
 

Styles:
BORDER, CENTER, LEFT, RIGHT
Format Styles:
URL: launches a platform specific web browser when activated
EMAIL: opens the platform specific e-mail client when activated
PHONE: shows a platform specific dialer interface when activated
Events:
(none)

Note: Since the style provides hint for the implementation, there is no event that applications need to listen to.

IMPORTANT: This class is not intended to be subclassed.


Field Summary
static int EMAIL
          opens the implementation-dependent e-mail client when activated.
static int PHONE
          shows the implementation-dependent dialer interface when activated.
static int URL
          launches a implementation-dependent web browser when activated.
 
Constructor Summary
HyperLink(Composite parent, int style, int format)
          Constructs a new instance of this class given its parent, a style value and a format value describing its behavior and appearance.
 
Method Summary
 java.lang.String getText()
          Returns the receiver's text, which will be an empty string if it has never been set.
 void setText(java.lang.String string)
          Sets the receiver's text.
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addKeyListener, addMouseListener, addMouseMoveListener, addPaintListener, addTraverseListener, computeSize, computeSize, forceFocus, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setEnabled, setFocus, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

URL

public static final int URL
launches a implementation-dependent web browser when activated.

See Also:
Constant Field Values

EMAIL

public static final int EMAIL
opens the implementation-dependent e-mail client when activated.

See Also:
Constant Field Values

PHONE

public static final int PHONE
shows the implementation-dependent dialer interface when activated.

See Also:
Constant Field Values
Constructor Detail

HyperLink

public HyperLink(Composite parent,
                 int style,
                 int format)
Constructs a new instance of this class given its parent, a style value and a format 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.

The format value must be one of URL, EMAIL and PHONE.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
format - the format value.
Throws:
java.lang.IllegalArgumentException -
SWTException -
See Also:
SWT.BORDER, SWT.CENTER, SWT.LEFT, SWT.RIGHT, URL, EMAIL, PHONE
Method Detail

getText

public java.lang.String getText()
Returns the receiver's text, which will be an empty string if it has never been set.

Returns:
the receiver's text
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
setText(String)

setText

public void setText(java.lang.String string)
Sets the receiver's text.

This method sets the link text.

Parameters:
string - the new text
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the text is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
getText()