/**
 *    Copyright 2006 - 2011 Opera Software ASA
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 **/


window.cls || (window.cls = {});
cls.EcmascriptDebugger || (cls.EcmascriptDebugger = {});
cls.EcmascriptDebugger["5.0"] || (cls.EcmascriptDebugger["5.0"] = {});

/**
  * @constructor 
  * @extends ObjectDataBase
  */

cls.EcmascriptDebugger["5.0"].Node_dom_attrs = function()
{

  const 
  KEY = 0,
  VALUE = 1;

  var __selectedElement = null;
  var __views = ['dom_attrs'];

  this.rt_id = '';
  this.data = [];

  var self = this;

  this.filter_type = VALUE;

  this.getSelectedNode = function()
  {
    return __selectedElement;
  }

  this.getSelectedNodeData = function()
  {
    if(__selectedElement)
    {
      return this.getData(__selectedElement.rt_id, __selectedElement.obj_id);
    }
  }

  var onElementSelected = function(msg)
  {
    __selectedElement = {rt_id: msg.rt_id,  obj_id: msg.obj_id};
    self.setObject(msg.rt_id, msg.obj_id);
    var view_id = '', i = 0;
    for ( ; view_id = __views[i] ; i++)
    {
      views[view_id].update();
    }
  }

  messages.addListener('element-selected', onElementSelected);
}

