Editing Displayed Elements Through Layout Objects; Getting The Layout Objects For Tables, Cells, And Layout Grids; Editing Attributes Of Managed Objects - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide

Editing displayed elements through layout objects

The
layout
It can read and write certain of the element's HTML source attributes without reparsing the document.
These changes are immediately available to the layout and markup objects.
This is a very powerful feature, but not every element and attribute can be edited in this manner. For a
complete list of the elements whose appearance is managed by a layout object, and the attributes
within those elements you can modify through the layout object, see
Tags, " in the GoLive CS SDK Programmer's Reference.
For an element that can be managed in this way, you can get the layout object from the layout
property of the markup object:
myLayoutObj = document.selection.element.layout
When you access a layout object, GoLive checks whether the document needs reparsing—that is,
whether there has been a structural change in the markup tree since the last time the document was
parsed. If it is needed, GoLive automatically reparses the document, regenerating the markup and layout
objects, before passing the layout object to your code.

Getting the layout objects for tables, cells, and layout grids

In most cases, you can manipulate an element's HTML source directly using the layout object in the
markup object's layout property. However, for the more complex elements, there is one more layer. A
layout object that represents a <table> element or a GoLive layout grid contains additional layout
objects that manage the parts:
If the markup element is a table, the markupObj .layout.table property holds the
Object
the table styles. See
If the markup element is a table cell, the markupObj .layout.table.cell property holds the
layout.tableCell Object
layout.tableCell.style Object
If the markup element is a GoLive layout grid, the markupObj .layout.grid property holds the
layout.grid Object
If the markup element is on a layout grid, the markupObj .layout.gridLayout property holds the
layout.gridLayout Object
and positioning elements on the

Editing Attributes of Managed Objects

The layout object's
Undo/Redo. You can use it to implement the programmatic equivalent to the functionality of a specific
box object's Inspector. For example, if the frontmost document window is displaying the Layout view of a
table that is selected, you can change the width of the table through the layout object:
document.selection.element.layout.setAttribute( "width", 500 );
When this call returns:
The value of the <table> element's width attribute is changed in Source view.
The object that manages the table's appearance in Layout view (the
the table with the new size.
Object, like the box object, manages the appearance of certain HTML elements in Layout view.
that manages the table. This object in turn contains the
Working with Tables in Layout
object that manages the table cell. This object in turn contains the
that manages the cell styles. See
object that manages the grid. See
that manages the element's size and placement on the layout grid. See
setAttribute
Adobe GoLive CS2 SDK
View.
Working with Layout
grid.
method affects Layout view directly, and automatically supports
Editing with Layout
Appendix C, "Managed Layout
layout.table.style Object
Table
cells.
Grids.
layout.table
Object) has redrawn
109
layout.table
that manages
Sizing

Advertisement

Table of Contents
loading

Table of Contents