Class WAnchor
- Direct Known Subclasses:
IndexAnchor
Use an anchor to link to another web page, document, internal application path or a resource
(which specifies application-dependent content that may be generated by your application on
demand). The anchor may contain a label text, an image, or any other widget (as it inherits from
WContainerWidget).
If you link to a document or external url, and do not want the application to terminate when
the user follows the anchor, you must use link.setTarget(LinkTarget::NewWindow). Even for non-HTML documents, this may be important since
pending Ajax requests are cancelled if documents are not served within the browser window in
certain browsers.
WAnchor is an inline widget.
CSS
The widget corresponds to the HTML <a> tag and does not provide styling. It
can be styled using inline or external CSS as appropriate.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData -
Field Summary
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault -
Constructor Summary
ConstructorsConstructorDescriptionWAnchor()Creates an anchor.WAnchor(WContainerWidget parentContainer) Creates an anchor.Creates an anchor for the given link.WAnchor(WLink link, WContainerWidget parentContainer) Creates an anchor for the given link.Creates an anchor for the given link with an image.WAnchor(WLink link, WImage image, WContainerWidget parentContainer) Creates an anchor for the given link with an image.WAnchor(WLink link, CharSequence text) Creates an anchor for the given link with a text.WAnchor(WLink link, CharSequence text, WContainerWidget parentContainer) Creates an anchor for the given link with a text. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidProgresses to an Ajax-enabled widget.getImage()Returns the image.getLink()Returns the link.intReturns the tab index.getText()Returns the label text.Returns the text format.booleanReturns whether the widget may break lines.booleanReturns whether the widget can receive focus.booleanSet focus on the widget's first descendant.protected voidpropagateSetEnabled(boolean enabled) Propagates that a widget was enabled or disabled through children.voidSets an image.voidSets the link.voidsetText(CharSequence text) Sets the label text.voidsetTextFormat(TextFormat textFormat) Configures the text format.voidsetWordWrap(boolean wordWrap) Configures text word wrapping.Methods inherited from class eu.webtoolkit.jwt.WContainerWidget
addWidget, clear, createDomElement, getContentAlignment, getCount, getDomChanges, getIndexOf, getLayout, getPadding, getScrollLeft, getScrollTop, getWidget, insertBefore, insertWidget, isGlobalUnfocussed, isList, isOrderedList, isUnorderedList, iterateChildren, parentResized, remove, removeWidget, scrolled, setContentAlignment, setContentAlignment, setFormData, setGlobalUnfocused, setLayout, setList, setList, setOverflow, setOverflow, setOverflow, setPadding, setPadding, setPaddingMethods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, render, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggableMethods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, doJavaScript, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, hideToolTip, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemovedMethods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, trMethods inherited from class eu.webtoolkit.jwt.WObject
getObjectName
-
Constructor Details
-
WAnchor
Creates an anchor. -
WAnchor
public WAnchor()Creates an anchor. -
WAnchor
Creates an anchor for the given link.The
linkmay point to a URL, a dynamic resource, or an internal path.- See Also:
-
WAnchor
Creates an anchor for the given link. -
WAnchor
Creates an anchor for the given link with a text.The
linkmay point to a URL, a dynamic resource, or an internal path. -
WAnchor
Creates an anchor for the given link with a text. -
WAnchor
Creates an anchor for the given link with an image.- See Also:
-
WAnchor
Creates an anchor for the given link with an image.
-
-
Method Details
-
setLink
Sets the link.The link may hold a URL, a resource, or an internal path.
When the link points to a
resource, the contents of the link may be generated by your application on demand.When the link points to an
internal path, activating the anchor will change theapplication's internal pathor open a new session with the given path asinitial path). This is the easiest way to let the application participate in browser history, and generate URLs that are bookmarkable and search engine friendly. -
getLink
Returns the link.- See Also:
-
setText
Sets the label text.If no text was previously set, a new
WTextwidget is added usingWContainerWidget#addWidget(). -
getText
Returns the label text.Returns an empty string if no label was set.
- See Also:
-
setWordWrap
public void setWordWrap(boolean wordWrap) Configures text word wrapping.When
wordWrapistrue, the text set withsetText()may be broken up over multiple lines. WhenwordWrapisfalse, the text will displayed on a single line, unless the text contains<br />tags or other block-level tags.The default value is
true.- See Also:
-
setTextFormat
Configures the text format.The default text format is
TextFormat.XHTML. -
getTextFormat
Returns the text format.- See Also:
-
hasWordWrap
public boolean hasWordWrap()Returns whether the widget may break lines.- See Also:
-
setImage
Sets an image.If an image was previously set, it is deleted. The
imageis added usingWContainerWidget#addWidget(). -
getImage
Returns the image.Returns
nullif no image is set.- See Also:
-
isCanReceiveFocus
public boolean isCanReceiveFocus()Description copied from class:WWidgetReturns whether the widget can receive focus.- Overrides:
isCanReceiveFocusin classWWebWidget- See Also:
-
getTabIndex
public int getTabIndex()Description copied from class:WWidgetReturns the tab index.- Overrides:
getTabIndexin classWWebWidget- See Also:
-
isSetFirstFocus
public boolean isSetFirstFocus()Description copied from class:WWidgetSet focus on the widget's first descendant.Set focus on the widget itself, or on a first descendant which can receive focus.
Returns whether focus could be set.
- Overrides:
isSetFirstFocusin classWWebWidget
-
propagateSetEnabled
protected void propagateSetEnabled(boolean enabled) Description copied from class:WWidgetPropagates that a widget was enabled or disabled through children.When enabling or disabling a widget, you usually also want to disable contained children. This method is called by
setDisabled()to propagate its state to all children.You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.
- Overrides:
propagateSetEnabledin classWInteractWidget
-
enableAjax
protected void enableAjax()Description copied from class:WWidgetProgresses to an Ajax-enabled widget.This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.
- Overrides:
enableAjaxin classWWebWidget- See Also:
-