eu.webtoolkit.jwt
Class WFlashObject

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

public class WFlashObject
extends WWebWidget

A widget that renders a Flash object (also known as Flash movie).

This class loads a .swf Flash file in the browser.

Flash objects must have their size set, so do not forget to call resize() after instantiation or your content will be invisible. JWt will modify width and height attributes of the Flash object if resize() is called after the object is instantiated; it is however not clear if this is permitted by the Flash plugin.

Any WWidget can be set with setAlternativeContent(), and this widget will be shown only when the browser has no Flash support. By default, a 'Download Flash' button will be displayed that links to a website where the Flash player can be downloaded. You may modify this to be any widget, such as a WImage, or a native JWt implementation of the Flash movie.

CSS

Styling through CSS is not applicable.


Constructor Summary
WFlashObject(java.lang.String url)
          Constructs a Flash widget.
WFlashObject(java.lang.String url, WContainerWidget parent)
          Constructs a Flash widget.
 
Method Summary
 java.lang.String getJsFlashRef()
          A JavaScript expression that returns the DOM node of the Flash object.
 void remove()
          Destructor.
 void resize(WLength width, WLength height)
          Resizes the widget.
 void setAlternativeContent(WWidget alternative)
          Sets content to be displayed if Flash is not available.
 void setFlashParameter(java.lang.String name, java.lang.CharSequence value)
          Sets a Flash parameter.
 void setFlashVariable(java.lang.String name, java.lang.CharSequence value)
          Sets a Flash variable.
 
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, callJavaScriptMember, childrenChanged, doJavaScript, domCanBeSaved, enableAjax, escapeText, escapeText, escapeText, escapeText, find, getAttributeValue, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, isDisabled, isEnabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isVisible, jsStringLiteral, jsStringLiteral, load, propagateSetEnabled, refresh, removeScript, removeStyleClass, setAttributeValue, setClearSides, setDecorationStyle, setDisabled, setFloatSide, setHidden, setHiddenKeepsGeometry, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPopup, setPositionScheme, setSelectable, setStyleClass, setTabIndex, 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
getObjectName, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WFlashObject

public WFlashObject(java.lang.String url,
                    WContainerWidget parent)
Constructs a Flash widget.


WFlashObject

public WFlashObject(java.lang.String url)
Constructs a Flash widget.

Calls this(url, (WContainerWidget)null)

Method Detail

remove

public void remove()
Destructor.

The Flash object is removed.

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

resize

public void resize(WLength width,
                   WLength height)
Description copied from class: WWidget
Resizes the widget.

Specify a new size for this widget, by specifying width and height. By default a widget has automatic width and height, see WLength#isAuto().

This applies to CSS-based layout, and only block widgets can be given a size reliably.

When inserted in a layout manager, the widget may be informed about its current size using setLayoutSizeAware(). If you have defined a "wtResize()" JavaScript method for the widget, then this method will also be called. operation.

Overrides:
resize in class WWebWidget
See Also:
WWidget.getWidth(), WWidget.getHeight()

setFlashParameter

public void setFlashParameter(java.lang.String name,
                              java.lang.CharSequence value)
Sets a Flash parameter.

The Flash parameters are items such as quality, scale, menu, ... They are passed as PARAM objects to the Flash movie. See the adobe website for more information about these parameters: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12701

Setting the same Flash parameter a second time will overwrite the previous value. Flash parameters can only be set before the widget is rendered for the first time, so it is recommended to call this method shortly after construction before returning to the idle loop.


setFlashVariable

public void setFlashVariable(java.lang.String name,
                             java.lang.CharSequence value)
Sets a Flash variable.

This method is a helper function to set variable values in the flashvars parameter.

The flash variables will be properly encoded (URL encoding) before being passed to the flashvars parameter.

Setting the same Flash variable a second time will overwrite the previous value. Flash variables can only be set before the widget is rendered for the first time, so it is recommended to call this method shortly after construction before returning to the idle loop.


getJsFlashRef

public java.lang.String getJsFlashRef()
A JavaScript expression that returns the DOM node of the Flash object.

The Flash object is not stored in WWidget#getJsRef(), but in getJsFlashRef(). Use this method in conjuction with WApplication#doJavaScript() or JSlot in custom JavaScript code to refer to the Flash content.

The expression returned by getJsFlashRef() may be null, for example on IE when flash is not installed.


setAlternativeContent

public void setAlternativeContent(WWidget alternative)
Sets content to be displayed if Flash is not available.

Any widget can be a placeholder when Flash is not installed in the users browser. By default, this will show a 'Download Flash' button and link to the Flash download site.

Call this method with a NULL pointer to remove the alternative content.