+
+ /* initialize mode buttons */
+ this.init_mode = function (default_mode, node_button, timeslot_button) {
+ this.node_button=node_button;
+ this.timeslot_button=timeslot_button;
+ var scheduler=this;
+ /* xxx set callbacks on buttons */
+ node_button.onclick = function () { scheduler.set_mode('node'); }
+ timeslot_button.onclick = function () { scheduler.set_mode('timeslot'); }
+ this.set_mode(default_mode);
+ }
+
+ /* expecting mode to be either 'node' or 'timeslot' */
+ this.set_mode = function (mode) {
+ this.mode=mode;
+ var active_button = (mode=='node') ? this.node_button : this.timeslot_button;
+ active_button.checked='checked';
+ }