org.sgx.j2s.aui
Class Resize

Package class diagram package Resize
java.lang.Object
  extended by org.sgx.j2s.js.NativeWrapper
      extended by org.sgx.j2s.yui3.yui.YUINativeWrapper
          extended by org.sgx.j2s.yui3.yui.event.EventTarget
              extended by org.sgx.j2s.yui3.yui.Attribute
                  extended by org.sgx.j2s.yui3.yui.Base
                      extended by org.sgx.j2s.aui.Resize

public class Resize
extends Base

A base class for Resize, providing:
Basic Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)
Applies drag handles to an element to make it resizable
Here is the list of valid resize handles: [ 't', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl' ]. You can read this list as top, top-right, right, bottom-right, bottom, bottom-left, left, top-left.
The drag handles are inserted into the element and positioned absolute. Some elements, such as a textarea or image, don't support children. To overcome that, set wrap:true in your config and the element willbe wrapped for you automatically.
Quick Example:

var instance = new A.Resize({
        node: '#resize1',
        proxy: true,
        preserveRatio: true,
        wrap: true,
        maxHeight: 170,
        maxWidth: 400,
        handles: 't, tr, r, br, b, bl, l, tl'
});


Field Summary
 
Fields inherited from class org.sgx.j2s.yui3.yui.YUINativeWrapper
Y
 
Fields inherited from class org.sgx.j2s.js.NativeWrapper
_data, _EMPTYPARAMS
 
Constructor Summary
Resize()
           
 
Method Summary
 void eachHandle(java.lang.Runnable fn)
          Loop through each handle which is being used and executes a callback.
 java.lang.Object getConstrain2node()
          Constrain the resize to a particular node.
 java.lang.Object getConstrain2region()
          Constrain the resize to a particular region.
 java.lang.Object getConstrain2view()
          constrain2view - Object Will attempt to constrain the drag node to the boundaries of the viewport region.
 java.lang.String[] getHandles()
          handles - Array | String The handles to use (any combination of): 't', 'b', 'r', 'l', 'bl', 'br', 'tl', 'tr'.
 int getMaxHeight()
          The maximum height of the element Default Value: Infinity
 int getMaxWidth()
          maxWidth - Number The maximum width of the element Default Value: Infinity
 int getMinHeight()
          minHeight - Number The minimum height of the element Default Value: 15
 int getMinWidth()
          minWidth - Number The minimum width of the element Default Value: 15
 java.lang.Object getNode()
          node - Node The selector or element to resize.
 java.lang.Object getProxyEl()
          proxyEl - String | Node The Resize proxy element.
 java.lang.Object getTickX()
          tickX - Number | false The number of x ticks to span the resize to.
 java.lang.Object getTickY()
          tickY - Number | false The number of y ticks to span the resize to.
 java.lang.Object getWrapper()
          wrapper - writeonce String | Node Element to wrap the wrapTypes.
 java.lang.Object getWrapTypes()
          wrapTypes - Regex Elements that requires a wrapper by default.
 boolean isAutoHide()
          False to ensure that the resize handles are always visible, true to display them only when the user mouses over the resizable borders.
 boolean isPreserveRatio()
          preserveRatio - boolean Maintain the element's ratio when resizing.
 boolean isProxy()
          proxy - boolean Resize a proxy element instead of the real element.
 boolean isResizing()
          resizing - boolean True when the element is being Resized.
 boolean isWrap()
          wrap - boolean True to wrap an element with a div if needed (required for textareas and images, defaults to false) in favor of the handles config option.
 void setAutoHide(boolean autoHide)
          False to ensure that the resize handles are always visible, true to display them only when the user mouses over the resizable borders.
 void setConstrain2node(java.lang.Object constrain2node)
          Constrain the resize to a particular node.
 void setConstrain2region(java.lang.Object constrain2region)
          Constrain the resize to a particular region.
 void setConstrain2view(java.lang.Object constrain2view)
          constrain2view - Object Will attempt to constrain the drag node to the boundaries of the viewport region.
 void setHandles(java.lang.String[] handles)
          handles - Array | String The handles to use (any combination of): 't', 'b', 'r', 'l', 'bl', 'br', 'tl', 'tr'.
 void setMaxHeight(int maxHeight)
          The maximum height of the element Default Value: Infinity
 void setMaxWidth(int maxWidth)
          maxWidth - Number The maximum width of the element Default Value: Infinity
 void setMinHeight(int minHeight)
          minHeight - Number The minimum height of the element Default Value: 15
 void setMinWidth(int minWidth)
          minWidth - Number The minimum width of the element Default Value: 15
 void setNode(java.lang.Object node)
          node - Node The selector or element to resize.
 void setPreserveRatio(boolean preserveRatio)
          preserveRatio - boolean Maintain the element's ratio when resizing.
 void setProxy(boolean proxy)
          proxy - boolean Resize a proxy element instead of the real element.
 void setProxyEl(java.lang.Object proxyEl)
          proxyEl - String | Node The Resize proxy element.
 void setResizing(boolean resizing)
          resizing - boolean True when the element is being Resized.
 void setTickX(java.lang.Object tickX)
          tickX - Number | false The number of x ticks to span the resize to.
 void setTickY(java.lang.Object tickY)
          tickY - Number | false The number of y ticks to span the resize to.
 void setWrap(boolean wrap)
          wrap - boolean True to wrap an element with a div if needed (required for textareas and images, defaults to false) in favor of the handles config option.
 void setWrapper(java.lang.Object wrapper)
          wrapper - writeonce String | Node Element to wrap the wrapTypes.
 void setWrapTypes(java.lang.Object wrapTypes)
          wrapTypes - Regex Elements that requires a wrapper by default.
 
Methods inherited from class org.sgx.j2s.yui3.yui.Attribute
addAttr, addAttrs, attrAdded, get, getAttrs, modifyAttr, removeAttr, reset, set, setAttrs
 
Methods inherited from class org.sgx.j2s.yui3.yui.event.EventTarget
after, before, detach, detachAll, fire, getEvent, on, once, publish
 
Methods inherited from class org.sgx.j2s.yui3.yui.YUINativeWrapper
_load
 
Methods inherited from class org.sgx.j2s.js.NativeWrapper
_call, _get, _getData, create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resize

public Resize()
Method Detail

isAutoHide

public boolean isAutoHide()
False to ensure that the resize handles are always visible, true to display them only when the user mouses over the resizable borders. Default Value: false


setAutoHide

public void setAutoHide(boolean autoHide)
False to ensure that the resize handles are always visible, true to display them only when the user mouses over the resizable borders. Default Value: false


getConstrain2node

public java.lang.Object getConstrain2node()
Constrain the resize to a particular node. Will attempt to constrain the drag node to the boundaries of this node. Default Value: null


setConstrain2node

public void setConstrain2node(java.lang.Object constrain2node)
Constrain the resize to a particular node. Will attempt to constrain the drag node to the boundaries of this node. Default Value: null


getConstrain2region

public java.lang.Object getConstrain2region()
Constrain the resize to a particular region. An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to. Default Value: null


setConstrain2region

public void setConstrain2region(java.lang.Object constrain2region)
Constrain the resize to a particular region. An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to. Default Value: null


getConstrain2view

public java.lang.Object getConstrain2view()
constrain2view - Object Will attempt to constrain the drag node to the boundaries of the viewport region.


setConstrain2view

public void setConstrain2view(java.lang.Object constrain2view)
constrain2view - Object Will attempt to constrain the drag node to the boundaries of the viewport region.


getHandles

public java.lang.String[] getHandles()
handles - Array | String The handles to use (any combination of): 't', 'b', 'r', 'l', 'bl', 'br', 'tl', 'tr'. Can use a shortcut of All. Default Value: all


setHandles

public void setHandles(java.lang.String[] handles)
handles - Array | String The handles to use (any combination of): 't', 'b', 'r', 'l', 'bl', 'br', 'tl', 'tr'. Can use a shortcut of All. Default Value: all


getMaxHeight

public int getMaxHeight()
The maximum height of the element Default Value: Infinity


setMaxHeight

public void setMaxHeight(int maxHeight)
The maximum height of the element Default Value: Infinity


getMaxWidth

public int getMaxWidth()
maxWidth - Number The maximum width of the element Default Value: Infinity


setMaxWidth

public void setMaxWidth(int maxWidth)
maxWidth - Number The maximum width of the element Default Value: Infinity


getMinHeight

public int getMinHeight()
minHeight - Number The minimum height of the element Default Value: 15


setMinHeight

public void setMinHeight(int minHeight)
minHeight - Number The minimum height of the element Default Value: 15


getMinWidth

public int getMinWidth()
minWidth - Number The minimum width of the element Default Value: 15


setMinWidth

public void setMinWidth(int minWidth)
minWidth - Number The minimum width of the element Default Value: 15


getNode

public java.lang.Object getNode()
node - Node The selector or element to resize. Required.


setNode

public void setNode(java.lang.Object node)
node - Node The selector or element to resize. Required.


isPreserveRatio

public boolean isPreserveRatio()
preserveRatio - boolean Maintain the element's ratio when resizing. Default Value: false


setPreserveRatio

public void setPreserveRatio(boolean preserveRatio)
preserveRatio - boolean Maintain the element's ratio when resizing. Default Value: false


isProxy

public boolean isProxy()
proxy - boolean Resize a proxy element instead of the real element. Default Value: false


setProxy

public void setProxy(boolean proxy)
proxy - boolean Resize a proxy element instead of the real element. Default Value: false


getProxyEl

public java.lang.Object getProxyEl()
proxyEl - String | Node The Resize proxy element. Default Value: Generated using an internal HTML markup


setProxyEl

public void setProxyEl(java.lang.Object proxyEl)
proxyEl - String | Node The Resize proxy element. Default Value: Generated using an internal HTML markup


isResizing

public boolean isResizing()
resizing - boolean True when the element is being Resized. Default Value: false


setResizing

public void setResizing(boolean resizing)
resizing - boolean True when the element is being Resized. Default Value: false


getTickX

public java.lang.Object getTickX()
tickX - Number | false The number of x ticks to span the resize to. Default Value: false


setTickX

public void setTickX(java.lang.Object tickX)
tickX - Number | false The number of x ticks to span the resize to. Default Value: false


getTickY

public java.lang.Object getTickY()
tickY - Number | false The number of y ticks to span the resize to. Default Value: false


setTickY

public void setTickY(java.lang.Object tickY)
tickY - Number | false The number of y ticks to span the resize to. Default Value: false


isWrap

public boolean isWrap()
wrap - boolean True to wrap an element with a div if needed (required for textareas and images, defaults to false) in favor of the handles config option. The wrapper element type (default div) could be over-riden passing the wrapper attribute. Default Value: false


setWrap

public void setWrap(boolean wrap)
wrap - boolean True to wrap an element with a div if needed (required for textareas and images, defaults to false) in favor of the handles config option. The wrapper element type (default div) could be over-riden passing the wrapper attribute. Default Value: false


getWrapper

public java.lang.Object getWrapper()
wrapper - writeonce String | Node Element to wrap the wrapTypes. This element will house the handles elements. Default Value: div


setWrapper

public void setWrapper(java.lang.Object wrapper)
wrapper - writeonce String | Node Element to wrap the wrapTypes. This element will house the handles elements. Default Value: div


getWrapTypes

public java.lang.Object getWrapTypes()
wrapTypes - Regex Elements that requires a wrapper by default. Normally are elements which cannot have children elements. Default Value: /canvas|textarea|input|select|button|img/i


setWrapTypes

public void setWrapTypes(java.lang.Object wrapTypes)
wrapTypes - Regex Elements that requires a wrapper by default. Normally are elements which cannot have children elements. Default Value: /canvas|textarea|input|select|button|img/i


eachHandle

public void eachHandle(java.lang.Runnable fn)
Loop through each handle which is being used and executes a callback.

                Example:

                instance.eachHandle(
                function(handleName, index) { ... }
                );

                Parameters:
                    fn  Callback function to be executed for each handle.