Class PrototipBehaviour
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.wicketstuff.minis.behavior.prototip.PrototipBehaviour
-
- All Implemented Interfaces:
Serializable,IComponentAwareEventSink,IComponentAwareHeaderContributor,IClusterable
public class PrototipBehaviour extends Behavior
Prototip behavior The component you add this behavior to will be the component which the tooltip appears for note this does not work if you add the behavior to a panel- Author:
- Richard Wilkinson
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanonLoadprotected booleanoverrideHeaderContributorprotected static JS_TYPEselectedJsTypeMade this static as it is very unlikely that you would want different versions of prototip.js across your siteprotected PrototipSettingssettingsprotected Componentsourceprotected Stringtitleprotected Stringtooltipprotected ComponenttooltipComponent
-
Constructor Summary
Constructors Constructor Description PrototipBehaviour()Default constructor If you use this then you must set either a string, or a component manuallyPrototipBehaviour(String tooltip)Provide a simple string as a tooltipPrototipBehaviour(Component panel)Provide a component to show as the tool tip (eg a panel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(Component component)override bind so that the component you add this behavior to becomes the component the tooltip applies tostatic JS_TYPEgetSelectedJsType()PrototipSettingsgetSettings()ComponentgetSource()StringgetTitle()StringgetTooltip()ComponentgetTooltipComponent()voidhide(AjaxRequestTarget target)Given an ajax request target, hide this tip on the pagebooleanisOnLoad()Is the javascript set to load 'onload' if false then it will be 'ondomready'booleanisOverrideHeaderContributor()voidremove(AjaxRequestTarget target)Given an ajax request target, remove this tip from the pagevoidrenderHead(Component c, IHeaderResponse response)Add the required css and js files to the page Permission to distribute prototip files given by prototip creator Nick Stakenburg (http://www.nickstakenburg.com) Also add the javascript to create the tooltipvoidsetOnLoad(boolean onLoad)Is the javascript set to load 'onload' if false then it will be 'ondomready'PrototipBehavioursetOverrideHeaderContributor(boolean overrideHeaderContributor)If you do not want this behavour to add the required javascript and css files to the header set this to true (default false)static voidsetSelectedJsType(JS_TYPE selectedJsType)There are 3 different js files which can be included: a normal uncompressed one a minified one a minified and gziped one To override the default (the minified one) set this parameter This is a static method and as such affects all PrototipBehaviour in the system, this is so that you do not have to set the type for every PrototipBehaviour that you use (which is tedious)PrototipBehavioursetSettings(PrototipSettings settings)PrototipBehavioursetSource(Component source)PrototipBehavioursetTitle(String title)PrototipBehavioursetTooltip(String tooltip)PrototipBehavioursetTooltipComponent(Component tooltipComponent)protected StringtoJavascript()Get string to add the prototip to the page-
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, unbind
-
-
-
-
Field Detail
-
source
protected Component source
-
tooltip
protected String tooltip
-
tooltipComponent
protected Component tooltipComponent
-
settings
protected PrototipSettings settings
-
overrideHeaderContributor
protected boolean overrideHeaderContributor
-
title
protected String title
-
onLoad
protected boolean onLoad
-
selectedJsType
protected static JS_TYPE selectedJsType
Made this static as it is very unlikely that you would want different versions of prototip.js across your site
-
-
Constructor Detail
-
PrototipBehaviour
public PrototipBehaviour()
Default constructor If you use this then you must set either a string, or a component manually
-
PrototipBehaviour
public PrototipBehaviour(String tooltip)
Provide a simple string as a tooltip- Parameters:
tooltip-
-
PrototipBehaviour
public PrototipBehaviour(Component panel)
Provide a component to show as the tool tip (eg a panel)- Parameters:
panel-
-
-
Method Detail
-
renderHead
public void renderHead(Component c, IHeaderResponse response)
Add the required css and js files to the page Permission to distribute prototip files given by prototip creator Nick Stakenburg (http://www.nickstakenburg.com) Also add the javascript to create the tooltip- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin classBehavior
-
bind
public void bind(Component component)
override bind so that the component you add this behavior to becomes the component the tooltip applies to
-
remove
public void remove(AjaxRequestTarget target)
Given an ajax request target, remove this tip from the page- Parameters:
target-
-
hide
public void hide(AjaxRequestTarget target)
Given an ajax request target, hide this tip on the page- Parameters:
target-
-
toJavascript
protected String toJavascript()
Get string to add the prototip to the page- Returns:
- the String
-
getSource
public Component getSource()
- Returns:
- the source
-
setSource
public PrototipBehaviour setSource(Component source)
- Parameters:
source- the source to set- Returns:
- this object
-
getTooltip
public String getTooltip()
- Returns:
- the tooltip
-
setTooltip
public PrototipBehaviour setTooltip(String tooltip)
- Parameters:
tooltip- the tooltip to set- Returns:
- this object
-
getTooltipComponent
public Component getTooltipComponent()
- Returns:
- the tooltip component
-
setTooltipComponent
public PrototipBehaviour setTooltipComponent(Component tooltipComponent)
- Parameters:
panel- the panel to set- Returns:
- this object
-
getSettings
public PrototipSettings getSettings()
- Returns:
- the settings
-
setSettings
public PrototipBehaviour setSettings(PrototipSettings settings)
- Parameters:
settings- the settings to set- Returns:
- this object
-
isOverrideHeaderContributor
public boolean isOverrideHeaderContributor()
- Returns:
- the overrideHeaderContributor
-
setOverrideHeaderContributor
public PrototipBehaviour setOverrideHeaderContributor(boolean overrideHeaderContributor)
If you do not want this behavour to add the required javascript and css files to the header set this to true (default false)- Parameters:
overrideHeaderContributor- the overrideHeaderContributor to set- Returns:
- this object
-
getTitle
public String getTitle()
- Returns:
- the title
-
setTitle
public PrototipBehaviour setTitle(String title)
- Parameters:
title- the title to set- Returns:
- this object
-
getSelectedJsType
public static JS_TYPE getSelectedJsType()
- Returns:
- the selectedJsType
-
setSelectedJsType
public static void setSelectedJsType(JS_TYPE selectedJsType)
There are 3 different js files which can be included: a normal uncompressed one a minified one a minified and gziped one To override the default (the minified one) set this parameter This is a static method and as such affects all PrototipBehaviour in the system, this is so that you do not have to set the type for every PrototipBehaviour that you use (which is tedious)- Parameters:
selectedJsType- the selectedJsType to set
-
isOnLoad
public boolean isOnLoad()
Is the javascript set to load 'onload' if false then it will be 'ondomready'- Returns:
-
setOnLoad
public void setOnLoad(boolean onLoad)
Is the javascript set to load 'onload' if false then it will be 'ondomready'- Parameters:
onLoad-
-
-