Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Initial import of SOTE component framework

Tilak Joshi546c765af4f8
diff --git a/index.html b/index.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/js/accordianPicker.js b/js/accordianPicker.js
new file mode 100644
index 000000000..c5f5f42f0
--- /dev/null
+++ b/js/accordianPicker.js
@@ -0,0 +1,143 @@
+SOTE.widget.AccordianPicker.prototype = new SOTE.widget.Component;
+
+/**
+ * Instantiate the accordianPicker
+ *
+ * @class A selection device classifying radio buttons/checkboxes into categories that are displayed in accordian form.
+ * Radio buttons allow single selection accross categories. Checkboxes allow multiple selections accross categories.
+ * Radio selections cannot span multiple categories.
+ * @constructor
+ * @this {accordianPicker}
+ * @param {String} containerId is the container id of the div in which to render the object
+ * @param {Object} [config] is a hash allowing configuration of this component
+ * @config {Object[]} [items] a JS Array of JS Objects: items.category[i..n].key, items.category[i..n].value
+ * , items.category[i..n].action representing the available options
+ * @config {String} [selected] the key of the initially selected option(s)
+ * @augments SOTE.widget.Component
+ *
+*/
+SOTE.widget.AccordianPicker = function(containerId, config){
+ // Content
+};
+
+/**
+ * Displays all options in HTML in an accordian format (see JQuery UI Accordian) with the selected states being indicated
+ * by radio button and checkbox selection. All callbacks should be set. The component UI should be rendered
+ * with controllers to call the events.
+ *
+ *
+ * @this {accordianPicker}
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.init = function(){
+ // Content
+};
+
+/**
+ * Sets the selected option(s) in the accordianPicker from the passed in value(s), if valid
+ * [containerId]=[options] (options is a dot delimited string with the first item containing
+ * a single select item, and the remaining items containing the multi-select items).
+ *
+ * @this {accordianPicker}
+ * @param {String} value is a dot delimited string of the key(s) of the option(s) to be set as selected
+ * @returns {boolean} true or false depending on if the new value(s) validates
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.setValue = function(values){
+ // Content
+};
+
+/**
+ * Gets the currently selected option(s) [containerId]=[options]
+ *
+ * @this {accordianPicker}
+ * @returns {String} [container]=[options], options being a dot delimited string
+ * representing the key(s) of the currently selected option(s)
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.getValue = function(){
+ // Content
+};
+
+/**
+ * Change the component based on dependencies (i.e. Available Options, Selected)
+ *
+ * @this {accordianPicker}
+ * @param {String} querystring contains all values of dependencies (from registry)
+ * @returns {boolean} true or false depending on if the selected value still validats with criteria change
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.updateComponent = function(querystring){
+ // Content
+};
+
+/**
+ * Sets the selected option(s) from the query string [containerId]=[options]
+ *
+ * @this {accordianPicker}
+ * @param {String} qs contains the querystring
+ * @returns {boolean} true or false depending on whether the new option validates
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.loadFromQuery = function(qs){
+ // Content
+};
+
+/**
+ * Validates that the selected option(s) is not null, only one radio button is selected cross category
+ * and all options are within the scope of available options
+ *
+ * @this {accordianPicker}
+ * @returns {boolean} true or false depending on whether the selected option(s) meet the validation criteria
+*/
+SOTE.widget.AccordianPicker.prototype.validate = function(){
+ // Content
+};
+
+/**
+ * Sets the data accessor that provides state change instructions given dependencies
+ *
+ * @this {accordianPicker}
+ * @param {String} datasourceurl is the relative location of the data accessor
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.setDataSourceUrl = function(datasourceurl){
+ // Content
+};
+
+/**
+ * Gets the data accessor
+ *
+ * @this {accordianPicker}
+ * @returns {String} the relative location of the accessor
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.getDataSourceUrl = function(){
+ // Content
+};
+
+/**
+ * Sets the status of the component
+ *
+ * @this {accordianPicker}
+ * @param {String} s the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.setStatus = function(s){
+ // Content
+};
+
+/**
+ * Gets the status of the component
+ *
+ * @this {accordianPicker}
+ * @returns {String} the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.AccordianPicker.prototype.getStatus = function(){
+ // Content
+};
+
+
+// Additional Functions
+// removeOptions, addOptions
diff --git a/js/component.js b/js/component.js
new file mode 100644
index 000000000..31510cca0
--- /dev/null
+++ b/js/component.js
@@ -0,0 +1,169 @@
+if (typeof SOTE=="undefined") {
+
+ /**
+ *
+ * @namespace Takes out all SOTE components, widgets, and utilities out of the global namespace.
+ * @description Takes out all SOTE components, widgets, and utilities out of the global namespace.
+ *
+ */
+ var SOTE = {};
+}
+
+// Creates namespace(s) under SOTE
+SOTE.namespace = function()
+{
+ var obj;
+ for (var i=0; i<arguments.length; i++)
+ {
+ var list=(""+arguments[i]).split(".");
+ obj = SOTE;
+ for(var j=(list[0]=="SOTE")?1:0; j<list.length; j++)
+ {
+ obj[list[j]] = obj[list[j]] || {};
+ obj = obj[list[j]];
+ }
+ }
+ return obj;
+}
+
+SOTE.namespace("widget");
+
+SOTE.widget.Component.prototype = new SOTE.widget.Component;
+
+/**
+ * Instantiate the component
+ *
+ * @class An abstract class to define common methods across all SOTE components
+ * @constructor
+ * @this {component}
+ * @param {String} containerId is the container id of the div in which to render the object
+ * @param {Object} [config] is a hash allowing configuration of this component
+ *
+*/
+SOTE.widget.Component = function(containerId, config){
+ // Content
+};
+
+/**
+ * Initializes component user interface (View). All callbacks should be set
+ * The entire UI should be displayed with controllers to call the events
+ *
+ * @this {component}
+ *
+*/
+SOTE.widget.Component.prototype.init = function(){
+ // Content
+};
+
+/**
+ * Sets the value (Model) of the component
+ *
+ * @this {component}
+ * @param {String} value to set the component
+ *
+*/
+SOTE.widget.Component.prototype.setValue = function(value){
+ // Content
+};
+
+/**
+ * Gets the value (Model) of the component
+ *
+ * @this {component}
+ * @returns {String} the value of the component
+ *
+*/
+SOTE.widget.Component.prototype.getValue = function(){
+ // Content
+};
+
+/**
+ * Change the component based on dependencies
+ *
+ * @this {component}
+ * @param {String} querystring contains all values of dependencies (from registry)
+ *
+*/
+SOTE.widget.Component.prototype.updateComponent = function(querystring){
+ // Content
+};
+
+/**
+ * Sets the value from the querystring
+ *
+ * @this {component}
+ * @param {String} qs contains the querystring
+ *
+*/
+SOTE.widget.Component.prototype.loadFromQuery = function(qs){
+ // Content
+};
+
+/**
+ * Validates the value of the component given the component constraints
+ *
+ * @this {component}
+ * @returns {boolean} true or false depending on whether the value of the component is valid
+*/
+SOTE.widget.Component.prototype.validate = function(){
+ // Content
+};
+
+/**
+ * Sets the data accessor that provides state change instructions given dependencies
+ *
+ * @this {component}
+ * @param {String} datasourceurl is the relative location of the data accessor
+ *
+*/
+SOTE.widget.Component.prototype.setDataSourceUrl = function(datasourceurl){
+ // Content
+};
+
+/**
+ * Gets the data accessor
+ *
+ * @this {component}
+ * @returns {String} the relative location of the accessor
+ *
+*/
+SOTE.widget.Component.prototype.getDataSourceUrl = function(){
+ // Content
+};
+
+/**
+ * Sets the status of the component
+ *
+ * @this {component}
+ * @param {String} s the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.Component.prototype.setStatus = function(s){
+ // Content
+};
+
+/**
+ * Gets the status of the component
+ *
+ * @this {component}
+ * @returns {String} the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.Component.prototype.getStatus = function(){
+ // Content
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/js/dateSpan.js b/js/dateSpan.js
new file mode 100644
index 000000000..febc74881
--- /dev/null
+++ b/js/dateSpan.js
@@ -0,0 +1,194 @@
+SOTE.widget.DateSpan.prototype = new SOTE.widget.Component;
+
+/**
+ * Instantiate the dateSpan
+ *
+ * @class A date selection object for a configurable period of days, containing thumnails of a sample data
+ * product image for each day
+ * @constructor
+ * @this {dateSpan}
+ * @param {String} containerId is the container id of the div in which to render the object
+ * @param {Object} [config] is a hash allowing configuration of this component
+ * @config {String} [minDate] an ISO8601 formatted date string containing the minimum bound for the dateSpan
+ * @config {String} [maxDate] an ISO8601 formatted date string containing the maximum bound for the dateSpan
+ * @config {boolean} [hasThumbnail] whether the dateSpan has a thumbnail
+ * @config {String} [thumbSource] the address of a script producing thumbnails
+ * @config {String} [extent] the extent of the current map (bbox=w,s,e,n)
+ * @config {String} [product] the base product for the thumbnails
+ * @config {String} [startDate] an ISO8601 formatted date string containing the start date of the dateSpan
+ * @config {String} [selectedDate] an ISO8601 formatted date string containing the initially selected date
+ * @config {Number} [range] the total number of days displayed to the user
+ * @config {String} [anchorId] an HTML Element Id of the object to anchor the dateSpan with
+ * @config {boolean} [slideToSelect] whether the selection slider is visible or not
+ * @config {boolean} [isExpanded] whether the dateSpan thumbnails should be visible or not
+ * @augments SOTE.widget.Component
+ *
+*/
+SOTE.widget.DateSpan = function(containerId, config){
+ // Content
+};
+
+/**
+ * Displays the selectable dateSpan in HTML containing a thumbnail for each day in the span. If the date range contains
+ * more days than the visible day span, create horizontal scrolling capability. All callbacks should be set. The
+ * component UI should be rendered with controllers to call the events.
+ *
+ * @this {dateSpan}
+ * @requires SOTE.widget.Map
+*/
+SOTE.widget.DateSpan.prototype.init = function(){
+ // Content
+};
+
+/**
+ * Sets the selected date in the dateSpan from the passed in date string (ISO8601 format), if valid
+ *
+ * @this {dateSpan}
+ * @param {String} value is the date to be set (i.e. [containerId]=[date])
+ * @returns {boolean} true or false depending on if the passed in date validates
+ *
+*/
+SOTE.widget.DateSpan.prototype.setValue = function(value){
+ // Content
+};
+
+/**
+ * Gets the currently selected date in ISO8601 format
+ *
+ * @this {dateSpan}
+ * @returns {String} a string representing the currently selected date in ISO8601 format ([containerId]=[selectedDate])
+ *
+*/
+SOTE.widget.DateSpan.prototype.getValue = function(){
+ // Content
+};
+
+/**
+ * Modify the component based on dependencies (i.e. total number of dates in span, start date of span, selected date, thumbnails)
+ *
+ * @this {dateSpan}
+ * @param {String} querystring contains all values of dependencies (from registry)
+ * @returns {boolean} true or false depending on if the selected date validates against the updated criteria
+ *
+*/
+SOTE.widget.DateSpan.prototype.updateComponent = function(querystring){
+ // Content
+};
+
+/**
+ * Sets the selected date from the querystring, [containerId]=[selectedDate]
+ *
+ * @this {dateSpan}
+ * @param {String} qs contains the querystring (must contain [containerId]=[selectedDate] in the string)
+ * @returns {boolean} true or false depending on if the extracted date validates
+ *
+*/
+SOTE.widget.DateSpan.prototype.loadFromQuery = function(qs){
+ // Content
+};
+
+/**
+ * Validates that the selected date is not null and within bounds
+ *
+ * @this {dateSpan}
+ * @returns {boolean} true or false depending on whether the date is not null and within bounds
+*/
+SOTE.widget.DateSpan.prototype.validate = function(){
+ // Content
+};
+
+/**
+ * Sets the data accessor that provides state change instructions given dependencies
+ *
+ * @this {dateSpan}
+ * @param {String} datasourceurl is the relative location of the data accessor
+ *
+*/
+SOTE.widget.DateSpan.prototype.setDataSourceUrl = function(datasourceurl){
+ // Content
+};
+
+/**
+ * Gets the data accessor
+ *
+ * @this {dateSpan}
+ * @returns {String} the relative location of the accessor
+ *
+*/
+SOTE.widget.DateSpan.prototype.getDataSourceUrl = function(){
+ // Content
+};
+
+/**
+ * Sets the status of the component
+ *
+ * @this {dateSpan}
+ * @param {String} s the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.DateSpan.prototype.setStatus = function(s){
+ // Content
+};
+
+/**
+ * Gets the status of the component
+ *
+ * @this {dateSpan}
+ * @returns {String} the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.DateSpan.prototype.getStatus = function(){
+ // Content
+};
+
+/**
+ * Makes the component UI invisible
+ *
+ * @this {dateSpan}
+ *
+*/
+SOTE.widget.DateSpan.prototype.hide = function(){
+ // Content
+};
+
+/**
+ * Makes the component UI visible
+ *
+ * @this {dateSpan}
+ *
+*/
+SOTE.widget.DateSpan.prototype.show = function(){
+ // Content
+};
+
+/**
+ * Expand the UI to show thumbnails
+ *
+ * @this {dateSpan}
+ *
+*/
+SOTE.widget.DateSpan.prototype.expand = function(){
+ // Content
+};
+
+/**
+ * Collapse the UI (no thumbnails)
+ *
+ * @this {dateSpan}
+ *
+*/
+SOTE.widget.DateSpan.prototype.collapse = function(){
+ // Content
+};
+
+// Additional Functions
+// setBounds, getAvailableDates, setStart, changeBaseProduct, setExtent
+
+
+
+
+
+
+
+
+
diff --git a/js/map.js b/js/map.js
new file mode 100644
index 000000000..cd7009ae5
--- /dev/null
+++ b/js/map.js
@@ -0,0 +1,148 @@
+SOTE.widget.Map.prototype = new SOTE.widget.Component;
+
+/**
+ * Instantiate the map
+ *
+ * @class Instantiates a map projection layered with images retrieved from the specified client
+ * derived from the given bounding box, date, and data product
+ * @constructor
+ * @this {map}
+ * @param {String} containerId is the container id of the div in which to render the object
+ * @param {Object} [config] is a hash allowing configuration of this component
+ * @config {boolean} [hasControls] whether or not the produced map should have zoom and pan controls
+ * @config {boolean} [isSelectable] whether or not a bounding box selection is allowed
+ * @config {String} [bbox] the extent of the map as w,s,e,n
+ * @augments SOTE.widget.Component
+ *
+*/
+SOTE.widget.Map = function(containerId, config){
+ // Content
+};
+
+/**
+ * Displays the map with a base layer and pan and zoom controls (if hasControls is true)
+ * All callbacks should be set. The component UI should be rendered
+ * with controllers to call the events.
+ *
+ *
+ * @this {map}
+ *
+*/
+SOTE.widget.Map.prototype.init = function(){
+ // Content
+};
+
+/**
+ * Sets the visible extent in the map from the passed in value, if valid. formatted as [containerId]=w,s,e,n
+ *
+ * @this {map}
+ * @param {String} value is [containerId]=w,s,e,n
+ * @returns {boolean} true or false depending on if the new extent validates
+ *
+*/
+SOTE.widget.Map.prototype.setValue = function(value){
+ // Content
+};
+
+/**
+ * Gets the currently visible extent [containerId]=w,s,e,n
+ *
+ * @this {map}
+ * @returns {String} [containerId]=w,s,e,n represents the current visible extent of the map
+ *
+*/
+SOTE.widget.Map.prototype.getValue = function(){
+ // Content
+};
+
+/**
+ * Change the base layers based on dependencies (i.e. extent, date, data product)
+ *
+ * @this {map}
+ * @param {String} querystring contains all values of dependencies (from registry)
+ * @returns {boolean} true or false depending on if the component still validates with the new criteria
+ *
+*/
+SOTE.widget.Map.prototype.updateComponent = function(querystring){
+ // Content
+};
+
+/**
+ * Sets the selected option(s) from the query string [containerId]=w,s,e,n
+ *
+ * @this {map}
+ * @param {String} qs contains the querystring ([containerId]=w,s,e,n)
+ * @returns {boolean} true or false depending on whether the new extent validates
+ *
+*/
+SOTE.widget.Map.prototype.loadFromQuery = function(qs){
+ // Content
+};
+
+/**
+ * Validates that the w,s,e,n coordinates are not null, both lat coordinates (n,s) are between -90,90, and both
+ * lon coordinates (w,e) are between -180,180
+ *
+ * @this {map}
+ * @returns {boolean} true or false depending on whether the selected option(s) meet the validation criteria
+*/
+SOTE.widget.Map.prototype.validate = function(){
+ // Content
+};
+
+/**
+ * Sets the data accessor that provides state change instructions given dependencies
+ *
+ * @this {map}
+ * @param {String} datasourceurl is the relative location of the data accessor
+ *
+*/
+SOTE.widget.Map.prototype.setDataSourceUrl = function(datasourceurl){
+ // Content
+};
+
+/**
+ * Gets the data accessor
+ *
+ * @this {map}
+ * @returns {String} the relative location of the accessor
+ *
+*/
+SOTE.widget.Map.prototype.getDataSourceUrl = function(){
+ // Content
+};
+
+/**
+ * Sets the status of the component
+ *
+ * @this {map}
+ * @param {String} s the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.Map.prototype.setStatus = function(s){
+ // Content
+};
+
+/**
+ * Gets the status of the component
+ *
+ * @this {map}
+ * @returns {String} the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.Map.prototype.getStatus = function(){
+ // Content
+};
+
+/**
+ * Sets the visible extent of the map
+ *
+ * @this {map}
+ * @param {String} extent is formatted as [containerId]=w,s,e,n
+ * @returns {boolean} true or false depending on if the component validates with the new extent
+ *
+*/
+SOTE.widget.Map.prototype.setExtent = function(extent){
+ // Content
+};
+
diff --git a/js/menuPicker.js b/js/menuPicker.js
new file mode 100644
index 000000000..69e6ceeec
--- /dev/null
+++ b/js/menuPicker.js
@@ -0,0 +1,178 @@
+SOTE.widget.MenuPicker.prototype = new SOTE.widget.Component;
+
+/**
+ * Instantiate the menuPicker
+ *
+ * @class A selection device with similar functionality to a drop-down selection list, but built with HTML
+ * elements for maximum styling and flexibility.
+ * @constructor
+ * @this {menuPicker}
+ * @param {String} containerId is the container id of the div in which to render the object
+ * @param {Object} [config] is a hash allowing configuration of this component
+ * @config {Object[]} [items] a JS Array of JS Objects: items[i..n].key, items[i..n].value pairs representing the available options
+ * @config {String} [selected] the key of the initially selected option
+ * @augments SOTE.widget.Component
+ *
+*/
+SOTE.widget.MenuPicker = function(containerId, config){
+ // Content
+};
+
+/**
+ * Displays all options in HTML with the selected option indicated with styles.
+ * All callbacks should be set. The component UI should be rendered with controllers to call the events.
+ *
+ * @this {menuPicker}
+ *
+*/
+SOTE.widget.MenuPicker.prototype.init = function(){
+ // Content
+};
+
+/**
+ * Sets the selected option in the menuPicker to the passed in value, if valid ([containerId]=[key])
+ *
+ * @this {menuPicker}
+ * @param {String} value is the key of the option to be set as selected ([containerId]=[key])
+ * @returns {boolean} true or false depending on if the value validates
+ *
+*/
+SOTE.widget.MenuPicker.prototype.setValue = function(value){
+ // Content
+};
+
+/**
+ * Gets the currently selected option ([containerId]=[key])
+ *
+ * @this {menuPicker}
+ * @returns {String} a string representing the key of the currently selected option ([containerId]=[key])
+ *
+*/
+SOTE.widget.MenuPicker.prototype.getValue = function(){
+ // Content
+};
+
+/**
+ * Change the component based on dependencies (i.e. Available Options, Selected)
+ *
+ * @this {menuPicker}
+ * @param {String} querystring contains all values of dependencies (from registry)
+ * @returns {boolean} true or false depending on if the selected value still validates with modified criteria
+ *
+*/
+SOTE.widget.MenuPicker.prototype.updateComponent = function(querystring){
+ // Content
+};
+
+/**
+ * Sets the selection option from the query string ([containerId]=[key])
+ *
+ * @this {menuPicker}
+ * @param {String} qs contains the querystring ([containerId]=[key])
+ *
+*/
+SOTE.widget.MenuPicker.prototype.loadFromQuery = function(qs){
+ // Content
+};
+
+/**
+ * Validates that the selected option is not null and is one of the available options
+ *
+ * @this {menuPicker}
+ * @returns {boolean} true or false depending on whether the selected option is not null and
+ * is one of the available options
+*/
+SOTE.widget.MenuPicker.prototype.validate = function(){
+ // Content
+};
+
+/**
+ * Sets the data accessor that provides state change instructions given dependencies
+ *
+ * @this {menuPicker}
+ * @param {String} datasourceurl is the relative location of the data accessor
+ *
+*/
+SOTE.widget.MenuPicker.prototype.setDataSourceUrl = function(datasourceurl){
+ // Content
+};
+
+/**
+ * Gets the data accessor
+ *
+ * @this {menuPicker}
+ * @returns {String} the relative location of the accessor
+ *
+*/
+SOTE.widget.MenuPicker.prototype.getDataSourceUrl = function(){
+ // Content
+};
+
+/**
+ * Sets the status of the component
+ *
+ * @this {menuPicker}
+ * @param {String} s the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.MenuPicker.prototype.setStatus = function(s){
+ // Content
+};
+
+/**
+ * Gets the status of the component
+ *
+ * @this {menuPicker}
+ * @returns {String} the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.MenuPicker.prototype.getStatus = function(){
+ // Content
+};
+
+/**
+ * Add an item to the options list
+ *
+ * @this {menuPicker}
+ * @param {Object} item is a key/value pair
+ * @returns {boolean} true or false depending on if the item was successfully added
+ *
+*/
+SOTE.widget.MenuPicker.prototype.addItem = function(item){
+ // Content
+};
+
+/**
+ * Remove an item from the options list
+ *
+ * @this {menuPicker}
+ * @param {String} the key of the item to be removed
+ * @returns {boolean} true or false depending on if the operation was successful
+ *
+*/
+SOTE.widget.MenuPicker.prototype.removeItem = function(item){
+ // Content
+};
+
+/**
+ * Returns the total number of items currently in the options list
+ *
+ * @this {menuPicker}
+ * @returns {Number} the number of items currently in the options list
+ *
+*/
+SOTE.widget.MenuPicker.prototype.length = function(){
+ // Content
+};
+
+
+// Additional Functions
+// clear, addMultipleItems
+
+
+
+
+
+
+
+
diff --git a/js/registry.js b/js/registry.js
new file mode 100644
index 000000000..3b8fe35ee
--- /dev/null
+++ b/js/registry.js
@@ -0,0 +1,301 @@
+// establish the component namespace
+SOTE.namespace("util");
+// component constructor
+SOTE.util.Registry = function () {
+ // holds the components that have registered
+ this.compRegistry = new Array();
+ // holds events that have been registered
+ this.evtRegistry = new Array();
+ // holds consumers
+ this.consumers = new Array();
+
+ // register a component
+ this.register = function register(id,component){
+ var compObj = new ComponentObj(id,component);
+ this.storeComponent( id, compObj );
+ }
+
+ // registry component object - this is what is actually held in compRegistry
+ function ComponentObj(id,obj){
+ this.name = id;
+ this.obj = obj;
+ return this;
+ }
+
+ function ConsumerProducerPair(cid,pid){
+ this.consumerId = cid;
+ this.producerId = pid;
+ return this;
+ }
+
+ // add a listener pair - producer and consumer; can have multiple consumers
+ this.addEventListener = function addEventListener(producerId, consumerId){
+ if(consumerId != null || consumerId != 'undefined' || consumerId != ""){
+ for(var i=1;i<arguments.length;i++){
+ var evtObj = new ComponentUpdateObj(producerId,arguments[i]);
+ var consObj = new Consumer(arguments[i], evtObj);
+ //alert("Registry: storing: producer: "+producerId+", event object name: "+evtObj.name+", consumer: "+arguments[i]);
+ this.storeEvent(producerId,evtObj);
+
+ this.consumers.push(new ConsumerProducerPair(arguments[i],producerId));
+ }
+ }
+ }
+ // store an event in evtRegistry
+ this.storeEvent = function storeEvent(name,evtObj){
+ //var eo;
+ //for(var i=0;i<this.evtRegistry.length;i++){
+ // eo = this.evtRegistry[i];
+ // if( name == eo.name ){
+ // this.evtRegistry.splice(i,1);
+ // break;
+ // }
+ //}
+ this.evtRegistry.push(evtObj);
+ }
+ // get an event from evtRegistry given a producer id
+ this.getEvents = function getEvents(id){
+ var eoA = new Array();
+ for(var i=0;i<this.evtRegistry.length;i++){
+ if( id == this.evtRegistry[i].name ){
+ //alert("Registry: getEvent: id: "+id+" eo.name: "+this.evtRegistry[i].name);
+ eoA.push( this.evtRegistry[i] );
+ }
+ }
+ return eoA;
+ }
+ // fire an event
+ this.fire = function fire(comp,noFireVal){
+ if(noFireVal == null){
+ noFireVal = "norecurse=xxx";
+ }
+ if(comp != null){
+ var evtObjA = this.getEvents(this.getComponentId(comp));
+ if(evtObjA.length > 0){
+ //alert("Registry: fire: comp val: "+comp.getValue());
+ var consumers = new Array();
+ for(var i=0;i<evtObjA.length;i++){
+ consumers = this.getConsumers( evtObjA[i].consumerId );
+ //if(i==0){ alert("consumer: "+evtObjA[i].consumerId+", consumers len: "+consumers.length); }
+ var recursive = "";
+ for(var j=0;j<consumers.length;j++){
+ //if(i==0){ alert("consumer "+j+": "+consumers[j]); }
+ if(consumers[j] == this.getComponentId(comp)){
+ recursive = consumers[j];
+ break;
+ }
+ }
+ //alert("Registry: fire: producer: "+this.getComponentId(comp)+", evtObj: "+evtObjA[i].consumerId+", recursive: "+recursive+", no fire val: "+noFireVal);
+ if(evtObjA[i].consumerId != noFireVal.split("=")[1]){
+ if(recursive.length > 0){
+ evtObjA[i].componentUpdate.fire(comp.getValue()+"&norecurse="+recursive);
+ }else{
+ evtObjA[i].componentUpdate.fire(comp.getValue());
+ }
+ }
+ }
+ }
+ }else{
+ alert("Registry: fire: comp is null");
+ }
+ }
+
+ this.syncComponents = function() {
+ // get the components
+ var comps = this.getComponents();
+ // determine which are producers
+ var producers = new Array();
+ var tmpA;
+ for(var i=0;i<comps.length;i++){
+ tmpA = this.getProducers(comps[i].id);
+ if(tmpA.length > 0){
+ producers = producers.concat(tmpA);
+ }
+ }
+ //SOTE.util.uniqueArray(producers);
+ for(var i=0;i<producers.length;i++){
+ this.fire(this.getComponent(producers[i]));
+ }
+ }
+
+ // given a consumer, find it's dependencies, gather the components that are supposed to update
+ // and pass back their 'getValue's to the fire event
+ this.getDependentValues = function (consumerId,producerId){
+ // foreach consumerid, find it's producerids, get the components and get their values
+ //alert("Registry: getDependentValues: consumerId: "+consumerId+", producerId: "+producerId);
+ var val = "";
+ for(var i=0;i<this.consumers.length;i++){
+ if(this.consumers[i].consumerId == consumerId && this.consumers[i].producerId != producerId){
+ val += this.getComponent(this.consumers[i].producerId).getValue() + "&";
+ }
+ }
+ val = val.substring(0,val.length - 1);
+ //alert("getDependenValues: cid: "+consumerId+", pid: "+producerId+", values: "+val);
+ return val;
+ }
+
+ // custom event object
+ function ComponentUpdateObj(name,consumerId) {
+ // producer id/name
+ this.name = name;
+ // consumer id
+ this.consumerId = consumerId;
+ // define a custom event
+ this.componentUpdate = new YAHOO.util.CustomEvent("componentUpdate", this);
+ return this;
+ }
+
+ // an object that consumes "componentUpdate" events
+ function Consumer(name, evtObj) {
+ // consumer id/name
+ this.name = name;
+ // evtObj associated with producer
+ this.evtObj = evtObj;
+ this.evtObj.componentUpdate.subscribe(this.onComponentUpdate, this);
+ return this;
+ }
+
+ // the callback of the 'fire' (componentUpdate, really) method
+ Consumer.prototype.onComponentUpdate = function(type, args, me) {
+
+ //alert(" "+
+ // "\n this: " + this.name +
+ // "\n producer event name (type): " + type +
+ // "\n data: " + args +
+ // "\n event obj name: "+ me.evtObj.name +
+ // "\n me.name: " + me.name.id);
+
+ //alert("Registry: onComponentUpdate: producer: "+this.name+" consumer: "+me.name+", args for the update: "+args);
+
+ // are there other producers for this consumer?
+ var additionalValues = getRegistryDependentValues(me.name, this.name);
+ if(additionalValues != ""){
+ args = args + "&" + additionalValues;
+ }
+ // get physical comp and do the update
+ var comp = getGComponent(me.name);
+ if(comp != null){
+ comp.updateComponent(args);
+ }
+ }
+
+ // add a consumer to consumers
+ this.addConsumer = function addConsumer(consumer){
+ var co;
+ for(var i=0;i<this.consumers.length;i++){
+ co = this.consumers[i];
+ if( consumer.id == co.id ){
+ this.consumers.splice(i,1);
+ break;
+ }
+ }
+ this.consumers.push(consumer);
+ }
+ // get a consumer object from consumers
+ this.getConsumer = function getConsumer(id){
+ var co;
+ for(var i=0;i<this.consumers.length;i++){
+ co = this.consumers[i];
+ if( id == co.id ){
+ break;
+ }
+ }
+ return co;
+ }
+
+
+ // store a registry component object in compRegistry
+ this.storeComponent = function storeComponent(name,comp) {
+ var co;
+ for(var i=0;i<this.compRegistry.length;i++){
+ co = this.compRegistry[i];
+ if( name == co.name ){
+ this.compRegistry.splice(i,1);
+ break;
+ }
+ }
+ this.compRegistry.push(comp);
+ }
+
+ // get a registry component object from compRegistry given an id
+ this.getComponent = function getComponent(id) {
+ var co;
+ for(var i=0;i<this.compRegistry.length;i++){
+ co = this.compRegistry[i];
+ if( id == co.name ){
+ break;
+ }
+ }
+ return co.obj;
+ }
+
+ // get the component id for the component registered in compRegistry
+ this.getComponentId = function getComponentId(obj) {
+ var co;
+ for(var i=0;i<this.compRegistry.length;i++){
+ co = this.compRegistry[i];
+ if( obj == co.obj ){
+ break;
+ }
+ }
+ return co.name;
+ }
+
+ // get all of the components in compRegistry
+ this.getComponents = function getComponents() {
+ var coA = new Array();
+ for(var i=0;i<this.compRegistry.length;i++){
+ coA.push(this.compRegistry[i]);
+ }
+ return coA;
+ }
+
+ // get all of the user interface (selection) components in compRegistry
+ this.getUIComponents = function getUIComponents() {
+ var rawA = this.getComponents();
+ var coA = new Array();
+ for(var i=0;i<rawA.length;i++){
+ if(rawA[i].obj.loadFromQuery){
+ coA.push(rawA[i].obj);
+ }
+ }
+ return coA;
+ }
+
+ this.getProducers = function getProducers(consumerId) {
+ var producers = new Array();
+ for(var i=0;i<this.consumers.length;i++){
+ if(this.consumers[i].consumerId == consumerId){
+ producers.push(this.consumers[i].producerId);
+ }
+ }
+ return producers;
+ }
+
+ this.getConsumers = function getConsumers(producerId) {
+ var consumers = new Array();
+ for(var i=0;i<this.consumers.length;i++){
+ if(this.consumers[i].producerId == producerId){
+ consumers.push(this.consumers[i].consumerId);
+ }
+ }
+ return consumers;
+ }
+
+
+};
+
+// globally exposed instance of this class
+var REGISTRY = new SOTE.util.Registry();
+
+// an external function for getting components; useful in event methods
+function getGComponent(id){
+ return REGISTRY.getComponent(id);
+}
+
+function getRegistryDependentValues(cid,pid){
+ // get the producers for the given consumer (except for the one passed in)
+ // and get the values
+ return REGISTRY.getDependentValues(cid,pid);
+}
+
diff --git a/js/superview.js b/js/superview.js
new file mode 100644
index 000000000..3d3a0d1e0
--- /dev/null
+++ b/js/superview.js
@@ -0,0 +1,171 @@
+SOTE.widget.Superview.prototype = new SOTE.widget.Component;
+
+/**
+ * Instantiate the superview
+ *
+ * @class A series of dateSpans each with the same min/max bounds, range, and start date. Allows
+ * visual selection of date and data product
+ * @constructor
+ * @this {superview}
+ * @param {String} containerId is the container id of the div in which to render the object
+ * @param {Object} [config] is a hash allowing configuration of this component
+ * @config {String} [minDate] an ISO8601 formatted date string containing the minimum bound for the dateSpan
+ * @config {String} [maxDate] an ISO8601 formatted date string containing the maximum bound for the dateSpan
+ * @config {String} [thumbSource] the address of a script producing thumbnails
+ * @config {String} [extent] the extent of the current map (bbox=w,s,e,n)
+ * @config {String} [startDate] an ISO8601 formatted date string containing the start date of the dateSpan
+ * @config {String} [selectedDate] an ISO8601 formatted date string containing the initially selected date
+ * @config {Number} [range] the total number of days displayed to the user
+ * @config {boolean} [slideToSelect] whether the selection slider is visible or not
+ * @config {boolean} [isExpanded] whether the dateSpan thumbnails should be visible or not
+ * @config {Object[]} [content] content[i..n].product, content[i..n].anchorId pairs for each product to be included
+ * @augments SOTE.widget.Component
+ *
+*/
+SOTE.widget.Superview = function(containerId, config){
+ // Content
+};
+
+/**
+ * Displays a series of datespans with scrolling if dateSpans cross the maximum vertical viewport.
+ * All callbacks should be set. The component UI should be rendered with controllers to call the events.
+ *
+ * @this {superview}
+ * @requires SOTE.widget.DateSpan
+*/
+SOTE.widget.Superview.prototype.init = function(){
+ // Content
+};
+
+/**
+ * Sets the selected date to passed in date, and deselects any other datespan dates
+ *
+ * @this {superview}
+ * @param {String} a date product pair specifying the date to be selected (i.e. [containerId]=[date].[product])
+ * @returns {boolean} true or false depending on whether the passed in date validates
+ *
+*/
+SOTE.widget.Superview.prototype.setValue = function(value){
+ // Content
+};
+
+/**
+ * Gets the currently selected date in ISO8601 format, and the product represented by the dateSpan
+ *
+ * @this {superview}
+ * @returns {String} [containerId]=[selectedDate].[selectedProduct]
+ *
+*/
+SOTE.widget.Superview.prototype.getValue = function(){
+ // Content
+};
+
+/**
+ * Modifies contained dateSpans based on dependencies specified in querystring argument
+ *
+ * @this {superview}
+ * @param {String} querystring contains all values of dependencies (from registry)
+ * @returns {boolean} true or false depending on whether the current selected date validate under the new criteria
+ *
+*/
+SOTE.widget.Superview.prototype.updateComponent = function(querystring){
+ // Content
+};
+
+/**
+ * Sets the selected date from the querystring, requires both date and product
+ *
+ * @this {superview}
+ * @param {String} qs contains [containerId]=[date].[product]
+ * @returns {boolean} true or false depending on if the date specified in the qs validates
+ *
+*/
+SOTE.widget.Superview.prototype.loadFromQuery = function(qs){
+ // Content
+};
+
+/**
+ * Validates that the selected date is between the mindate and maxdate, and the product is one of the available products
+ *
+ * @this {superview}
+ * @returns {boolean} true or false based on whether or not validation conditions are passed
+*/
+SOTE.widget.Superview.prototype.validate = function(){
+ // Content
+};
+
+/**
+ * Sets the data accessor that provides state change instructions given dependencies
+ *
+ * @this {superview}
+ * @param {String} datasourceurl is the relative location of the data accessor
+ *
+*/
+SOTE.widget.Superview.prototype.setDataSourceUrl = function(datasourceurl){
+ // Content
+};
+
+/**
+ * Gets the data accessor
+ *
+ * @this {superview}
+ * @returns {String} the relative location of the accessor
+ *
+*/
+SOTE.widget.Superview.prototype.getDataSourceUrl = function(){
+ // Content
+};
+
+/**
+ * Sets the status of the component
+ *
+ * @this {superview}
+ * @param {String} s the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.Superview.prototype.setStatus = function(s){
+ // Content
+};
+
+/**
+ * Gets the status of the component
+ *
+ * @this {superview}
+ * @returns {String} the current status of the component (user prompts, error messages)
+ *
+*/
+SOTE.widget.Superview.prototype.getStatus = function(){
+ // Content
+};
+
+/**
+ * Shows the specified dateSpan in the superview
+ *
+ * @this {superview}
+ * @param {String} p is the product name representing the datespan
+ *
+*/
+SOTE.widget.Superview.prototype.show = function(p){
+ // Content
+};
+
+/**
+ * Hides the specified dateSpan from the superview. Entire superview is hidden if all
+ * contained datespans are hidden
+ *
+ * @this {superview}
+ * @param {String} p is the product name representing the datespan
+ *
+*/
+SOTE.widget.Superview.prototype.hide = function(p){
+ // Content
+};
+
+// Additional Optional Functions:
+// getAvailableProducts, getAvailableDates, showAll, hideAll, setBounds, setStart, setExtent
+
+
+
+
+
+