org.wicketstuff.minis.prototipbehaviour
Class PrototipBehaviour

java.lang.Object
  extended by org.apache.wicket.behavior.AbstractBehavior
      extended by org.wicketstuff.minis.prototipbehaviour.PrototipBehaviour
All Implemented Interfaces:
java.io.Serializable, org.apache.wicket.behavior.IBehavior, org.apache.wicket.IClusterable, org.apache.wicket.markup.html.IHeaderContributor

public class PrototipBehaviour
extends org.apache.wicket.behavior.AbstractBehavior

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
protected  boolean onLoad
           
protected  boolean overrideHeaderContributor
           
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
protected  PrototipSettings settings
           
protected  org.apache.wicket.Component source
           
protected  java.lang.String title
           
protected  java.lang.String tooltip
           
protected  org.apache.wicket.Component tooltipComponent
           
 
Constructor Summary
PrototipBehaviour()
          Default constructor If you use this then you must set either a string, or a component manually
PrototipBehaviour(org.apache.wicket.Component panel)
          Provide a component to show as the tool tip (eg a panel)
PrototipBehaviour(java.lang.String tooltip)
          Provide a simple string as a tooltip
 
Method Summary
 void bind(org.apache.wicket.Component component)
          override bind so that the component you add this behavior to becomes the component the tooltip applies to
static JS_TYPE getSelectedJsType()
           
 PrototipSettings getSettings()
           
 org.apache.wicket.Component getSource()
           
 java.lang.String getTitle()
           
 java.lang.String getTooltip()
           
 org.apache.wicket.Component getTooltipComponent()
           
 void hide(org.apache.wicket.ajax.AjaxRequestTarget target)
          Given an ajax request target, hide this tip on the page
 boolean isOnLoad()
          Is the javascript set to load 'onload' if false then it will be 'ondomready'
 boolean isOverrideHeaderContributor()
           
 void remove(org.apache.wicket.ajax.AjaxRequestTarget target)
          Given an ajax request target, remove this tip from the page
 void renderHead(org.apache.wicket.markup.html.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
 void setOnLoad(boolean onLoad)
          Is the javascript set to load 'onload' if false then it will be 'ondomready'
 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)
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)
 PrototipBehaviour setSettings(PrototipSettings settings)
           
 PrototipBehaviour setSource(org.apache.wicket.Component source)
           
 PrototipBehaviour setTitle(java.lang.String title)
           
 PrototipBehaviour setTooltip(java.lang.String tooltip)
           
 PrototipBehaviour setTooltipComponent(org.apache.wicket.Component tooltipComponent)
           
protected  java.lang.String toJavascript()
          Get string to add the prototip to the page
 
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior
afterRender, beforeRender, cleanup, detach, detachModel, exception, getStatelessHint, isEnabled, isTemporary, onComponentTag, onException, onRendered, rendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected org.apache.wicket.Component source

tooltip

protected java.lang.String tooltip

tooltipComponent

protected org.apache.wicket.Component tooltipComponent

settings

protected PrototipSettings settings

overrideHeaderContributor

protected boolean overrideHeaderContributor

title

protected java.lang.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(java.lang.String tooltip)
Provide a simple string as a tooltip

Parameters:
tooltip -

PrototipBehaviour

public PrototipBehaviour(org.apache.wicket.Component panel)
Provide a component to show as the tool tip (eg a panel)

Parameters:
panel -
Method Detail

renderHead

public void renderHead(org.apache.wicket.markup.html.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:
renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
Overrides:
renderHead in class org.apache.wicket.behavior.AbstractBehavior
See Also:
IHeaderContributor.renderHead(org.apache.wicket.markup.html.IHeaderResponse)

bind

public void bind(org.apache.wicket.Component component)
override bind so that the component you add this behavior to becomes the component the tooltip applies to

Specified by:
bind in interface org.apache.wicket.behavior.IBehavior
Overrides:
bind in class org.apache.wicket.behavior.AbstractBehavior

remove

public void remove(org.apache.wicket.ajax.AjaxRequestTarget target)
Given an ajax request target, remove this tip from the page

Parameters:
target -

hide

public void hide(org.apache.wicket.ajax.AjaxRequestTarget target)
Given an ajax request target, hide this tip on the page

Parameters:
target -

toJavascript

protected java.lang.String toJavascript()
Get string to add the prototip to the page

Returns:
the String

getSource

public org.apache.wicket.Component getSource()
Returns:
the source

setSource

public PrototipBehaviour setSource(org.apache.wicket.Component source)
Parameters:
source - the source to set
Returns:
this object

getTooltip

public java.lang.String getTooltip()
Returns:
the tooltip

setTooltip

public PrototipBehaviour setTooltip(java.lang.String tooltip)
Parameters:
tooltip - the tooltip to set
Returns:
this object

getTooltipComponent

public org.apache.wicket.Component getTooltipComponent()
Returns:
the tooltip component

setTooltipComponent

public PrototipBehaviour setTooltipComponent(org.apache.wicket.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 java.lang.String getTitle()
Returns:
the title

setTitle

public PrototipBehaviour setTitle(java.lang.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 -


Copyright © 2010. All Rights Reserved.