com.extjs.gxt.ui.client.widget.layout
Class FormLayout

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.Layout
          extended by com.extjs.gxt.ui.client.widget.layout.AnchorLayout
              extended by com.extjs.gxt.ui.client.widget.layout.FormLayout
All Implemented Interfaces:
Observable

public class FormLayout
extends AnchorLayout

Layout for form fields and their labels. FormLayout will only render Field subclasses. All other components will be ignored.

To add a component that is not a Field subclass, see AdapterField. To add plain text see LabelField.


Field Summary
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Layout
activeItem, componentStyleName, container, monitorResize, renderHidden, target, targetStyleName
 
Constructor Summary
FormLayout()
          Creates a new form layout.
FormLayout(FormPanel.LabelAlign labelAlign)
          Creates a new form layout.
 
Method Summary
protected  int adjustHeightAnchor(int height, Component comp)
           
protected  int adjustWidthAnchor(int width, Component comp)
           
 int getDefaultWidth()
          Returns the default field width.
 boolean getHideLabels()
          Returns true if labels are being hidden.
 FormPanel.LabelAlign getLabelAlign()
          Returns the label alignment.
 int getLabelPad()
          Returns the label pad.
 java.lang.String getLabelSeparator()
          Returns the label separator.
 int getLabelWidth()
          Returns the label width.
protected  void initTarget()
           
protected  void onComponentHide(Component component)
           
protected  void onComponentShow(Component component)
           
protected  void onLayout(Container<?> container, El target)
           
protected  void onRemove(Component component)
           
protected  void renderComponent(Component component, int index, El target)
           
protected  void renderField(Field<?> field, int index, El target)
           
 void setContainer(Container<?> ct)
          Sets the layout's container.
 void setDefaultWidth(int defaultWidth)
          Sets the default width for fields (defaults to 200).
 void setHideLabels(boolean hideLabels)
          True to hide field labels by default (defaults to false).
 void setLabelAlign(FormPanel.LabelAlign labelAlign)
          Sets the label alignment.
 void setLabelPad(int labelPad)
          The default padding in pixels for field labels (defaults to 0).
 void setLabelSeparator(java.lang.String labelSeparator)
          Sets the label separator (defaults to ':').
 void setLabelWidth(int labelWidth)
          Sets the default width in pixels of field labels (defaults to 100).
 
Methods inherited from class com.extjs.gxt.ui.client.widget.layout.AnchorLayout
getAnchorSize, setAnchorSize
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Layout
applyMargins, applyPadding, callLayout, fly, fly, getExtraStyle, getLayoutData, getResizeDelay, getSideMargins, isLayoutExecuted, isLayoutNeeded, isRenderHidden, isRunning, isValidParent, layout, layoutContainer, onAdd, onResize, renderAll, setBounds, setExtraStyle, setLayoutData, setLayoutNeeded, setLayoutOnChange, setPosition, setRenderHidden, setResizeDelay, setSize
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormLayout

public FormLayout()
Creates a new form layout.


FormLayout

public FormLayout(FormPanel.LabelAlign labelAlign)
Creates a new form layout.

Parameters:
labelAlign - the label alignment
Method Detail

getDefaultWidth

public int getDefaultWidth()
Returns the default field width.

Returns:
the default field width

getHideLabels

public boolean getHideLabels()
Returns true if labels are being hidden.

Returns:
the hide label state

getLabelAlign

public FormPanel.LabelAlign getLabelAlign()
Returns the label alignment.

Returns:
the label alignment

getLabelPad

public int getLabelPad()
Returns the label pad.

Returns:
the label pad

getLabelSeparator

public java.lang.String getLabelSeparator()
Returns the label separator.

Returns:
the label separator

getLabelWidth

public int getLabelWidth()
Returns the label width.

Returns:
the label width

setContainer

public void setContainer(Container<?> ct)
Description copied from class: Layout
Sets the layout's container.

Overrides:
setContainer in class Layout
Parameters:
ct - the container

setDefaultWidth

public void setDefaultWidth(int defaultWidth)
Sets the default width for fields (defaults to 200).

Parameters:
defaultWidth - the default width

setHideLabels

public void setHideLabels(boolean hideLabels)
True to hide field labels by default (defaults to false).

Parameters:
hideLabels - true to hide labels

setLabelAlign

public void setLabelAlign(FormPanel.LabelAlign labelAlign)
Sets the label alignment.

Parameters:
labelAlign - the label align

setLabelPad

public void setLabelPad(int labelPad)
The default padding in pixels for field labels (defaults to 0). labelPad only applies if labelWidth is also specified, otherwise it will be ignored.

Parameters:
labelPad - the label pad

setLabelSeparator

public void setLabelSeparator(java.lang.String labelSeparator)
Sets the label separator (defaults to ':').

Parameters:
labelSeparator - the label separator

setLabelWidth

public void setLabelWidth(int labelWidth)
Sets the default width in pixels of field labels (defaults to 100).

Parameters:
labelWidth - the label width

adjustHeightAnchor

protected int adjustHeightAnchor(int height,
                                 Component comp)
Overrides:
adjustHeightAnchor in class AnchorLayout

adjustWidthAnchor

protected int adjustWidthAnchor(int width,
                                Component comp)
Overrides:
adjustWidthAnchor in class AnchorLayout

initTarget

protected void initTarget()
Overrides:
initTarget in class Layout

onComponentHide

protected void onComponentHide(Component component)
Overrides:
onComponentHide in class Layout

onComponentShow

protected void onComponentShow(Component component)
Overrides:
onComponentShow in class Layout

onLayout

protected void onLayout(Container<?> container,
                        El target)
Overrides:
onLayout in class AnchorLayout

onRemove

protected void onRemove(Component component)
Overrides:
onRemove in class Layout

renderComponent

protected void renderComponent(Component component,
                               int index,
                               El target)
Overrides:
renderComponent in class Layout

renderField

protected void renderField(Field<?> field,
                           int index,
                           El target)