• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 20. FolderTree: Creating the Tree > Creating Folders and Links

Creating Folders and Links

There are so many parts to FolderTree that we're going to tackle them one at a time. When the page first loads, an internal representation of all the folders and links is created. This internal representation is a little complicated. The first thing to understand is that each folder and link is an object. Remember, an object is just a collection of properties and methods. That's it. To create a folder, we create a Folder object. To do this, we use a constructor function, as in Example 20-1.

Example 20-1. Folder constructor function

//constructor
function Folder(folderDescription, hreference)
{
  //constant data
  this.desc = folderDescription
  this.hreference = hreference
  this.id = -1
  this.navObj = 0
  this.iconImg = 0
  this.nodeImg = 0
  this.isLastNode = 0

  //dynamic data
  this.isOpen = true
  this.iconSrc = "ftv2folderopen.gif"
  this.children = new Array
  this.nChildren = 0

  //methods
  this.initialize = initializeFolder
  this.setState = setStateFolder
  this.addChild = addChild
  this.createIndex = createEntryIndex
  this.escondeBlock = escondeBlock
  this.esconde = escondeFolder
  this.mostra = mostra
  this.renderOb = drawFolder
  this.totalHeight = totalHeight
  this.subEntries = folderSubEntries
  this.outputLink = outputFolderLink
  this.blockStart = blockStart
  this.blockEnd = blockEnd
}


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint