+ var status = msg + color;
+
+ this.table.fnAddData([
+ action,
+ data.key,
+ data.value,
+ msg,
+ button
+ ]);
+ // XXX change cell color according to status
+ },
+
+ /*************************** QUERY HANDLER ****************************/
+
+ // NONE
+
+ /*************************** RECORD HANDLER ***************************/
+
+ on_new_record: function(record)
+ {
+ // if (not and update) {
+
+ // initial['resource'], initial['lease'] ?
+ this.initial.push(record.urn);
+
+ // We simply add to the table
+ // } else {
+ // \ this.initial_resources
+ // \
+ // this. \
+ // current_resources \ YES | NO
+ // --------------------+----------+---------
+ // YES | attached | added
+ // NO | removed | /
+ //
+
+ // }
+ },
+
+ // QUERY STATUS
+ // +-----------------+--------------+
+ // v R | |
+ // +-------+ ?G +-------+ +-------+ +---+---+ |
+ // | | -----> | | !G | | | | DA |
+ // | ND | | PG | -----> | D | -----> | PC | <------+ |
+ // | | <----- | | ~G | | C | | | |
+ // +-------+ GE +-------+ +-------+ +-------+ +------+
+ // ^ ^ | | |
+ // | DA UE | | ?U | PCA |
+ // | | v | |
+ // +-------+ +-------+ +------+
+ // | | !U | | ^
+ // | AD | <----- | PU | --------+
+ // | | | | ~U
+ // +-------+ +-------+
+ //
+ //
+ // LEGEND:
+ //
+ // Plugins (i) receive state information, (ii) perform actions
+ //
+ // States: Actions:
+ // ND : No data ?G : Get query
+ // PG : Pending Get !G : Get reply
+ // D : Data present ~G : Get partial reply
+ // PC : Pending changes GE : Get error
+ // PU : Pending update C : Change request
+ // PCA: Pending change with annotation R : Reset request
+ // AD : Annotated data ?U : Update query
+ // !U : Update reply
+ // ~U : Update partial reply
+ // UE : Update error
+ // DA : Delete annotation request
+ // NOTE:
+ // - D -> PU directly if the user chooses 'dynamic update'
+ // - Be careful for updates if partial Get success
+
+ // ND: No data == initialization state
+
+ // PG : Pending get
+ // - on_query_in_progress
+ // NOTE: cannot distinguish get and update here. Is it important ?
+
+ on_query_in_progress: function()
+ {
+ this.spin();
+ },
+
+ // D : Data present
+ // - on_clear_records (Get)
+ // - on_new_record (shared with AD) XXX
+ // - on_query_done
+ // NOTE: cannot distinguish get and update here. Is it important ?
+ // NOTE: Would record key be sufficient for update ?
+
+ on_clear_records: function()
+ {
+ this.clear();
+ },
+
+ on_new_record: function(record)
+ {
+ },
+
+ on_query_done: function()
+ {
+ this.unspin();
+ },
+
+ // PC : Pending changes
+ // NOTE: record_key could be sufficient
+ on_added_record: function(record)
+ {
+ this.set_record_state(record, RECORD_STATE_ADDED);
+ },
+
+ on_removed_record: function(record_key)
+ {
+ this.set_record_state(RECORD_STATE_REMOVED);
+ },
+
+ // PU : Pending update
+ // - on_query_in_progress (already done)
+
+ // PCA : Pending change with annotation
+ // NOTE: Manifold will inform the plugin about updates, and thus won't
+ // call new record, even if the same channel UUID is used...
+ // - TODO on_updated_record
+ // - Key and confirmation could be sufficient, or key and record state
+ // XXX move record state to the manifold plugin API
+
+ on_field_state_changed: function(request, key, value, status)
+ {
+ this.set_state(request, key, value, status);
+ },
+
+ // XXX we will have the requests for change
+ // XXX + the requests to move into the query cycle = the buttons aforementioned
+
+ // XXX what happens in case of updates ? not implemented yet
+ // XXX we want resources and leases
+ // listen for SET_ADD and SET_REMOVE for slice query
+
+ /************************** PRIVATE METHODS ***************************/
+
+ _close_click: function(e)
+ {
+ var self = e.data;
+
+ //jQuery.publish('selected', 'add/'+key_value);
+ // this.parentNode is <td> this.parentNode.parentNode is <tr>
+ // this.parentNode.parentNode.firstChild is the first cell <td> of this line <tr>
+ // this.parentNode.parentNode.firstChild.firstChild is the text in that cell
+ //var firstCellVal=this.parentNode.parentNode.firstChild.firstChild.data;
+ var remove_urn = this.id;
+ var current_resources = event.data.instance.current_resources;
+ var list_resources = $.grep(current_resources, function(x) {return x.urn != remove_urn});
+ //jQuery.publish('selected', 'cancel/'+this.id+'/'+get_value(firstCellVal));
+ $.publish('/update-set/' + event.data.instance.options.resource_query_uuid, [list_resources, true]);
+ },
+
+ /******************************** TODO ********************************/
+
+ update_resources: function(resources, change)
+ {