 # Imports
+VisualizationModel            = require './models/visualization.js'
 NodesCollection               = require './collections/nodes-collection.js'
 RelationsCollection           = require './collections/relations-collection.js'
 VisualizationGraph            = require './views/visualization-graph.js'

  constructor: (_id) ->
    console.log('setup visualization', _id);
    @id = _id
    # Setup Collections
    @nodes      = new NodesCollection()
    @relations  = new RelationsCollection()
    # Setup Views 
    @visualizationGraph = new VisualizationGraph {collection: {nodes: @nodes, relations: @relations} }
    # Setup Table Selector
    $('#visualization-table-selector > li > a').click @updateTable


  render: ->
    @resize()       # force resize
    # fetch collections
    @visualization.fetch {url: '/api/visualizations/'+@id}
    @nodes.fetch {url: '/api/visualizations/'+@id+'/nodes/'}
    @relations.fetch {url: '/api/visualizations/'+@id+'/relations/'}

