public class IconAnchor extends ComplexWidget implements HasText, HasIcon, HasHref, HasClickHandlers, HasEnabled, Focusable, HasName, HasMouseDownHandlers
It uses a HTML <a> tag and can contain text and child widgets. But
not both at the same time.
<b:IconAnchor icon="plane" href="www.twitter.com">Some Text</b:IconAnchor>
Here we add a second Icon:
<b:IconAnchor icon="STAR" text="There is a widget so the text goes here">
<b:Icon type="STAR" />
</b:IconAnchor>
All parameter are optional. All setters can be used as parameters.
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledHasWidgets.ForIsWidgetIndexedPanel.ForIsWidget| Modifier and Type | Field and Description |
|---|---|
protected Icon |
icon |
DEBUG_ID_PREFIX| Constructor and Description |
|---|
IconAnchor()
Creates the widget and sets the
href property to
javascript:; in order to avoid problems when clicking on it. |
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addClickHandler(ClickHandler handler) |
HandlerRegistration |
addMouseDownHandler(MouseDownHandler handler) |
protected AnchorElement |
getAnchorElement() |
String |
getHref()
Gets the URL of the website, the link is pointing to.
|
String |
getName() |
int |
getTabIndex() |
String |
getTarget()
Get target attribute value
|
String |
getTargetHistoryToken()
Gets the history token this link points to
|
String |
getText() |
boolean |
isActive()
Has the active css style name?
|
boolean |
isEnabled() |
protected void |
onAttach() |
void |
onBrowserEvent(Event event) |
void |
setAccessKey(char key) |
void |
setActive(boolean active)
Set active style name.
|
void |
setBaseIcon(BaseIconType type)
Sets the BaseType of the Icon.
|
void |
setCaret(boolean visible)
Shows or hides the caret.
|
void |
setCustomIconStyle(String customIconStyle)
Set custom icon style.
|
void |
setEmptyHref()
Sets the
hrefproperty of this element to "javascript:;" in
order to get another cursor (hand). |
void |
setEnabled(boolean enabled) |
void |
setFocus(boolean focused) |
void |
setHref(String href)
Sets the
href property of the anchor tag. |
void |
setIcon(IconType type)
Sets the Type of the Icon.
|
void |
setIconPosition(IconPosition position)
Set icon position , left or right
|
void |
setIconSize(IconSize size)
Sets the size of the icon.
|
void |
setName(String name) |
void |
setTabIndex(int index) |
void |
setTarget(String target)
Set target attribute
|
void |
setTargetHistoryToken(String targetHistoryToken)
Sets the
href property of the anchor tag to
"#" + targetHistoryToken. |
void |
setText(String text) |
add, addStyle, insert, removeStyle, setHideOn, setShowOn, setStyleadd, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, removeadd, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, 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, unsinkEventsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfireEventclear, iterator, removepublic IconAnchor()
href property to
javascript:; in order to avoid problems when clicking on it.public void setIconPosition(IconPosition position)
setIconPosition in interface HasIconposition - icon's positionpublic void setBaseIcon(BaseIconType type)
setBaseIcon in interface HasIconpublic void setIconSize(IconSize size)
Default is DEFAULT.
setIconSize in interface HasIconsize - the new size.public void setHref(String href)
href property of the anchor tag.
Use it only to set links to another page. Links on the same page or GWT
tokens should be set with #setTargetHistoryToken(String)
public void setCaret(boolean visible)
visible - true if the caret should be shown.public void setTargetHistoryToken(String targetHistoryToken)
href property of the anchor tag to
"#" + targetHistoryToken.setTargetHistoryToken in interface HasHreftargetHistoryToken - the history tokenpublic String getTargetHistoryToken()
getTargetHistoryToken in interface HasHrefpublic void setEmptyHref()
hrefproperty of this element to "javascript:;" in
order to get another cursor (hand).public HandlerRegistration addClickHandler(ClickHandler handler)
addClickHandler in interface HasClickHandlerspublic HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
addMouseDownHandler in interface HasMouseDownHandlerspublic boolean isEnabled()
isEnabled in interface HasEnabledpublic void setEnabled(boolean enabled)
setEnabled in interface HasEnabledpublic void onBrowserEvent(Event event)
onBrowserEvent in interface EventListeneronBrowserEvent in class Widgetpublic int getTabIndex()
getTabIndex in interface Focusablepublic void setAccessKey(char key)
setAccessKey in interface Focusablepublic void setTabIndex(int index)
setTabIndex in interface Focusablepublic void setActive(boolean active)
active - true : set active false : unset activepublic boolean isActive()
true: has false : none.protected AnchorElement getAnchorElement()
public void setCustomIconStyle(String customIconStyle)
It sets css class name to <i> tag. You can set any icons style.
setCustomIconStyle in interface HasIconCopyright © 2012-2014 gwtbootstrap. All Rights Reserved.