|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.FocusWidget
com.google.gwt.user.client.ui.Anchor
public class Anchor
A widget that represents a simple <a> element.
If you want use this anchor only for changing history states, use
Hyperlink instead.
setDirectionEstimator(boolean) or
passing a DirectionEstimator parameter to the constructor, and is off by
default.
Hyperlink| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
| Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment |
|---|
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant |
| Nested classes/interfaces inherited from interface com.google.gwt.i18n.client.HasDirection |
|---|
HasDirection.Direction |
| Field Summary | |
|---|---|
static DirectionEstimator |
DEFAULT_DIRECTION_ESTIMATOR
|
| Fields inherited from class com.google.gwt.user.client.ui.Widget |
|---|
eventsToSink |
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR |
| Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment |
|---|
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT |
| Constructor Summary | |
|---|---|
|
Anchor()
Creates an empty anchor. |
|
Anchor(boolean useDefaultHref)
Creates an anchor. |
protected |
Anchor(Element element)
This constructor may be used by subclasses to explicitly use an existing element. |
|
Anchor(SafeHtml html)
Creates an anchor for scripting. |
|
Anchor(SafeHtml html,
DirectionEstimator directionEstimator)
Creates an anchor for scripting. |
|
Anchor(SafeHtml html,
DirectionEstimator directionEstimator,
SafeUri href)
Creates an anchor with its html and href (target URL) specified. |
|
Anchor(SafeHtml html,
DirectionEstimator directionEstimator,
java.lang.String href)
Creates an anchor with its html and href (target URL) specified. |
|
Anchor(SafeHtml html,
HasDirection.Direction dir)
Creates an anchor for scripting. |
|
Anchor(SafeHtml html,
HasDirection.Direction dir,
SafeUri href)
Creates an anchor with its html and href (target URL) specified. |
|
Anchor(SafeHtml html,
HasDirection.Direction dir,
java.lang.String href)
Creates an anchor with its html and href (target URL) specified. |
|
Anchor(SafeHtml html,
SafeUri href)
Creates an anchor with its html and href (target URL) specified. |
|
Anchor(SafeHtml html,
SafeUri href,
java.lang.String target)
Creates a source anchor (link to URI). |
|
Anchor(SafeHtml html,
java.lang.String href)
Creates an anchor with its html and href (target URL) specified. |
|
Anchor(SafeHtml html,
java.lang.String href,
java.lang.String target)
Creates a source anchor (link to URI). |
|
Anchor(java.lang.String text)
Creates an anchor for scripting. |
|
Anchor(java.lang.String text,
boolean asHtml)
Creates an anchor for scripting. |
|
Anchor(java.lang.String text,
boolean asHTML,
java.lang.String href)
Creates an anchor with its text and href (target URL) specified. |
|
Anchor(java.lang.String text,
boolean asHtml,
java.lang.String href,
java.lang.String target)
Creates a source anchor (link to URI). |
|
Anchor(java.lang.String text,
DirectionEstimator directionEstimator)
Creates an anchor for scripting. |
|
Anchor(java.lang.String text,
DirectionEstimator directionEstimator,
java.lang.String href)
Creates an anchor with its text and href (target URL) specified. |
|
Anchor(java.lang.String text,
HasDirection.Direction dir)
Creates an anchor for scripting. |
|
Anchor(java.lang.String text,
HasDirection.Direction dir,
java.lang.String href)
Creates an anchor with its text and href (target URL) specified. |
|
Anchor(java.lang.String text,
java.lang.String href)
Creates an anchor with its text and href (target URL) specified. |
|
Anchor(java.lang.String text,
java.lang.String href,
java.lang.String target)
Creates a source anchor with a frame target. |
| Method Summary | |
|---|---|
HasDirection.Direction |
getDirection()
Gets the directionality of the widget. |
DirectionEstimator |
getDirectionEstimator()
Returns the DirectionEstimator object. |
HasHorizontalAlignment.HorizontalAlignmentConstant |
getHorizontalAlignment()
Gets the horizontal alignment. |
java.lang.String |
getHref()
Gets the anchor's href (the url to which it links). |
java.lang.String |
getHTML()
Gets this object's contents as HTML. |
java.lang.String |
getName()
Gets the widget's name. |
int |
getTabIndex()
Gets the tab index. |
java.lang.String |
getTarget()
Gets the anchor's target frame (the frame in which navigation will occur when the link is selected). |
java.lang.String |
getText()
Gets this object's text. |
HasDirection.Direction |
getTextDirection()
Gets the direction of this object's text. |
boolean |
getWordWrap()
Gets whether word-wrapping is enabled. |
void |
setAccessKey(char key)
Sets the widget's 'access key'. |
void |
setDirection(HasDirection.Direction direction)
Deprecated. Use setDirectionEstimator(boolean) and / or pass explicit
direction to setText(java.lang.String), setHTML(com.google.gwt.safehtml.shared.SafeHtml) instead |
void |
setDirectionEstimator(boolean enabled)
Toggles on / off direction estimation. |
void |
setDirectionEstimator(DirectionEstimator directionEstimator)
Sets the DirectionEstimator object. |
void |
setFocus(boolean focused)
Explicitly focus/unfocus this widget. |
void |
setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment. |
void |
setHref(SafeUri href)
Sets the anchor's href (the url to which it links). |
void |
setHref(java.lang.String href)
Sets the anchor's href (the url to which it links). |
void |
setHTML(SafeHtml html)
Sets this object's contents via known-safe HTML. |
void |
setHTML(SafeHtml html,
HasDirection.Direction dir)
Sets this object's html, also declaring its direction. |
void |
setHTML(java.lang.String html)
Sets this object's contents via HTML. |
void |
setName(java.lang.String name)
Sets the widget's name. |
void |
setTabIndex(int index)
Sets the widget's position in the tab index. |
void |
setTarget(java.lang.String target)
Sets the anchor's target frame (the frame in which navigation will occur when the link is selected). |
void |
setText(java.lang.String text)
Sets this object's text. |
void |
setText(java.lang.String text,
HasDirection.Direction dir)
Sets this object's text, also declaring its direction. |
void |
setWordWrap(boolean wrap)
Sets whether word-wrapping is enabled. |
static Anchor |
wrap(Element element)
Creates an Anchor widget that wraps an existing <a> element. |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Field Detail |
|---|
public static final DirectionEstimator DEFAULT_DIRECTION_ESTIMATOR
| Constructor Detail |
|---|
public Anchor()
The anchor's href is not set, which means that the widget will not
not be styled with the browser's native link styles (such as underline and
font color). Use Anchor(boolean) to add a default no-op href that
does not open a link but ensures the native link styles are applied.
Anchor(boolean)public Anchor(boolean useDefaultHref)
javascript:;, based on
the expectation that listeners will be added to the anchor.
useDefaultHref - true to set the default href to
javascript:;, false to leave it blankpublic Anchor(SafeHtml html)
html - the anchor's html
public Anchor(SafeHtml html,
HasDirection.Direction dir)
javascript : ;, based on the
expectation that listeners will be added to the anchor.
html - the anchor's htmldir - the html's direction
public Anchor(SafeHtml html,
DirectionEstimator directionEstimator)
javascript : ;, based on the
expectation that listeners will be added to the anchor.
html - the anchor's htmldirectionEstimator - A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR can be used.public Anchor(java.lang.String text)
javascript:;, based on the
expectation that listeners will be added to the anchor.
text - the anchor's text
public Anchor(java.lang.String text,
HasDirection.Direction dir)
javascript : ;, based on the
expectation that listeners will be added to the anchor.
text - the anchor's textdir - the text's direction
public Anchor(java.lang.String text,
DirectionEstimator directionEstimator)
javascript : ;, based on the
expectation that listeners will be added to the anchor.
text - the anchor's textdirectionEstimator - A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR can be used.
public Anchor(java.lang.String text,
boolean asHtml)
javascript:;, based on the
expectation that listeners will be added to the anchor.
text - the anchor's textasHtml - true to treat the specified text as html
public Anchor(SafeHtml html,
java.lang.String href)
html - the anchor's htmlhref - the url to which it will link
public Anchor(SafeHtml html,
SafeUri href)
html - the anchor's htmlhref - the url to which it will link
public Anchor(SafeHtml html,
HasDirection.Direction dir,
java.lang.String href)
html - the anchor's htmldir - the html's directionhref - the url to which it will link
public Anchor(SafeHtml html,
HasDirection.Direction dir,
SafeUri href)
html - the anchor's htmldir - the html's directionhref - the url to which it will link
public Anchor(SafeHtml html,
DirectionEstimator directionEstimator,
java.lang.String href)
html - the anchor's htmldirectionEstimator - A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR can be used.href - the url to which it will link
public Anchor(SafeHtml html,
DirectionEstimator directionEstimator,
SafeUri href)
html - the anchor's htmldirectionEstimator - A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR can be used.href - the url to which it will link
public Anchor(java.lang.String text,
java.lang.String href)
text - the anchor's texthref - the url to which it will link
public Anchor(java.lang.String text,
HasDirection.Direction dir,
java.lang.String href)
text - the anchor's textdir - the text's directionhref - the url to which it will link
public Anchor(java.lang.String text,
DirectionEstimator directionEstimator,
java.lang.String href)
text - the anchor's textdirectionEstimator - A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR can be used.href - the url to which it will link
public Anchor(java.lang.String text,
boolean asHTML,
java.lang.String href)
text - the anchor's textasHTML - true to treat the specified text as htmlhref - the url to which it will link
public Anchor(SafeHtml html,
java.lang.String href,
java.lang.String target)
html - the anchor's htmlhref - the url to which it will linktarget - the target frame (e.g. "_blank" to open the link in a new
window)
public Anchor(SafeHtml html,
SafeUri href,
java.lang.String target)
html - the anchor's htmlhref - the url to which it will linktarget - the target frame (e.g. "_blank" to open the link in a new
window)
public Anchor(java.lang.String text,
java.lang.String href,
java.lang.String target)
text - the anchor's texthref - the url to which it will linktarget - the target frame (e.g. "_blank" to open the link in a new
window)
public Anchor(java.lang.String text,
boolean asHtml,
java.lang.String href,
java.lang.String target)
text - the anchor's textasHtml - asHTML true to treat the specified text as htmlhref - the url to which it will linktarget - the target frame (e.g. "_blank" to open the link in a new
window)protected Anchor(Element element)
element - the element to be used| Method Detail |
|---|
public static Anchor wrap(Element element)
RootPanel.detachNow(Widget).
element - the element to be wrappedpublic HasDirection.Direction getDirection()
HasDirection
getDirection in interface HasDirectionRTL if the directionality is right-to-left,
LTR if the directionality is left-to-right, or
DEFAULT if the directionality is not explicitly specifiedpublic DirectionEstimator getDirectionEstimator()
HasDirectionEstimatorDirectionEstimator object.
getDirectionEstimator in interface HasDirectionEstimatorpublic HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
HasHorizontalAlignment
getHorizontalAlignment in interface HasHorizontalAlignmentHasHorizontalAlignment.ALIGN_LEFT,
HasHorizontalAlignment.ALIGN_CENTER,
HasHorizontalAlignment.ALIGN_RIGHT,
HasHorizontalAlignment.ALIGN_JUSTIFY, or
null).public java.lang.String getHref()
public java.lang.String getHTML()
HasHTML
getHTML in interface HasHTMLpublic java.lang.String getName()
HasName
getName in interface HasNamepublic int getTabIndex()
FocusWidget
getTabIndex in interface FocusablegetTabIndex in class FocusWidgetpublic java.lang.String getTarget()
public java.lang.String getText()
HasText
getText in interface HasTextpublic HasDirection.Direction getTextDirection()
HasDirectionalText
getTextDirection in interface HasDirectionalTextpublic boolean getWordWrap()
HasWordWrap
getWordWrap in interface HasWordWraptrue if word-wrapping is enabled.public void setAccessKey(char key)
Focusable
setAccessKey in interface FocusablesetAccessKey in class FocusWidgetkey - the widget's access key@Deprecated public void setDirection(HasDirection.Direction direction)
setDirectionEstimator(boolean) and / or pass explicit
direction to setText(java.lang.String), setHTML(com.google.gwt.safehtml.shared.SafeHtml) instead
HasDirection
setDirection in interface HasDirectiondirection - RTL if the directionality should be set to right-to-left,
LTR if the directionality should be set to left-to-right
DEFAULT if the directionality should not be explicitly setpublic void setDirectionEstimator(boolean enabled)
See note at setDirectionEstimator(DirectionEstimator).
setDirectionEstimator in interface HasDirectionEstimatorenabled - Whether to enable direction estimation. If true,
sets the DirectionEstimator object to a default
DirectionEstimator.public void setDirectionEstimator(DirectionEstimator directionEstimator)
DirectionEstimator object.
Note: DirectionEstimator should be set before the widget has any content; it's highly recommended to set it using a constructor. Reason: if the widget already has non-empty content, this will update its direction according to the new estimator's result. This may cause flicker, and thus should be avoided.
setDirectionEstimator in interface HasDirectionEstimatordirectionEstimator - The DirectionEstimator to be set. null means turning off direction estimation.public void setFocus(boolean focused)
Focusable
setFocus in interface FocusablesetFocus in class FocusWidgetfocused - whether this widget should take focus or release itpublic void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
HasHorizontalAlignment Use null to clear horizontal alignment, allowing it to be
determined by the standard HTML mechanisms such as inheritance and CSS
rules.
setHorizontalAlignment in interface HasHorizontalAlignmentalign - the horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT,
HasHorizontalAlignment.ALIGN_CENTER,
HasHorizontalAlignment.ALIGN_RIGHT,
HasHorizontalAlignment.ALIGN_JUSTIFY,
HasHorizontalAlignment.ALIGN_LOCALE_START, or
HasHorizontalAlignment.ALIGN_LOCALE_END).public void setHref(SafeUri href)
href - the anchor's hrefpublic void setHref(java.lang.String href)
href - the anchor's hrefpublic void setHTML(SafeHtml html)
HasSafeHtml
The object will behave exactly the same as when a widget's
HasHTML.setHTML(String) method is
invoked; however the SafeHtml passed to this method observes the
contract that it can be used in an HTML context without causing unsafe
script execution. Thus, unlike
HasHTML.setHTML(String), using this
method cannot result in Cross-Site Scripting security vulnerabilities.
setHTML in interface HasSafeHtmlhtml - the object's new HTML, represented as a SafeHtml objectpublic void setHTML(java.lang.String html)
HasHTMLHasText.setText(String) whenever possible.
setHTML in interface HasHTMLhtml - the object's new HTML
public void setHTML(SafeHtml html,
HasDirection.Direction dir)
HasDirectionalSafeHtml
setHTML in interface HasDirectionalSafeHtmlhtml - the object's new htmldir - the html's directionpublic void setName(java.lang.String name)
HasName
setName in interface HasNamename - the widget's new namepublic void setTabIndex(int index)
Focusable-1 will cause this widget to
be removed from the tab order.
setTabIndex in interface FocusablesetTabIndex in class FocusWidgetindex - the widget's tab indexpublic void setTarget(java.lang.String target)
target - the target framepublic void setText(java.lang.String text)
HasText
setText in interface HasTexttext - the object's new text
public void setText(java.lang.String text,
HasDirection.Direction dir)
HasDirectionalText
setText in interface HasDirectionalTexttext - the object's new textdir - the text's directionpublic void setWordWrap(boolean wrap)
HasWordWrap
setWordWrap in interface HasWordWrapwrap - true to enable word-wrapping.
|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||