The LzLayout Class

The LzLayout class is a subclass of LzNode that is responsible for laying out views. The LzLayout class is a base class that provides this functionality. You never instantiate this class directly, but always create an instance of its subclass. Subclasses of LzLayout are shown in Figure 4.2.

Figure 4.2. The subclasses of LzLayout


The attributes defined in the LzLayout class are given in Table 4.1.

Table 4.1. The attributes defined in the LzLayout class
NameUsageTypeDefaultAccessibility
delegatesJS onlyarray of LzDelegate objects read-only
 Description. All the delegates used by the layout.
lockedTag and JSboolean read-write
 Description. Indicates whether or not the layout is locked from updates.
subviewsJS onlyarray of views read-only
 Description. All the views managed by this layout.
updateDelegateJS onlyLzDelegate read-only
 Description. A delegate responsible for updating the layout.

The following are methods defined in the LzLayout class.

addSubview(subview)

Adds the specified subview.

ignore(subview)

Ignores the specified subview.

lock()

Locks the layout so no updates are allowed.

releaseLayout()

Removes the layout from the view and deregisters the delegates that the layout uses.

removeSubview(subview)

Removes the specified subview.

setLayoutOrder(subView1, subView2)

Reorders so that subView2 immediately follows subView1.

swapSubviewOrder(subView1, subView2)

Swaps the positions of subView1 and subView2.

unlock()

Unlocks the layout so that updates are allowed.

You can specify a layout by using the layout attribute of the LzView class or, as demonstrated in the later sections, by instantiating a subclass of LzLayout.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset