Changeset 510 for Dev/trunk/src/client/qed-client/widgets
- Timestamp:
- 03/12/14 15:16:54 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/widgets
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/widgets/LineWithActionsWidget.js
r494 r510 1 define(['dojo/_base/declare', 2 'dojo/_base/lang', 3 'dojo/on', 4 'dojo/dom', 5 'dojo/_base/event', 6 'dojo/dom-class', 7 'dijit/form/Button', 8 'dijit/_WidgetBase', 9 'dijit/_TemplatedMixin', 10 'dijit/_WidgetsInTemplateMixin', 11 'dojo/text!./templates/LineWithActionsWidget.html' 12 ],function(declare,lang,on,dom,event,domClass,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){ 1 define([ 2 "../lib/object", 3 "dijit/_TemplatedMixin", 4 "dijit/_WidgetBase", 5 "dijit/_WidgetsInTemplateMixin", 6 "dijit/form/Button", 7 "dojo/_base/declare", 8 "dojo/_base/event", 9 "dojo/_base/lang", 10 "dojo/dom", 11 "dojo/dom-class", 12 "dojo/on", 13 "dojo/text!./templates/LineWithActionsWidget.html" 14 ], function(objectFuns, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, Button, declare, event, lang, dom, domClass, on, templateString) { 13 15 return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{ 14 16 templateString: templateString, … … 33 35 return; 34 36 } 35 for (var action in this.actions) { 36 if ( this.actions.hasOwnProperty(action) ) { 37 var properties; 38 if (this.actions[action].properties.blockButton === true) { 39 properties = lang.mixin({ 40 baseClass: 'rftBlockButton', 41 label: "Default", 42 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 43 title: this.actions[action].properties.tooltip, 44 onClick: lang.hitch(this, function(action, e){ 45 if ( action.callback ) { action.callback(e); } 46 if ( e ) { event.stop(e); } 47 return false; 48 }, this.actions[action]) 49 }, this.actions[action].properties); 50 new Button(properties).placeAt(this.buttonsNode); 51 } else { 52 properties = lang.mixin({ 53 baseClass: 'rftInlineButton', 54 label: "Default", 55 showLabel: false, 56 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 57 title: this.actions[action].properties.tooltip, 58 onClick: lang.hitch(this, function(action, e){ 59 if ( action.callback ) { action.callback(e); } 60 if ( e ) { event.stop(e); } 61 return false; 62 }, this.actions[action]) 63 }, this.actions[action].properties); 64 new Button(properties).placeAt(this.buttonsNode); 65 } 37 objectFuns.forEach(this.actions, function(value,action){ 38 var properties; 39 if (value.properties.blockButton === true) { 40 properties = lang.mixin({ 41 baseClass: 'rftBlockButton', 42 label: "Default", 43 iconClass: 'rftIcon rftIcon'+value.properties.icon, 44 title: value.properties.tooltip, 45 onClick: lang.hitch(this, function(action, e){ 46 if ( action.callback ) { action.callback(e); } 47 if ( e ) { event.stop(e); } 48 return false; 49 }, value) 50 }, value.properties); 51 new Button(properties).placeAt(this.buttonsNode); 52 } else { 53 properties = lang.mixin({ 54 baseClass: 'rftInlineButton', 55 label: "Default", 56 showLabel: false, 57 iconClass: 'rftIcon rftIcon'+value.properties.icon, 58 title: value.properties.tooltip, 59 onClick: lang.hitch(this, function(action, e){ 60 if ( action.callback ) { action.callback(e); } 61 if ( e ) { event.stop(e); } 62 return false; 63 }, value) 64 }, value.properties); 65 new Button(properties).placeAt(this.buttonsNode); 66 66 } 67 } 67 },this); 68 68 }, 69 69 refresh: function() { -
Dev/trunk/src/client/qed-client/widgets/ObjectBox.js
r472 r510 1 1 define([ 2 'dojo/_base/declare', 3 'dojo/_base/lang', 4 'dijit/_WidgetBase', 5 'dijit/_TemplatedMixin', 6 'dijit/_WidgetsInTemplateMixin', 7 './LineWithActionsWidget', 8 'dojo/text!./templates/ObjectBox.html' 9 ], function(declare, lang, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, LineWithActionsWidget, template){ 2 "../lib/object", 3 "./LineWithActionsWidget", 4 "dijit/_TemplatedMixin", 5 "dijit/_WidgetBase", 6 "dijit/_WidgetsInTemplateMixin", 7 "dojo/_base/declare", 8 "dojo/_base/lang", 9 "dojo/text!./templates/ObjectBox.html" 10 ], function(objectFuns, LineWithActionsWidget, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, declare, lang, template) { 10 11 return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { 11 12 baseClass: "rftObjectBox", … … 39 40 }, 40 41 _createLine3Actions: function() { 41 var line3Actions = {}; 42 for (var action in this.actions) { 43 if ( this.actions.hasOwnProperty(action) ) { 44 line3Actions[action] = { 45 callback: lang.hitch(this, function(callback){ 46 if ( this.value ) { callback(this.value); } 47 }, this.actions[action]), 48 properties: { 49 blockButton: true, 50 label: action, 51 icon: action.charAt(0).toUpperCase()+action.slice(1) 52 } 53 }; 54 } 55 } 56 return line3Actions; 42 return objectFuns.map(this.actions,function(value,name){ 43 return { 44 callback: lang.hitch(this, function(callback){ 45 if ( this.value ) { callback(this.value); } 46 }, value), 47 properties: { 48 blockButton: true, 49 label: name, 50 icon: name.charAt(0).toUpperCase()+name.slice(1) 51 } 52 }; 53 },this); 57 54 }, 58 55 _showInfoBox: function() {}, -
Dev/trunk/src/client/qed-client/widgets/Selector.js
r495 r510 1 1 define([ 2 "../lib/object", 2 3 "./LineWithActionsWidget", 3 4 "dijit/_Container", … … 16 17 "dojo/query", 17 18 "dojo/text!./templates/Selector.html" 18 ], function( LineWithActionsWidget, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, registry, baseArray, declare, event, lang, Source, domClass, domConstruct, fx, query, templateString) {19 ], function(objectFuns, LineWithActionsWidget, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, registry, baseArray, declare, event, lang, Source, domClass, domConstruct, fx, query, templateString) { 19 20 20 21 function get(selector, item) { … … 62 63 }, 63 64 _createTitleLine: function() { 64 var actions = {};65 var action = null;66 65 var userActions = 67 66 lang.isFunction(this.selectedActions) ? 68 67 this.selectedActions() : 69 68 this.selectedActions; 70 if ( userActions ) { 71 for (var actionName in userActions) { 72 if ( userActions.hasOwnProperty(actionName) ) { 73 action = userActions[actionName]; 74 actions[actionName] = { 75 callback: action.callback && 76 lang.hitch(this,this._onSelectedAction, 77 action.callback), 78 properties: { 79 blockButton: true, 80 label: action.title || actionName, 81 icon: action.icon, 82 tooltip: action.description 83 } 84 85 }; 86 } 87 } 88 } 89 69 70 var actions = objectFuns.map(userActions||{},function(action,actionName){ 71 return { 72 callback: action.callback && 73 lang.hitch(this,this._onSelectedAction, 74 action.callback), 75 properties: { 76 blockButton: true, 77 label: action.title || actionName, 78 icon: action.icon, 79 tooltip: action.description 80 } 81 82 }; 83 }, this); 90 84 this._titleLine = new LineWithActionsWidget({ 91 85 title: this.title, … … 205 199 }, 206 200 _createLineNode: function(item) { 207 var actions = {};208 201 var userActions = 209 202 lang.isFunction(this.itemActions) ? 210 203 this.itemActions(item) : 211 204 this.itemActions; 212 if (userActions) { 213 for (var actionName in userActions) { 214 if ( userActions.hasOwnProperty(actionName) ) { 215 var action = userActions[actionName]; 216 actions[actionName] = { 217 callback: action.callback && 218 lang.partial(action.callback,item,this), 219 properties: { 220 blockButton: false, 221 showLabel: false, 222 icon: action.icon + " black", 223 tooltip: action.description 224 } 225 }; 226 } 227 } 228 } 205 var actions = objectFuns.map(userActions||{},function(action,actionName){ 206 return { 207 callback: action.callback && 208 lang.partial(action.callback,item,this), 209 properties: { 210 blockButton: false, 211 showLabel: false, 212 icon: action.icon + " black", 213 tooltip: action.description 214 } 215 }; 216 }, this); 229 217 var w = new LineWithActionsWidget({ 230 218 title: get(this.itemTitle,item), -
Dev/trunk/src/client/qed-client/widgets/TabbedBrowser.js
r495 r510 1 1 define([ 2 "../lib/object", 2 3 "./Selector", 3 4 "dijit/layout/ContentPane", … … 9 10 "dojo/when", 10 11 "dojox/widget/Standby" 11 ], function( Selector, ContentPane, TabContainer, array, declare, lang, win, when, Standby) {12 ], function(objectFuns, Selector, ContentPane, TabContainer, array, declare, lang, win, when, Standby) { 12 13 return declare([TabContainer],{ 13 14 tabPosition: 'left-h', … … 121 122 removeItem: function(item) { 122 123 var cmap = this._dataMap; 123 for ( var cat in cmap ) { 124 if ( cmap.hasOwnProperty(cat) ) { 125 var tmap = cmap[cat]; 126 for ( var top in tmap ) { 127 if ( tmap.hasOwnProperty(top) ) { 128 var widget = tmap[top]._widget; 129 if ( widget ) { widget.removeItem(item); } 130 } 131 } 132 } 133 } 124 objectFuns.forEach(cmap,function(tmap,cat){ 125 objectFuns.forEach(tmap,function(topObj,top){ 126 var widget = topObj._widget; 127 if ( widget ) { widget.removeItem(item); } 128 },this); 129 },this); 134 130 }, 135 131 _busy: function() {
Note: See TracChangeset
for help on using the changeset viewer.