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.DebugIdImplEnabled
HasWidgets.ForIsWidget
IndexedPanel.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
href property 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, setStyle
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
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, unsinkEvents
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
clear, iterator, remove
public IconAnchor()
href
property to
javascript:;
in order to avoid problems when clicking on it.public void setIconPosition(IconPosition position)
setIconPosition
in interface HasIcon
position
- icon's positionpublic void setBaseIcon(BaseIconType type)
setBaseIcon
in interface HasIcon
public void setIconSize(IconSize size)
Default is DEFAULT.
setIconSize
in interface HasIcon
size
- 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 HasHref
targetHistoryToken
- the history tokenpublic String getTargetHistoryToken()
getTargetHistoryToken
in interface HasHref
public void setEmptyHref()
href
property of this element to "javascript:;" in
order to get another cursor (hand).public HandlerRegistration addClickHandler(ClickHandler handler)
addClickHandler
in interface HasClickHandlers
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
addMouseDownHandler
in interface HasMouseDownHandlers
public boolean isEnabled()
isEnabled
in interface HasEnabled
public void setEnabled(boolean enabled)
setEnabled
in interface HasEnabled
public void onBrowserEvent(Event event)
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
public int getTabIndex()
getTabIndex
in interface Focusable
public void setAccessKey(char key)
setAccessKey
in interface Focusable
public void setTabIndex(int index)
setTabIndex
in interface Focusable
public 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 HasIcon
Copyright © 2012-2014 gwtbootstrap. All Rights Reserved.