+ },
+
+ redraw_map: function()
+ {
+ // Let's clear the table and only add lines that are visible
+ var self = this;
+ this.clear_map();
+
+ /* Add records to internal hash structure */
+ var record_keys = [];
+ manifold.query_store.iter_records(this.options.query_uuid, function (record_key, record) {
+ self.new_record(record);
+ record_keys.push(record_key);
+ });
+
+ /* Add markers to cluster */
+ this.markers = Array();
+ $.each(this.by_lat_lon, function (k, s) {
+ self.markers.push(s.marker);
+ });
+
+ this.do_clustering();
+
+
+ /* Set checkbox and background color */
+ $.each(record_keys, function(i, record_key) {
+ var state = manifold.query_store.get_record_state(self.options.query_uuid, record_key, STATE_SET);
+ var warnings = manifold.query_store.get_record_state(self.options.query_uuid, record_key, STATE_WARNINGS);
+ switch(state) {
+ // XXX The row and checkbox still does not exists !!!!
+ case STATE_SET_IN:
+ case STATE_SET_IN_SUCCESS:
+ case STATE_SET_OUT_FAILURE:
+ self.set_checkbox_from_record_key(record_key, true);
+ break;
+ case STATE_SET_OUT:
+ case STATE_SET_OUT_SUCCESS:
+ case STATE_SET_IN_FAILURE:
+ break;
+ case STATE_SET_IN_PENDING:
+ self.set_checkbox_from_record_key(record_key, true);
+ self.set_bgcolor(record_key, GOOGLEMAP_BGCOLOR_ADDED);
+ break;
+ case STATE_SET_OUT_PENDING:
+ self.set_bgcolor(record_key, GOOGLEMAP_BGCOLOR_REMOVED);
+ break;
+ }
+ //self.change_status(record_key, warnings); // XXX will retrieve status again
+ });
+ },
+
+ /**************************************************************************
+ * QUERY HANDLERS
+ **************************************************************************/
+
+ on_filter_added: function(filter)
+ {
+ this.filter_map();
+ },
+
+ on_filter_removed: function(filter)
+ {
+ this.filter_map();
+ },
+
+ on_filter_clear: function()
+ {
+ this.filter_map();
+ },
+
+ on_query_in_progress: function()
+ {
+ this.spin();
+ },
+
+ on_query_done: function()
+ {
+ this.redraw_map();
+ this.unspin();
+ },
+
+ on_field_state_changed: function(data)
+ {
+ switch(data.state) {
+ case STATE_SET:
+ switch(data.value) {
+ case STATE_SET_IN:
+ case STATE_SET_IN_SUCCESS:
+ case STATE_SET_OUT_FAILURE:
+ this.set_checkbox_from_data(data.key, true);
+ this.set_bgcolor(data.key, QUERYTABLE_BGCOLOR_RESET);
+ break;
+ case STATE_SET_OUT:
+ case STATE_SET_OUT_SUCCESS:
+ case STATE_SET_IN_FAILURE:
+ this.set_checkbox_from_data(data.key, false);
+ this.set_bgcolor(data.key, QUERYTABLE_BGCOLOR_RESET);
+ break;
+ case STATE_SET_IN_PENDING:
+ this.set_checkbox_from_data(data.key, true);
+ this.set_bgcolor(data.key, QUERYTABLE_BGCOLOR_ADDED);
+ break;
+ case STATE_SET_OUT_PENDING:
+ this.set_checkbox_from_data(data.key, false);
+ this.set_bgcolor(data.key, QUERYTABLE_BGCOLOR_REMOVED);
+ break;
+ }
+ break;
+
+ case STATE_WARNINGS:
+ //this.change_status(data.key, data.value);
+ break;