Print Friendly

Class Ext.ReaderLayout

Package:Ext
Class:ReaderLayout
Extends:BorderLayout
Defined In:ReaderLayout.js
This is a pre-built layout that represents a classic, 5-pane application. It consists of a header, a primary center region containing two nested regions (a top one for a list view and one for item preview below), and regions on either side that can be used for navigation, application commands, informational displays, etc. The setup and configuration work exactly the same as it does for a Ext.BorderLayout - this class simply expedites the setup of the overall layout and regions for this common application style. Example:
var reader = new Ext.ReaderLayout();
var CP = Ext.ContentPanel;  // shortcut for adding

reader.beginUpdate();
reader.add("north", new CP("north", "North"));
reader.add("west", new CP("west", {title: "West"}));
reader.add("east", new CP("east", {title: "East"}));

reader.regions.listView.add(new CP("listView", "List"));
reader.regions.preview.add(new CP("preview", "Preview"));
reader.endUpdate();

Properties   -  Methods   -  Events

Public Properties

Property Defined By
  monitorWindowResize : Boolean LayoutManager
false to disable window resize monitoring

Public Methods

Method Defined By
  ReaderLayoutObject config, [String/HTMLElement/Element container] ) ReaderLayout
Create a new ReaderLayout
  addString target, Ext.ContentPanel panel ) : Ext.ContentPanel BorderLayout
Adds a ContentPanel (or subclass) to this layout.
  addEventsObject object ) : void Observable
Used to define events on this Observable
  addListenerString eventName, Function handler, [Object scope], [Object options] ) : void Observable
Appends an event handler to this component
  addRegionString target, Object config ) : BorderLayoutRegion BorderLayout
Creates and adds a new region if it doesn't already exist.
  beginUpdate() : void LayoutManager
Suspend the LayoutManager from doing auto-layouts while making multiple add or remove calls
  endUpdateBoolean noLayout ) : void LayoutManager
Restore auto-layouts and optionally disable the manager from performing a layout
  findPanelString panelId ) : Ext.ContentPanel BorderLayout
Searches all regions for a panel with the specified id
  fireEventString eventName, Object... args ) : Boolean Observable
Fires the specified event with the passed parameters (minus the event name).
  getEl() : Ext.Element LayoutManager
Returns the Element this layout is bound to.
  getRegionString target ) : Ext.LayoutRegion LayoutManager
Returns the specified region.
  getViewSize() : Object LayoutManager
Returns the size of the current view. This method normalizes document.body and element embedded layouts and performs ...
  hasListenerString eventName ) : Boolean Observable
Checks to see if this object has any listeners for a specified event
  isUpdating() : Boolean LayoutManager
Returns true if this layout is currently being updated
  layout() : void BorderLayout
Performs a layout update.
  onString eventName, Function handler, [Object scope], [Object options] ) : void Observable
Appends an event handler to this element (shorthand for addListener)
  purgeListeners() : void Observable
Removes all listeners for this object
  removeString target, Number/String/Ext.ContentPanel panel ) : Ext.ContentPanel BorderLayout
Remove a ContentPanel (or subclass) to this layout.
  removeListenerString eventName, Function handler, [Object scope] ) : void Observable
Removes a listener
  restoreState[Ext.state.Provider provider] ) : void BorderLayout
Restores this layouts state using Ext.state.Manager or the state provided by the passed provider.
  showPanelString/ContentPanel panelId ) : Ext.ContentPanel BorderLayout
Searches all regions for a panel with the specified id and activates (shows) it.
  unString eventName, Function handler, [Object scope] ) : void Observable
Removes a listener (shorthand for removeListener)

Public Events

Event Defined By
  layout : ( Ext.LayoutManager this ) LayoutManager
Fires when a layout is performed.
  regioncollapsed : ( Ext.LayoutRegion region ) LayoutManager
Fires when a region is collapsed.
  regionexpanded : ( Ext.LayoutRegion region ) LayoutManager
Fires when a region is expanded.
  regionresized : ( Ext.LayoutRegion region, Number newSize ) LayoutManager
Fires when the user resizes a region.

Property Details

monitorWindowResize

public Boolean monitorWindowResize
false to disable window resize monitoring
This property is defined by LayoutManager.

Constructor Details

ReaderLayout

public function ReaderLayout( Object config, [String/HTMLElement/Element container] )
Create a new ReaderLayout
Parameters:
  • config : Object
    Configuration options
  • container : String/HTMLElement/Element
    (optional) The container this layout is bound to (defaults to document.body if omitted)

Method Details

add

public function add( String target, Ext.ContentPanel panel )
Adds a ContentPanel (or subclass) to this layout.
Parameters:
  • target : String
    The target region key (north, south, east, west or center).
  • panel : Ext.ContentPanel
    The panel to add
Returns:
  • Ext.ContentPanel
    The added panel
This method is defined by BorderLayout.

addEvents

public function addEvents( Object object )
Used to define events on this Observable
Parameters:
  • object : Object
    The object with the events defined
Returns:
  • void
This method is defined by Observable.

addListener

public function addListener( String eventName, Function handler, [Object scope], [Object options] )
Appends an event handler to this component
Parameters:
  • eventName : String
    The type of event to listen for
  • handler : Function
    The method the event invokes
  • scope : Object
    (optional) The scope in which to execute the handler function. The handler function's "this" context.
  • options : Object
    (optional) An object containing handler configuration properties. This may contain any of the following properties:
    • scope {Object} The scope in which to execute the handler function. The handler function's "this" context.
    • delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.
    • single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.
    • buffer {Number} Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.

    Combining Options
    Using the options argument, it is possible to combine different types of listeners:

    A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)

    el.on('click', this.onClick, this, {
     			single: true,
        		delay: 100,
        		forumId: 4
    		});

    Attaching multiple handlers in 1 call
    The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.

    el.on({
    			'click': {
            		fn: this.onClick,
            		scope: this,
            		delay: 100
        		}, 
        		'mouseover': {
            		fn: this.onMouseOver,
            		scope: this
        		},
        		'mouseout': {
            		fn: this.onMouseOut,
            		scope: this
        		}
    		});

    Or a shorthand syntax which passes the same scope object to all handlers:

    el.on({
    			'click': this.onClick,
        		'mouseover': this.onMouseOver,
        		'mouseout': this.onMouseOut,
        		scope: this
    		});
Returns:
  • void
This method is defined by Observable.

addRegion

public function addRegion( String target, Object config )
Creates and adds a new region if it doesn't already exist.
Parameters:
  • target : String
    The target region key (north, south, east, west or center).
  • config : Object
    The regions config object
Returns:
  • BorderLayoutRegion
    The new region
This method is defined by BorderLayout.

beginUpdate

public function beginUpdate()
Suspend the LayoutManager from doing auto-layouts while making multiple add or remove calls
Parameters:
  • None.
Returns:
  • void
This method is defined by LayoutManager.

endUpdate

public function endUpdate( Boolean noLayout )
Restore auto-layouts and optionally disable the manager from performing a layout
Parameters:
  • noLayout : Boolean
    true to disable a layout update
Returns:
  • void
This method is defined by LayoutManager.

findPanel

public function findPanel( String panelId )
Searches all regions for a panel with the specified id
Parameters:
  • panelId : String
Returns:
  • Ext.ContentPanel
    The panel or null if it wasn't found
This method is defined by BorderLayout.

fireEvent

public function fireEvent( String eventName, Object... args )
Fires the specified event with the passed parameters (minus the event name).
Parameters:
  • eventName : String
  • args : Object...
    Variable number of parameters are passed to handlers
Returns:
  • Boolean
    returns false if any of the handlers return false otherwise it returns true
This method is defined by Observable.

getEl

public function getEl()
Returns the Element this layout is bound to.
Parameters:
  • None.
Returns:
  • Ext.Element
This method is defined by LayoutManager.

getRegion

public function getRegion( String target )
Returns the specified region.
Parameters:
  • target : String
    The region key ('center', 'north', 'south', 'east' or 'west')
Returns:
  • Ext.LayoutRegion
This method is defined by LayoutManager.

getViewSize

public function getViewSize()
Returns the size of the current view. This method normalizes document.body and element embedded layouts and performs box-model adjustments.
Parameters:
  • None.
Returns:
  • Object
    The size as an object {width: (the width), height: (the height)}
This method is defined by LayoutManager.

hasListener

public function hasListener( String eventName )
Checks to see if this object has any listeners for a specified event
Parameters:
  • eventName : String
    The name of the event to check for
Returns:
  • Boolean
    True if the event is being listened for, else false
This method is defined by Observable.

isUpdating

public function isUpdating()
Returns true if this layout is currently being updated
Parameters:
  • None.
Returns:
  • Boolean
This method is defined by LayoutManager.

layout

public function layout()
Performs a layout update.
Parameters:
  • None.
Returns:
  • void
This method is defined by BorderLayout.

on

public function on( String eventName, Function handler, [Object scope], [Object options] )
Appends an event handler to this element (shorthand for addListener)
Parameters:
  • eventName : String
    The type of event to listen for
  • handler : Function
    The method the event invokes
  • scope : Object
    (optional) The scope in which to execute the handler function. The handler function's "this" context.
  • options : Object
    (optional)
Returns:
  • void
This method is defined by Observable.

purgeListeners

public function purgeListeners()
Removes all listeners for this object
Parameters:
  • None.
Returns:
  • void
This method is defined by Observable.

remove

public function remove( String target, Number/String/Ext.ContentPanel panel )
Remove a ContentPanel (or subclass) to this layout.
Parameters:
  • target : String
    The target region key (north, south, east, west or center).
  • panel : Number/String/Ext.ContentPanel
    The index, id or panel to remove
Returns:
  • Ext.ContentPanel
    The removed panel
This method is defined by BorderLayout.

removeListener

public function removeListener( String eventName, Function handler, [Object scope] )
Removes a listener
Parameters:
  • eventName : String
    The type of event to listen for
  • handler : Function
    The handler to remove
  • scope : Object
    (optional) The scope (this object) for the handler
Returns:
  • void
This method is defined by Observable.

restoreState

public function restoreState( [Ext.state.Provider provider] )
Restores this layouts state using Ext.state.Manager or the state provided by the passed provider.
Parameters:
  • provider : Ext.state.Provider
    (optional) An alternate state provider
Returns:
  • void
This method is defined by BorderLayout.

showPanel

public function showPanel( String/ContentPanel panelId )
Searches all regions for a panel with the specified id and activates (shows) it.
Parameters:
  • panelId : String/ContentPanel
    The panels id or the panel itself
Returns:
  • Ext.ContentPanel
    The shown panel or null
This method is defined by BorderLayout.

un

public function un( String eventName, Function handler, [Object scope] )
Removes a listener (shorthand for removeListener)
Parameters:
  • eventName : String
    The type of event to listen for
  • handler : Function
    The handler to remove
  • scope : Object
    (optional) The scope (this object) for the handler
Returns:
  • void
This method is defined by Observable.

Event Details

layout

public event layout
Fires when a layout is performed.
Subscribers will be called with the following parameters:
  • this : Ext.LayoutManager
This event is defined by LayoutManager.

regioncollapsed

public event regioncollapsed
Fires when a region is collapsed.
Subscribers will be called with the following parameters:
  • region : Ext.LayoutRegion
    The collapsed region
This event is defined by LayoutManager.

regionexpanded

public event regionexpanded
Fires when a region is expanded.
Subscribers will be called with the following parameters:
  • region : Ext.LayoutRegion
    The expanded region
This event is defined by LayoutManager.

regionresized

public event regionresized
Fires when the user resizes a region.
Subscribers will be called with the following parameters:
  • region : Ext.LayoutRegion
    The resized region
  • newSize : Number
    The new size (width for east/west, height for north/south)
This event is defined by LayoutManager.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.