com.github.gwtbootstrap.client.ui.base
Class IconAnchor

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by com.github.gwtbootstrap.client.ui.base.ComplexWidget
                      extended by com.github.gwtbootstrap.client.ui.base.IconAnchor
All Implemented Interfaces:
HasHref, HasIcon, HasStyle, IsResponsive, HasClickHandlers, HasAttachHandlers, HasHandlers, EventListener, Focusable, HasEnabled, HasText, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, Iterable<Widget>
Direct Known Subclasses:
Button

public class IconAnchor
extends ComplexWidget
implements HasText, HasIcon, HasHref, HasClickHandlers, HasEnabled, Focusable

An Anchor with optional image and caret.

It uses a HTML <a> tag and can contain text and child widgets. But not both at the same time.

UiBinder Usage:

<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.

Since:
2.0.4.0
Author:
Dominik Mayer, ohashi keisuke

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.HasWidgets
HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
IconAnchor()
          Creates the widget and sets the href property to javascript:; in order to avoid problems when clicking on it.
 
Method Summary
 HandlerRegistration addClickHandler(ClickHandler handler)
          
 String getHref()
          Gets the URL of the website, the link is pointing to.
 int getTabIndex()
           
 String getTargetHistoryToken()
          Gets the history token this link points to
 String getText()
          
 boolean isEnabled()
          
protected  void onAttach()
           
 void onBrowserEvent(Event event)
          
 void setAccessKey(char key)
           
 void setCaret(boolean visible)
          Shows or hides the caret.
 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 setIconSize(IconSize size)
          Sets the size of the icon.
 void setTabIndex(int index)
           
 void setTargetHistoryToken(String targetHistoryToken)
          Sets the href property of the anchor tag to "#" + targetHistoryToken.
 void setText(String text)
          
 
Methods inherited from class com.github.gwtbootstrap.client.ui.base.ComplexWidget
add, addStyle, insert, removeStyle, setHideOn, setShowOn, setStyle
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
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, unsinkEvents
 
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
 
Methods inherited from interface com.google.gwt.user.client.ui.HasWidgets
clear, iterator, remove
 

Constructor Detail

IconAnchor

public IconAnchor()
Creates the widget and sets the href property to javascript:; in order to avoid problems when clicking on it.

Method Detail

setIcon

public void setIcon(IconType type)
Sets the Type of the Icon.

Specified by:
setIcon in interface HasIcon

setIconSize

public void setIconSize(IconSize size)
Sets the size of the icon.

Default is DEFAULT.

Specified by:
setIconSize in interface HasIcon
Parameters:
size - the new size.

setText

public void setText(String text)

Specified by:
setText in interface HasText

getText

public String getText()

Specified by:
getText in interface HasText

setHref

public void setHref(String href)
Sets the 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)

Specified by:
setHref in interface HasHref
Parameters:
href - the website URL

getHref

public String getHref()
Gets the URL of the website, the link is pointing to.

Specified by:
getHref in interface HasHref
Returns:
the URL

setCaret

public void setCaret(boolean visible)
Shows or hides the caret.

Parameters:
visible - true if the caret should be shown.

setTargetHistoryToken

public void setTargetHistoryToken(String targetHistoryToken)
Sets the href property of the anchor tag to "#" + targetHistoryToken.

Specified by:
setTargetHistoryToken in interface HasHref
Parameters:
targetHistoryToken - the history token

getTargetHistoryToken

public String getTargetHistoryToken()
Gets the history token this link points to

Specified by:
getTargetHistoryToken in interface HasHref
Returns:
the history token

setEmptyHref

public void setEmptyHref()
Sets the hrefproperty of this element to "javascript:;" in order to get another cursor (hand).


addClickHandler

public HandlerRegistration addClickHandler(ClickHandler handler)

Specified by:
addClickHandler in interface HasClickHandlers

isEnabled

public boolean isEnabled()

Specified by:
isEnabled in interface HasEnabled

setEnabled

public void setEnabled(boolean enabled)

Specified by:
setEnabled in interface HasEnabled

onBrowserEvent

public void onBrowserEvent(Event event)

Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Widget

getTabIndex

public int getTabIndex()
Specified by:
getTabIndex in interface Focusable

setAccessKey

public void setAccessKey(char key)
Specified by:
setAccessKey in interface Focusable

setFocus

public void setFocus(boolean focused)
Specified by:
setFocus in interface Focusable

setTabIndex

public void setTabIndex(int index)
Specified by:
setTabIndex in interface Focusable

onAttach

protected void onAttach()
Overrides:
onAttach in class Widget


Copyright © 2012 gwtbootstrap. All Rights Reserved.