Constructor
new LayerItemView()
- Since:
- Source:
Extends
Members
className :string
The HTML classes to use for this view's element
Type:
- Source:
classes :Object
Classes that are used to identify or create the HTML elements that comprise this
view.
Type:
Properties:
Name |
Type |
Description |
label |
string
|
The element that contains the layer's name/label |
icon |
string
|
The span element that contains the SVG icon |
visibilityToggle |
string
|
The element that acts like a button to
switch the Layer's visibility on and off |
legendContainer |
string
|
The element that the legend preview will be
inserted into. |
selected |
string
|
The class that gets added to the view when the Layer
Item is selected |
shown |
string
|
The class that gets added to the view when the Layer
Item is visible |
badge |
string
|
The class to add to the badge element that is shown
when the layer has a notification message |
tooltip |
string
|
Class added to tooltips used in this view |
- Source:
errorMessage :string
The text to show in a tooltip when the MapAsset's status is set to 'error'. If
the model also has a 'statusMessage', that will be appended to the end of this
error message.
Type:
- Source:
isCategorized :boolean
Whether the layer item is a under a category. Flat layer item and categorized
layer item are styled differently.
Type:
- Source:
The model that this view uses
Type:
- Source:
template :Underscore.template
The primary HTML template for this view
Type:
- Source:
type :string
The type of View this is
Type:
- Source:
Methods
events() → {Object}
A function that gives the events this view will listen to and the associated
function to call.
- Source:
Returns:
Returns an object with events in the format 'event selector':
'function'
-
Type
-
Object
initialize(optionsopt)
Executed when a new LayerItemView is created
Parameters:
Name |
Type |
Attributes |
Description |
options |
Object
|
<optional>
|
A literal object with options to pass to the view |
- Source:
insertIcon()
Waits for the icon attribute to be ready in the Map Asset model, then inserts
the icon before the label.
- Source:
removeStatuses()
Remove any icons, tooltips, or other visual indicators of a Map Asset's error
or loading status in this view
- Source:
Renders this view
- Source:
Returns:
Returns the rendered view element
-
Type
-
LayerItemView
search(textopt) → {boolean}
Searches and only displays self if layer label matches the text. Highlights the
matched text.
Parameters:
Name |
Type |
Attributes |
Description |
text |
string
|
<optional>
|
The search text from user input. |
- Source:
Returns:
- True if a layer label matches the text
-
Type
-
boolean
showBadge(text, styleopt)
Create a badge element and insert it to the right of the layer label.
Parameters:
Name |
Type |
Attributes |
Description |
text |
string
|
|
The text to display in the badge |
style |
string
|
<optional>
|
The style of the badge. Can be any of the styles
defined in the MapConfig#Notification style property, e.g. 'green' |
- Source:
showError(message)
Indicate to the user that there was a problem showing or loading this error.
Shows a 'warning' icon to the right of the label for the asset and a tooltip
with more details
Parameters:
Name |
Type |
Description |
message |
string
|
The error message to show in the tooltip. |
- Source:
showLoading()
Show a spinner icon to the right of the Map Asset label to indicate that this
layer is loading
- Source:
showSelection()
Highlight/emphasize this item in the Layer List when it is selected (i.e. when
the Layer model's 'selected' attribute is set to true). If it is not selected,
then remove any highlighting. This function is executed whenever the model's
'selected' attribute changes. It can be changed from within this view (with the
toggleSelected function), from the parent Layers collection, or from the
Layer Details View.
- Source:
showStatus()
Gets the Map Asset model's status and updates this Layer Item View to reflect
that status to the user.
- Source:
showVisibility()
Add or remove styles that indicate that the layer is shown based on what is
set in the Layer model's 'visible' attribute. Executed whenever the 'visible'
attribute changes.
- Source:
toggleSelected()
Sets the Layer model's 'selected' status attribute to true if it's false, and
to false if it's true. Executed when a user clicks on this Layer Item in a
Layer List view.
- Source:
toggleVisibility()
Sets the Layer model's visibility status attribute to true if it's false, and
to false if it's true. Executed when a user clicks on the visibility toggle.
- Source: