com.sencha.gxt.widget.core.client
Class Resizable

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.Resizable
All Implemented Interfaces:
ResizeEndEvent.HasResizeEndHandlers, ResizeStartEvent.HasResizeStartHandlers

public class Resizable
extends java.lang.Object
implements ResizeStartEvent.HasResizeStartHandlers, ResizeEndEvent.HasResizeEndHandlers

Applies drag handles to a widget to make it resizable. The drag handles are inserted into the widget and positioned absolute.

Only Component instances can be used with Resizable as Widget's do not fire resize events. Widgets can be wrapped in a WidgetComponent instance to use with Resizable.

Here is the list of valid resize handles:

 Value   Description
 ------  -------------------
 'n'     north
 's'     south
 'e'     east
 'w'     west
 'nw'    northwest
 'sw'    southwest
 'se'    southeast
 'ne'    northeast
 'all'   all
 


Nested Class Summary
static class Resizable.Dir
          The location of the resize handle in standard compass points.
static interface Resizable.ResizableAppearance
           
 
Constructor Summary
Resizable(Component resize)
          Creates a new resizable instance with 8-way resizing.
Resizable(Component resize, Resizable.Dir... handles)
          Creates a new resizable instance with the default appearance.
Resizable(Resizable.ResizableAppearance appearance, Component resize, Resizable.Dir... handles)
          Creates a new resizable instance with the specified appearance.
 
Method Summary
 HandlerRegistration addResizeEndHandler(ResizeEndEvent.ResizeEndHandler handler)
          Adds a ResizeEndEvent.ResizeEndHandler handler for ResizeEndEvent events.
 HandlerRegistration addResizeStartHandler(ResizeStartEvent.ResizeStartHandler handler)
          Adds a ResizeStartEvent.ResizeStartHandler handler for ResizeStartEvent events.
 int getMaxHeight()
          Returns the max height
 int getMaxWidth()
          Returns the max width.
 int getMinHeight()
          Returns the minimum height.
 int getMinWidth()
          Returns the minimum width.
 boolean isDynamic()
          Returns true if widget is being resized directly.
 boolean isPreserveRatio()
          Returns true if the aspect ratio is being preserved.
 boolean isResizing()
          Returns true if if resizing.
 void release()
          Removes the drag handles.
 void setDynamic(boolean dynamic)
          True to resize the widget directly instead of using a proxy (defaults to false).
 void setEnabled(boolean enable)
          Enables or disables the drag handles.
 void setMaxHeight(int maxHeight)
          Sets the max height (defaults to 2000).
 void setMaxWidth(int maxWidth)
          Sets the max width (defaults to 2000).
 void setMinHeight(int minHeight)
          Sets the minimum height (default to 50).
 void setMinWidth(int minWidth)
          Sets the minimum width (defaults to 50).
 void setPreserveRatio(boolean preserveRatio)
          True to preserve the original ratio between height and width during resize (defaults to false).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resizable

public Resizable(Component resize)
Creates a new resizable instance with 8-way resizing.

Parameters:
resize - the resize widget

Resizable

public Resizable(Component resize,
                 Resizable.Dir... handles)
Creates a new resizable instance with the default appearance.

Parameters:
resize - the resize widget
handles - the resize handle locations

Resizable

public Resizable(Resizable.ResizableAppearance appearance,
                 Component resize,
                 Resizable.Dir... handles)
Creates a new resizable instance with the specified appearance.

Parameters:
appearance - the appearance of the resizable
resize - the resize widget
handles - the resize handle locations
Method Detail

addResizeEndHandler

public HandlerRegistration addResizeEndHandler(ResizeEndEvent.ResizeEndHandler handler)
Description copied from interface: ResizeEndEvent.HasResizeEndHandlers
Adds a ResizeEndEvent.ResizeEndHandler handler for ResizeEndEvent events.

Specified by:
addResizeEndHandler in interface ResizeEndEvent.HasResizeEndHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addResizeStartHandler

public HandlerRegistration addResizeStartHandler(ResizeStartEvent.ResizeStartHandler handler)
Description copied from interface: ResizeStartEvent.HasResizeStartHandlers
Adds a ResizeStartEvent.ResizeStartHandler handler for ResizeStartEvent events.

Specified by:
addResizeStartHandler in interface ResizeStartEvent.HasResizeStartHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

getMaxHeight

public int getMaxHeight()
Returns the max height

Returns:
the max height

getMaxWidth

public int getMaxWidth()
Returns the max width.

Returns:
the max width

getMinHeight

public int getMinHeight()
Returns the minimum height.

Returns:
the minimum height

getMinWidth

public int getMinWidth()
Returns the minimum width.

Returns:
the minimum width

isDynamic

public boolean isDynamic()
Returns true if widget is being resized directly.

Returns:
the dynamic state

isPreserveRatio

public boolean isPreserveRatio()
Returns true if the aspect ratio is being preserved.

Returns:
true if the aspect ratio is being preserved

isResizing

public boolean isResizing()
Returns true if if resizing.

Returns:
the resize state

release

public void release()
Removes the drag handles.


setDynamic

public void setDynamic(boolean dynamic)
True to resize the widget directly instead of using a proxy (defaults to false).

Parameters:
dynamic - true to resize directly

setEnabled

public void setEnabled(boolean enable)
Enables or disables the drag handles.

Parameters:
enable - true to enable

setMaxHeight

public void setMaxHeight(int maxHeight)
Sets the max height (defaults to 2000).

Parameters:
maxHeight - the max height

setMaxWidth

public void setMaxWidth(int maxWidth)
Sets the max width (defaults to 2000).

Parameters:
maxWidth - the max width

setMinHeight

public void setMinHeight(int minHeight)
Sets the minimum height (default to 50).

Parameters:
minHeight - the minimum height

setMinWidth

public void setMinWidth(int minWidth)
Sets the minimum width (defaults to 50).

Parameters:
minWidth - the minimum width

setPreserveRatio

public void setPreserveRatio(boolean preserveRatio)
True to preserve the original ratio between height and width during resize (defaults to false).

Parameters:
preserveRatio - true to preserve the original aspect ratio


Copyright © 2012. All Rights Reserved.