Package org.eclipse.ui.forms.widgets
Class Hyperlink
- All Implemented Interfaces:
Drawable
- Direct Known Subclasses:
ImageHyperlink
Hyperlink is a concrete implementation of the abstract base class that draws
text in the client area. Text can be wrapped and underlined. Hyperlink is
typically added to the hyperlink group so that certain properties are managed
for all the hyperlinks that belong to it.
Hyperlink can be extended.
- Styles:
- SWT.WRAP
- Since:
- 3.0
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.ui.forms.widgets.AbstractHyperlink
marginHeight, marginWidth
Fields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeSize
(int wHint, int hHint, boolean changed) Overrides the parent by incorporating the margin.protected Point
computeTextSize
(int wHint, int hHint) getText()
Returns the current hyperlink text.Returns the receiver's tool tip text, or null if it has not been set.protected void
boolean
Returns the underline state of the hyperlink.protected void
paintHyperlink
(GC gc) Paints the hyperlink text.protected void
Paints the hyperlink text in provided bounding rectangle.void
Sets the text of this hyperlink.void
setToolTipText
(String string) Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown.void
setUnderlined
(boolean underlined) Sets the underlined state.protected String
shortenText
(GC gc, String t, int width) Methods inherited from class org.eclipse.ui.forms.widgets.AbstractHyperlink
addHyperlinkListener, getHref, getSelection, handleActivate, handleEnter, handleExit, paint, removeHyperlinkListener, setEnabled, setHref
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, 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, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode
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, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, 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, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
Hyperlink
Creates a new hyperlink control in the provided parent.- Parameters:
parent
- the control parentstyle
- the widget style
-
-
Method Details
-
initAccessible
protected void initAccessible() -
setUnderlined
public void setUnderlined(boolean underlined) Sets the underlined state. It is not necessary to call this method when in a hyperlink group.- Parameters:
underlined
- if true , a line will be drawn below the text for each wrapped line.
-
isUnderlined
public boolean isUnderlined()Returns the underline state of the hyperlink.- Returns:
- true if text is underlined, false otherwise.
-
computeSize
Overrides the parent by incorporating the margin.- Overrides:
computeSize
in classControl
- Parameters:
wHint
- the width hint (can beSWT.DEFAULT
)hHint
- the height hint (can beSWT.DEFAULT
)changed
-true
if the control's contents have changed, andfalse
otherwise- Returns:
- the preferred size of the control.
- See Also:
-
Layout
Control.getBorderWidth()
Control.getBounds()
Control.getSize()
Control.pack(boolean)
- "computeTrim, getClientArea for controls that implement them"
-
getText
Returns the current hyperlink text.- Overrides:
getText
in classAbstractHyperlink
- Returns:
- hyperlink text
-
getToolTipText
Description copied from class:Control
Returns the receiver's tool tip text, or null if it has not been set.- Overrides:
getToolTipText
in classControl
- Returns:
- the receiver's tool tip text
-
setToolTipText
Description copied from class:Control
Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.
NOTE: This operation is a hint and behavior is platform specific, on Windows for CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltip.
- Overrides:
setToolTipText
in classControl
- Parameters:
string
- the new tool tip text (or null)
-
setText
Sets the text of this hyperlink.- Parameters:
text
- the hyperlink text
-
paintHyperlink
Paints the hyperlink text.- Specified by:
paintHyperlink
in classAbstractHyperlink
- Parameters:
gc
- graphic context
-
paintText
Paints the hyperlink text in provided bounding rectangle.- Parameters:
gc
- graphic contextbounds
- the bounding rectangle in which to paint the text
-
shortenText
-
computeTextSize
-