eu.webtoolkit.jwt
Class WPushButton

java.lang.Object
  extended by eu.webtoolkit.jwt.WObject
      extended by eu.webtoolkit.jwt.WWidget
          extended by eu.webtoolkit.jwt.WWebWidget
              extended by eu.webtoolkit.jwt.WInteractWidget
                  extended by eu.webtoolkit.jwt.WFormWidget
                      extended by eu.webtoolkit.jwt.WPushButton

public class WPushButton
extends WFormWidget

A widget that represents a push button.

To act on a button click, connect a slot to the WInteractWidget#clicked() signal.

WPushButton is an inline widget.

CSS

The widget corresponds to the HTML <button> tag and has the Wt-btn style. It may be styled through the current theme, or you can override the style using internal or external CSS as appropriate.


Constructor Summary
WPushButton()
          Creates a push button.
WPushButton(java.lang.CharSequence text)
          Creates a push button with given label text.
WPushButton(java.lang.CharSequence text, WContainerWidget parent)
          Creates a push button with given label text.
WPushButton(WContainerWidget parent)
          Creates a push button.
 
Method Summary
 WLink getIcon()
          Returns the icon.
 WLink getLink()
          Returns the destination link.
 AnchorTarget getLinkTarget()
          Returns the location where the linked content should be displayed.
 java.lang.String getRef()
          Deprecated. Use getLink() instead.
 WResource getResource()
          Deprecated. Use getLink() instead.
 WString getText()
          Returns the button text.
 java.lang.String getValueText()
          Returns the current value.
 void refresh()
          Refresh the widget.
 void remove()
          Destructor.
 void setIcon(WLink link)
          Sets an icon.
 void setLink(WLink link)
          Sets a destination link.
 void setLinkTarget(AnchorTarget target)
          Sets the link target.
 void setRef(java.lang.String url)
          Deprecated. Use setLink() insteadd.
 void setResource(WResource resource)
          Deprecated. Use setLink() instead.
 void setText(java.lang.CharSequence text)
          Sets the button text.
 void setValueText(java.lang.String value)
          Sets the current value.
 
Methods inherited from class eu.webtoolkit.jwt.WFormWidget
blurred, changed, enableAjax, focussed, getEmptyText, getLabel, getTabIndex, getValidator, hasFocus, isReadOnly, propagateSetEnabled, render, selected, setEmptyText, setEnabled, setFocus, setFocus, setHidden, setReadOnly, setTabIndex, setValidator, validate, validated
 
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted
 
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, callJavaScriptMember, childrenChanged, doJavaScript, domCanBeSaved, escapeText, escapeText, escapeText, escapeText, find, getAttributeValue, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isVisible, jsStringLiteral, jsStringLiteral, removeScript, removeStyleClass, resize, setAttributeValue, setClearSides, setDecorationStyle, setDisabled, setFloatSide, setHiddenKeepsGeometry, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPopup, setPositionScheme, setSelectable, setStyleClass, setToolTip, setVerticalAlignment, updateSignalConnection
 
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
 
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getObjectName, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WPushButton

public WPushButton(WContainerWidget parent)
Creates a push button.


WPushButton

public WPushButton()
Creates a push button.

Calls this((WContainerWidget)null)


WPushButton

public WPushButton(java.lang.CharSequence text,
                   WContainerWidget parent)
Creates a push button with given label text.


WPushButton

public WPushButton(java.lang.CharSequence text)
Creates a push button with given label text.

Calls this(text, (WContainerWidget)null)

Method Detail

remove

public void remove()
Description copied from class: WFormWidget
Destructor.

If a label was associated with the widget, its buddy is reset to null.

Overrides:
remove in class WFormWidget
See Also:
WContainerWidget.removeWidget(WWidget widget)

setText

public void setText(java.lang.CharSequence text)
Sets the button text.


getText

public WString getText()
Returns the button text.

See Also:
setText(CharSequence text)

setIcon

public void setIcon(WLink link)
Sets an icon.

The icon is placed to the left of the text.


getIcon

public WLink getIcon()
Returns the icon.

See Also:
setIcon(WLink link)

setLink

public void setLink(WLink link)
Sets a destination link.

This method can be used to make the button behave like a WAnchor (or conversely, an anchor look like a button) and redirect to another URL when clicked.

The link may be to a URL, a resource, or an internal path.

By default, a button does not link to an URL and you should listen to the WInteractWidget#clicked() signal to react to a click event.


getLink

public WLink getLink()
Returns the destination link.

See Also:
setLink(WLink link)

setRef

public void setRef(java.lang.String url)
Deprecated. Use setLink() insteadd.

Sets a destination URL (deprecated).


getRef

public java.lang.String getRef()
Deprecated. Use getLink() instead.

Returns the destination URL (deprecated).

When the button refers to a resource, the current resource URL is returned. Otherwise, the URL is returned that was set using setRef().

See Also:
setRef(String url), WResource.getUrl()

setResource

public void setResource(WResource resource)
Deprecated. Use setLink() instead.

Sets a destination resource (deprecated).

This method can be used to make the button behave like a WAnchor (or conversely, an anchor look like a button) and redirect to another resource when clicked.

A resource specifies application-dependent content, which may be generated by your application on demand.

This sets the resource as the destination of the button, and is an alternative to setRef(). The resource may be cleared by passing resource = null.

The button does not assume ownership of the resource.

See Also:
setRef(String url)

getResource

public WResource getResource()
Deprecated. Use getLink() instead.

Returns the destination resource (deprecated).

Returns null if no resource has been set.

See Also:
setResource(WResource resource)

getValueText

public java.lang.String getValueText()
Returns the current value.

Returns an empty string, since a button has no value.

Specified by:
getValueText in class WFormWidget

setValueText

public void setValueText(java.lang.String value)
Sets the current value.

Has no effect, since a button has not value.

Specified by:
setValueText in class WFormWidget

setLinkTarget

public void setLinkTarget(AnchorTarget target)
Sets the link target.

This sets the target where the linked contents should be displayed. The default target is TargetSelf.


getLinkTarget

public AnchorTarget getLinkTarget()
Returns the location where the linked content should be displayed.

See Also:
setLinkTarget(AnchorTarget target)

refresh

public void refresh()
Description copied from class: WWidget
Refresh the widget.

The refresh method is invoked when the locale is changed using WApplication#setLocale() or when the user hit the refresh button.

The widget must actualize its contents in response.

Overrides:
refresh in class WFormWidget