Packagesoi.screens.sections.models
Classpublic class LinksModel

The LinksModel class is the data model of the currently loaded links xml file. This class provides a collection property, and current link node property for binding to user interface components to enable dynamic modification of the links xml. This class also provides a toString method to return the current state of the links xml in a format ready to be written to file.



Public Properties
 PropertyDefined by
  currentLink : XML
This property is a reference to the currently selected link XML node in the linksCol property, or null if none is selected.
LinksModel
  currentPage : Number
This property is a reference to the currentPage property of the Application class and represents the number of the current open page in the eMag Viewer tab.
LinksModel
  linksCol : XMLListCollection
XMLListCollection of link nodes from the linksXML property who's parent's id attribute matches the currentPage property.
LinksModel
  linksXML : XML
This property contains the currently loaded links.xml file as XML.
LinksModel
  pageSummary : String
This property is used as a label to provide a summary string of the links in the current page.
LinksModel
Public Methods
 MethodDefined by
  
Constructor.
LinksModel
  
getNewLink():XML
Creates and returns a new link XML node for injection into the linksCol property by an external class.
LinksModel
  
getNewPage():XML
Creates and returns a new page XML node with a child link XML node for injection into the linksXML property by an external class.
LinksModel
  
toString():String
Returns the linksXML property with XML header metadata to be written to the links.xml file.
LinksModel
  
This method sets the linksCol property to an XMLList of links from linksXML who's parent id attribute matches the currentPage property.
LinksModel
  
This method generates the pageSummary property to reflect the current amount of links contained in the linksCol property.
LinksModel
Property detail
currentLinkproperty
public var currentLink:XML

This property is a reference to the currently selected link XML node in the linksCol property, or null if none is selected. This property is referenced by the link list dataGrid, the link details panel, and the hotspot control. When assigned, changes to this property or its references will change the currently selected link XML node in the linksCol property through binding.

The default value is null.

currentPageproperty 
currentPage:Number  [read-write]

This property is a reference to the currentPage property of the Application class and represents the number of the current open page in the eMag Viewer tab. This property is typically set by the Application class, and updates its references through binding. Setting this property will automatically call the updateLinksCol method.

The default value is null.

This property can be used as the source for data binding.

Implementation
    public function get currentPage():Number
    public function set currentPage(value:Number):void
linksColproperty 
public var linksCol:XMLListCollection

XMLListCollection of link nodes from the linksXML property who's parent's id attribute matches the currentPage property. Changes made to the link nodes of this property will be reflected in the linksXML property This property is used as the dataProvider for the links list dataGrid, and as the reference for the currentLink property. This property is not set directly - but rather automatically when the linksXML and currentPage properties are set, or manually by calling the updateLinksCol method.

The default value is null.

linksXMLproperty 
linksXML:XML  [read-write]

This property contains the currently loaded links.xml file as XML. It can be edited directly and can receive updates through changes to the linksCol property. Setting this property will automatically call the updateLinksCol method.

The default value is null.

This property can be used as the source for data binding.

Implementation
    public function get linksXML():XML
    public function set linksXML(value:XML):void
pageSummaryproperty 
public var pageSummary:String

This property is used as a label to provide a summary string of the links in the current page. It is not edited directly - but is updated by automatic or explicit calls to the updatePageSummary method.

The default value is null.

Constructor detail
LinksModel()constructor
public function LinksModel()

Constructor. The constructor automatically instantiates the linksCol property.

Method detail
getNewLink()method
public function getNewLink():XML

Creates and returns a new link XML node for injection into the linksCol property by an external class. The new link node's placeholder content is based on the length of the linksCol property +1.

Returns
XML — A new link XML node.
getNewPage()method 
public function getNewPage():XML

Creates and returns a new page XML node with a child link XML node for injection into the linksXML property by an external class. The new page node's id attribute is based on the value of the currentPage property.

Returns
XML — A new page XML node with a child link XML node.
toString()method 
public function toString():String

Returns the linksXML property with XML header metadata to be written to the links.xml file.

Returns
String — A string representation of the linksXML property with XML header metadata.
updateLinksCol()method 
public function updateLinksCol():void

This method sets the linksCol property to an XMLList of links from linksXML who's parent id attribute matches the currentPage property. It is called automatically by both the linksXML and currentPage setters. It is also called explicitly by any class which directly modifies the underlying hierarchy of the linksXML property. For example - when a new page node is added or removed from the linksXML property a level below the hierarchy that the linksCol property represents. This method automatically assigns the currentLink property to null, and calls the updatePageSummary method.

updatePageSummary()method 
public function updatePageSummary():void

This method generates the pageSummary property to reflect the current amount of links contained in the linksCol property. It is called automatically by the updateLinksCol method. It is also called explicitly by any class which directly modifies the linksCol or linksXML properties.