1 /** 2 * @class Monk.component.HistoryBrowserComponent 3 * @description A {@link Worbench.component.Component} for browing a history of events. 4 * @extends Workbench.component.Component 5 * @author Stéfan Sinclair 6 * @version 0.1 7 * @since Monk 0.1 8 */ 9 Monk.component.HistoryBrowserComponent = function(args) { 10 Monk.component.HistoryBrowserComponent.superclass.constructor.call(this, args); 11 } 12 13 Workbench.extend(Monk.component.HistoryBrowserComponent, Workbench.component.Component, 14 /** @scope Monk.component.HistoryBrowserComponent.prototype */ 15 { 16 17 label : "History Browser", 18 description : "For Reviewing Interface Events in Monk.", 19 "window" : this.window, 20 21 /** 22 * Stores events locally 23 */ 24 events : [], // store events locally, though this may eventually be done by the workbench 25 26 handle : function(monkEvent, data){ 27 var typeOfEvent = "event"; 28 if (monkEvent.instanceOf(Workbench.event.WorkbenchEvent)) {typeOfEvent="workbench"} 29 else if (monkEvent.instanceOf(Workbench.event.UserEvent)) {typeOfEvent="user"} 30 // too many focus events, don't publish them by default 31 if (!monkEvent.instanceOf(Monk.event.workbench.LocalWindowFocus)) { 32 this.events.push({type: typeOfEvent, "monkEvent": monkEvent}); 33 } 34 updateEvents(); // this is defined in the HTML 35 }, 36 37 /** 38 * Gets a list of events 39 * @param {Object} typesOfEvent The types of events to display 40 */ 41 getEventsItems : function(typesOfEvent) { 42 var items = ""; 43 for (var i=0;i<this.events.length;i++) { 44 if (typesOfEvent[this.events[i].type]==true) { 45 items += "<li>"+this.events[i].monkEvent.label; 46 } 47 } 48 return items; 49 } 50 }); 51