Clear Up
SharpKit Reference

Layout Class

Base Layout class - extended by ComponentLayout and ContainerLayout

Namespace: Ext.layout

Base Types

Constructors

Methods

Name Description
afterRemove(object) Removes layout's itemCls and owning Container's itemCls. Clears the managed dimensions flags
beginLayout(ContextItem) Called before any calculation cycles to prepare for layout. This is a write phase and DOM reads should be strictly avoided when overridding this method.
beginLayoutCycle(ContextItem) Called before any calculation cycles to reset DOM values and prepare for calculation. This is a write phase and DOM reads should be strictly avoided when overridding this method.
calculate(ContextItem) Called to perform the calculations for this layout. This method will be called at least once and may be called repeatedly if the done property is cleared before return to indicate that this layout is not yet done. The done property is always set to true before entering this method. This is a read phase and DOM writes should be strictly avoided in derived classes. Instead, DOM writes need to be written to Ext.layout.ContextItem objects to be flushed at the next opportunity.
completeLayout(ContextItem) This method (if implemented) is called at the end of the cycle in which this layout completes (by not setting done to false in calculate). It is possible for the layout to complete and yet become invalid before the end of the cycle, in which case, this method will not be called. It is also possible for this method to be called and then later the layout becomes invalidated. This will result in calculate being called again, followed by another call to this method. This is a read phase and DOM writes should be strictly avoided in derived classes. Instead, DOM writes need to be written to Ext.layout.ContextItem objects to be flushed at the next opportunity. This method need not be implemented by derived classes and, in fact, should only be implemented when needed.
configureItem(Component) Called before an item is rendered to allow the layout to configure the item.
finalizeLayout(ContextItem) This method (if implemented) is called after all layouts have completed. In most ways this is similar to completeLayout. This call can cause this (or any layout) to be become invalid (see Ext.layout.Context.invalidate), but this is best avoided. This method is intended to be where final reads are made and so it is best to avoid invalidating layouts at this point whenever possible. Even so, this method can be used to perform final checks that may require all other layouts to be complete and then invalidate some results. This is a read phase and DOM writes should be strictly avoided in derived classes. Instead, DOM writes need to be written to Ext.layout.ContextItem objects to be flushed at the next opportunity. This method need not be implemented by derived classes and, in fact, should only be implemented when needed.
finishedLayout(ContextItem) This method is called after all layouts are complete and their calculations flushed to the DOM. No further layouts will be run and this method is only called once per layout run. The base component layout caches lastComponentSize. This is a write phase and DOM reads should be avoided if possible when overridding this method. This method need not be implemented by derived classes and, in fact, should only be implemented when needed.
getItemSizePolicy(Component) Returns an object describing how this layout manages the size of the given component. This method must be implemented by any layout that manages components.
getLayoutItems() Returns the set of items to layout (empty by default).
initLayout() A one-time initialization method called just before rendering.
isValidParent(object, object, object) Validates item is in the proper place in the dom.
notifyOwner(ContextItem) This method (if implemented) is called after all layouts are finished, and all have a lastComponentSize cached. No further layouts will be run and this method is only called once per layout run. It is the bookend to beginLayout. This is a write phase and DOM reads should be avoided if possible when overridding this method. This is the catch-all tail method to a layout and so the rules are more relaxed. Even so, for performance reasons, it is best to avoid reading the DOM. If a read is necessary, consider implementing a finalizeLayout method to do the required reads. This method need not be implemented by derived classes and, in fact, should only be implemented when needed.
onContentChange(Component) This method is called when a child item changes in some way. By default this calls Ext.AbstractComponent.updateLayout on this layout's owner.
renderItems(object, object) Iterates over all passed items, ensuring they are rendered. If the items are already rendered, also determines if the items are in the proper place in the dom.

Properties

Name Description
done Used only during a layout run, this value indicates that a layout has finished its calculations. This flag is set to true prior to the call to calculate and should be set to false if this layout has more work to do.
isLayout true in this class to identify an object as an instantiated Layout, or subclass thereof. Defaults to: true
© Copyright 2005-2011 SharpKit. All rights reserved.