org.odlabs.wiquery.ui.resizable
Class ResizableBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by org.odlabs.wiquery.core.behavior.WiQueryAbstractBehavior
          extended by org.odlabs.wiquery.ui.resizable.ResizableBehavior
All Implemented Interfaces:
Serializable, org.apache.wicket.IClusterable, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, IWiQueryPlugin

public class ResizableBehavior
extends WiQueryAbstractBehavior

$Id$

Sets the attached component resizable.

Since:
1.0
Author:
Lionel Armanet
See Also:
Serialized Form

Field Summary
static String UI_HELPER
          Properties on the ui parameter (use it into callback functions) : a jQuery object containing the helper element
static String UI_ORIGIGNALPOSITION
          Properties on the ui parameter (use it into callback functions) : {top, left} before resizing started
static String UI_ORIGINALSIZE
          Properties on the ui parameter (use it into callback functions) : {width, height} before resizing started
static String UI_POSITION
          Properties on the ui parameter (use it into callback functions) : {top, left} current position
static String UI_SIZE
          Properties on the ui parameter (use it into callback functions) : {width, height} current size
 
Constructor Summary
ResizableBehavior()
           
 
Method Summary
 JsStatement destroy()
          Method to destroy This will return the element back to its pre-init state.
 void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to destroy within the ajax request
 void detach(org.apache.wicket.Component component)
           
 JsStatement disable()
          Method to disable
 void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to disable within the ajax request
 JsStatement enable()
          Method to enable
 void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to enable within the ajax request
 String getAlsoResize()
          Deprecated. will be changed in 1.2 to return a ResizableAlsoResize
 ResizableAlsoResize getAlsoResizeComplex()
           
 ResizableAnimeDuration getAnimateDuration()
           
 String getAnimateEasing()
           
 ResizableAspectRatio getAspectRatio()
           
 String getCancel()
           
 ResizableContainment getContainment()
           
 int getDelay()
           
 int getDistance()
           
 ICollectionItemOptions getGrid()
           
 ResizableHandles getHandles()
           
 String getHelper()
           
 int getMaxHeight()
          Returns the component's max height.
 int getMaxWidth()
          Returns the component's max width.
 int getMinHeight()
          Returns the component's min height.
 int getMinWidth()
          Returns the component's max width.
protected  Options getOptions()
          Method retrieving the options of the component
 boolean isAnimate()
           
 boolean isAutoHide()
           
 boolean isDisabled()
           
 boolean isGhost()
           
 void onBind()
          Called when the component was bound to it's host component.
 void renderHead(org.apache.wicket.Component component, org.apache.wicket.markup.html.IHeaderResponse response)
           
 ResizableBehavior setAlsoResize(ResizableAlsoResize alsoResize)
          Resize these elements synchronous when resizing.
 ResizableBehavior setAlsoResize(String cssSelector)
          Deprecated. will be removed in 1.2
 ResizableBehavior setAnimate(boolean animate)
          Animates to the final size after resizing.
 ResizableBehavior setAnimateDuration(ResizableAnimeDuration animeDuration)
          Sets the duration time for animating, in milliseconds.
 ResizableBehavior setAnimateEasing(String easing)
          Sets the easing effect for animating.
 ResizableBehavior setAspectRatio(ResizableAspectRatio aspectRatio)
          If set to true, resizing is constrained by the original aspect ratio.
 ResizableBehavior setAutoHide(boolean autoHide)
          If set to true, automatically hides the handles except when the mouse hovers over the element.
 ResizableBehavior setCancel(String cancel)
          Prevents resizing if you start on elements matching the selector.
 ResizableBehavior setContainment(ResizableContainment containment)
          Sets the constrains resizing to within the bounds of the specified element.
 ResizableBehavior setDelay(int delay)
          Sets the tolerance, in milliseconds, for when resizing should start.
 ResizableBehavior setDisabled(boolean disabled)
          Disables (true) or enables (false) the resizable.
 ResizableBehavior setDistance(int distance)
          Sets the tolerance, in pixels, for when resizing should start.
 ResizableBehavior setGhost(boolean ghost)
          Set to true, a semi-transparent helper element is shown for resizing.
 ResizableBehavior setGrid(int x, int y)
          Snaps the resizing element to a grid, every x and y pixels.
 ResizableBehavior setHandles(ResizableHandles handles)
          If specified as a string, should be a comma-split list of any of the following: 'n, e, s, w, ne, se, sw, nw, all'.
 ResizableBehavior setHelper(String helper)
          Sets the css class that will be added to a proxy element to outline the resize during the drag of the resize handle.
 ResizableBehavior setMaxHeight(int maxHeight)
          Sets the component's max height.
 ResizableBehavior setMaxWidth(int maxWidth)
          Sets the window's max width.
 ResizableBehavior setMinHeight(int minHeight)
          Sets the component's min height.
 ResizableBehavior setMinWidth(int minWidth)
          Sets the component's min width.
 ResizableBehavior setResizeEvent(JsScopeUiEvent resize)
          Set's the callback when the event is triggered during the resize, on the drag of the resize handler.
 ResizableBehavior setStartEvent(JsScopeUiEvent start)
          Set's the callback when the event is triggered at the start of a resize operation.
 ResizableBehavior setStopEvent(JsScopeUiEvent stop)
          Set's the callback when the event is triggered at the end of a resize operation.
 JsStatement statement()
          Returns the main JsStatement used to create the plugin.
 JsStatement widget()
          Method to returns the .ui-resizable element
 void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to returns the .ui-resizable element within the ajax request
 
Methods inherited from class org.odlabs.wiquery.core.behavior.WiQueryAbstractBehavior
bind, getComponent
 
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UI_HELPER

public static final String UI_HELPER
Properties on the ui parameter (use it into callback functions) : a jQuery object containing the helper element

See Also:
Constant Field Values

UI_ORIGIGNALPOSITION

public static final String UI_ORIGIGNALPOSITION
Properties on the ui parameter (use it into callback functions) : {top, left} before resizing started

See Also:
Constant Field Values

UI_ORIGINALSIZE

public static final String UI_ORIGINALSIZE
Properties on the ui parameter (use it into callback functions) : {width, height} before resizing started

See Also:
Constant Field Values

UI_POSITION

public static final String UI_POSITION
Properties on the ui parameter (use it into callback functions) : {top, left} current position

See Also:
Constant Field Values

UI_SIZE

public static final String UI_SIZE
Properties on the ui parameter (use it into callback functions) : {width, height} current size

See Also:
Constant Field Values
Constructor Detail

ResizableBehavior

public ResizableBehavior()
Method Detail

onBind

public void onBind()
Description copied from class: WiQueryAbstractBehavior
Called when the component was bound to it's host component. You can get the bound host component by calling getComponent.

Overrides:
onBind in class WiQueryAbstractBehavior

detach

public void detach(org.apache.wicket.Component component)
Overrides:
detach in class org.apache.wicket.behavior.Behavior

renderHead

public void renderHead(org.apache.wicket.Component component,
                       org.apache.wicket.markup.html.IHeaderResponse response)
Specified by:
renderHead in interface org.apache.wicket.markup.html.IComponentAwareHeaderContributor
Overrides:
renderHead in class org.apache.wicket.behavior.Behavior

statement

public JsStatement statement()
Description copied from interface: IWiQueryPlugin
Returns the main JsStatement used to create the plugin.

Specified by:
statement in interface IWiQueryPlugin
Specified by:
statement in class WiQueryAbstractBehavior
Returns:
The JsStatement corresponding to this component.

getOptions

protected Options getOptions()
Method retrieving the options of the component

Returns:
the options

setAlsoResize

@Deprecated
public ResizableBehavior setAlsoResize(String cssSelector)
Deprecated. will be removed in 1.2

Resize these elements synchronous when resizing.

Parameters:
cssSelector -
Returns:
instance of the current behavior

getAlsoResize

@Deprecated
public String getAlsoResize()
Deprecated. will be changed in 1.2 to return a ResizableAlsoResize

Returns:
the alsoResize option

setAlsoResize

public ResizableBehavior setAlsoResize(ResizableAlsoResize alsoResize)
Resize these elements synchronous when resizing.

Parameters:
alsoResize -
Returns:
instance of the current behavior

getAlsoResizeComplex

public ResizableAlsoResize getAlsoResizeComplex()
Returns:
the alsoResize option

setAnimate

public ResizableBehavior setAnimate(boolean animate)
Animates to the final size after resizing.

Parameters:
animate -
Returns:
instance of the current behavior

isAnimate

public boolean isAnimate()
Returns:
the animate option

setAnimateDuration

public ResizableBehavior setAnimateDuration(ResizableAnimeDuration animeDuration)
Sets the duration time for animating, in milliseconds. Other possible values: 'slow', 'normal', 'fast'.

Returns:
instance of the current behavior

getAnimateDuration

public ResizableAnimeDuration getAnimateDuration()
Returns:
the animeDuration option

setAnimateEasing

public ResizableBehavior setAnimateEasing(String easing)
Sets the easing effect for animating.

Parameters:
easing -
Returns:
instance of the current behavior

getAnimateEasing

public String getAnimateEasing()
Returns:
the animateEasing option

setAspectRatio

public ResizableBehavior setAspectRatio(ResizableAspectRatio aspectRatio)
If set to true, resizing is constrained by the original aspect ratio. Otherwise a custom aspect ratio can be specified, such as 9 / 16, or 0.5.

Parameters:
aspectRatio -
Returns:
instance of the current behavior

getAspectRatio

public ResizableAspectRatio getAspectRatio()
Returns:
the aspectRatio option

setAutoHide

public ResizableBehavior setAutoHide(boolean autoHide)
If set to true, automatically hides the handles except when the mouse hovers over the element.

Parameters:
autoHide -
Returns:
instance of the current behavior

isAutoHide

public boolean isAutoHide()
Returns:
the autoHide option

setCancel

public ResizableBehavior setCancel(String cancel)
Prevents resizing if you start on elements matching the selector.

Parameters:
cancel -
Returns:
instance of the current behavior

getCancel

public String getCancel()
Returns:
the cancel option

setContainment

public ResizableBehavior setContainment(ResizableContainment containment)
Sets the constrains resizing to within the bounds of the specified element. Possible values: 'parent', 'document', a DOMElement, or a Selector.

Parameters:
containment -
Returns:
instance of the current behavior

getContainment

public ResizableContainment getContainment()
Returns:
the containment option

setDelay

public ResizableBehavior setDelay(int delay)
Sets the tolerance, in milliseconds, for when resizing should start. If specified, resizing will not start until after mouse is moved beyond duration. This can help prevent unintended resizing when clicking on an element.

Parameters:
delay -
Returns:
instance of the current behavior

getDelay

public int getDelay()
Returns:
the distance option

setDistance

public ResizableBehavior setDistance(int distance)
Sets the tolerance, in pixels, for when resizing should start. If specified, resizing will not start until after mouse is moved beyond distance. This can help prevent unintended resizing when clicking on an element.

Parameters:
distance -
Returns:
instance of the current behavior

getDistance

public int getDistance()
Returns:
the distance option

setDisabled

public ResizableBehavior setDisabled(boolean disabled)
Disables (true) or enables (false) the resizable. Can be set when initialising (first creating) the resizable.

Parameters:
disabled -
Returns:
instance of the current behavior

isDisabled

public boolean isDisabled()
Returns:
the disabled option

setGhost

public ResizableBehavior setGhost(boolean ghost)
Set to true, a semi-transparent helper element is shown for resizing.

Parameters:
ghost -
Returns:
instance of the current behavior

isGhost

public boolean isGhost()
Returns:
the ghost option

setGrid

public ResizableBehavior setGrid(int x,
                                 int y)
Snaps the resizing element to a grid, every x and y pixels. Array values: [x, y] Array values: [x, y]

Parameters:
x -
y -
Returns:
instance of the current behavior

getGrid

public ICollectionItemOptions getGrid()
Returns:
the grid option value

setHandles

public ResizableBehavior setHandles(ResizableHandles handles)
If specified as a string, should be a comma-split list of any of the following: 'n, e, s, w, ne, se, sw, nw, all'. The necessary handles will be auto-generated by the plugin. If specified as an object, the following keys are supported: { n, e, s, w, ne, se, sw, nw }. The value of any specified should be a jQuery selector matching the child element of the resizable to use as that handle. If the handle is not a child of the resizable, you can pass in the DOMElement or a valid jQuery object directly.

Parameters:
handles -
Returns:
instance of the current behavior

getHandles

public ResizableHandles getHandles()
Returns:
the handles option

setHelper

public ResizableBehavior setHelper(String helper)
Sets the css class that will be added to a proxy element to outline the resize during the drag of the resize handle. Once the resize is complete, the original element is sized.

Parameters:
helper -
Returns:
instance of the current behavior

getHelper

public String getHelper()
Returns:
the helper option

setMaxHeight

public ResizableBehavior setMaxHeight(int maxHeight)
Sets the component's max height.

Returns:
instance of the current behavior

getMaxHeight

public int getMaxHeight()
Returns the component's max height.


setMaxWidth

public ResizableBehavior setMaxWidth(int maxWidth)
Sets the window's max width.

Returns:
instance of the current behavior

getMaxWidth

public int getMaxWidth()
Returns the component's max width.


setMinHeight

public ResizableBehavior setMinHeight(int minHeight)
Sets the component's min height.

Returns:
instance of the current behavior

getMinHeight

public int getMinHeight()
Returns the component's min height.


setMinWidth

public ResizableBehavior setMinWidth(int minWidth)
Sets the component's min width.

Returns:
instance of the current behavior

getMinWidth

public int getMinWidth()
Returns the component's max width.


setResizeEvent

public ResizableBehavior setResizeEvent(JsScopeUiEvent resize)
Set's the callback when the event is triggered during the resize, on the drag of the resize handler.

Parameters:
resize -
Returns:
instance of the current behavior

setStartEvent

public ResizableBehavior setStartEvent(JsScopeUiEvent start)
Set's the callback when the event is triggered at the start of a resize operation.

Parameters:
start -
Returns:
instance of the current behavior

setStopEvent

public ResizableBehavior setStopEvent(JsScopeUiEvent stop)
Set's the callback when the event is triggered at the end of a resize operation.

Parameters:
stop -
Returns:
instance of the current behavior

destroy

public JsStatement destroy()
Method to destroy This will return the element back to its pre-init state.

Returns:
the associated JsStatement

destroy

public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy within the ajax request

Parameters:
ajaxRequestTarget -

disable

public JsStatement disable()
Method to disable

Returns:
the associated JsStatement

disable

public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable within the ajax request

Parameters:
ajaxRequestTarget -

enable

public JsStatement enable()
Method to enable

Returns:
the associated JsStatement

enable

public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable within the ajax request

Parameters:
ajaxRequestTarget -

widget

public JsStatement widget()
Method to returns the .ui-resizable element

Returns:
the associated JsStatement

widget

public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-resizable element within the ajax request

Parameters:
ajaxRequestTarget -


Copyright © 2012. All Rights Reserved.