Constructor
new EMLAttributeList()
- Source:
Extends
Methods
defaults() → {object}
Default attributes for this model
Properties:
Name |
Type |
Description |
xmlID |
string
|
The XML ID of the attribute list |
emlAttributes |
EMLAttributes
|
The collection of EML
attributes. Note: This cannot be called "attributes" because that
overrides the Backbone.Model.attributes property and causes unexpected
behaviour. |
references |
EMLReferences
|
A reference to another
attributeList in the same EML document |
parentModel |
EMLEntity
|
The parent model of this attribute
list |
- Source:
Returns:
Default attributes
-
Type
-
object
getParentEML() → {EML}
Get the EML document that contains this attribute list
- Source:
Returns:
The EML document that contains this attribute list
-
Type
-
EML
hasNonEmptyAttributes() → {boolean}
Check if the attribute list has any attributes that have values other
than the default values.
- Source:
Returns:
False if the attribute list is empty or the attributes
are all empty, true otherwise.
-
Type
-
boolean
hasReferences() → {boolean}
Check if the attribute list has a references element.
- Source:
Returns:
True if the attribute list has a references with a
value, false otherwise
-
Type
-
boolean
initialize()
- Source:
isEmpty() → {boolean}
Check if the attribute list is empty. An attribute list is empty if
it has no attributes and no references.
- Source:
Returns:
True if the attribute list is empty, false
otherwise
-
Type
-
boolean
listenToAttributes()
Trigger a change:emlAttributes event on this model when the
emlAttributes collection within this model adds, removes, or changes
one if it's models. This event can be used to notify other views/models
that the attributes collection has changed OR been replaced with a new
collection.
- Source:
listenToReferences()
Trigger a change:references event on this model when the references
model changes which model it references. This event can be used to
notify other views/models that the references model has changed or when
it has been replaced with a new model.
- Source:
nodeNameMap() → {object}
Node names as they appear in the XML document mapped to how they are
parsed using the jquery html parser (used for historical reasons).
- Source:
Returns:
A map of node names in lowercase to their
corresponding xml camelCase names.
-
Type
-
object
parse()
- Source:
removeAttributes()
Empty the attribute list if there is one
- Source:
removeReferences()
Removes the references from the list and destroys the refs model
- Source:
serialize() → {string}
Serialize this model to EML XML
- Source:
Returns:
XML string representing the attribute list
-
Type
-
string
setReferences(id)
Set the references for this attribute list. This will remove any
existing attributes since a list cannot have both attributes and
references.
Parameters:
Name |
Type |
Description |
id |
string
|
The ID of the referenced attribute list |
- Source:
updateAttributeNames(names)
Given an array of strings, update the names of the attributes in the
collection to match the array. If the number of names in the array
exceeds the number of attributes in the collection, new attributes will
be added to the collection. If the number of names is less than the
number of attributes in the collection, the extra attributes will be
removed.
Better than calling updateNames on emlAttributes directly, since this
method handles removing references if present and adding an attrs
collection if missing
Parameters:
Name |
Type |
Description |
names |
Array.<string>
|
An array of new attribute names |
- Source:
updateDOM(currentDOMopt) → {Element}
Update the EML AttributeList DOM element with the current state of the
model.
Parameters:
Name |
Type |
Attributes |
Description |
currentDOM |
Element
|
<optional>
|
The current DOM element to update. If
not provided, the model's objectDOM will be used, or a new element will
be created if none exists. |
- Source:
Returns:
The updated DOM element
-
Type
-
Element
validate() → {object|false}
Validate the model state to conform to the EML schema rules.
- Source:
Returns:
Validation errors or false if valid
-
Type
-
object
|
false