4 'remoto!stdlib:js/panes/pane.js',
5 'remoto!stdlib:js/panes/panes/form.js',
6 'remoto!stdlib:js/paneManager/paneManager.js',
7 'remoto!stdlib:js/include/objectRegistry.js',
8 'remoto!stdlib:js/widgets/widgets/colorWidget.js',
9 'remoto!stdlib:js/panes/panes/nodeCanvas/node.js',
10 'include/modal/modal',
11 'remoto!stdlib:js/include/preferences.js',
12 'remoto!stdlib:js/include/utils.js',
13 'remoto!stdlib:js/panes/panes/paneLoader.svg',
14 'remoto!stdlib:js/panes/panes/nodeCanvas/nodeProperties.css',
15 'jquery/ui/jquery.ui.sortable',
17 function(require,
pane,
form,
paneManager,
objectRegistry,
colorWidget,
node,modal,
preferences,
utils,spinner)
44 pane.call(
this, layout);
48 this._type =
"nodeProperties";
50 this._context = layout.metadata ? (layout.metadata.context || {}) : {};
51 this._nodeMenu = layout.nodeMenu ||
"";
52 this._enabledFilter = layout.enabledFilter ||
null;
56 this._saveFields = {
nodeMenu:
"_nodeMenu", enabledFilter:
"_enabledFilter" };
63 this._objectLoader =
null;
80 if (this._html)
return this._html;
84 this._content.addClass(
"nodeProperties");
153 if (!this._objectLoader)
154 this._objectLoader =
new objectRegistry.objectLoader(this._nodeMenu ||
"");
156 var FF = Object.keys(this._forms);
162 __p = this._path+
"/"+p;
165 if (!(__p in this._forms))
171 FF = FF.filter(
function(e) {
return e !== __p });
180 FF.map(
function(key) { DD[key] =
null; } );
202 this._content.children(
".nodePropertiesForm").hide();
210 __p = p.substr(0,this._path.length) === this._path ? p : this._path+
"/"+p;
212 if (__p in this._forms)
219 f = this._forms[__p];
222 delete this._forms[__p];
223 delete this._selection[__p];
225 else if (typeof d !=
"boolean")
230 if (
"_wrapper" in this._forms[__p])
231 { this._forms[__p]._wrapper.wrapper.show();
232 this._selection[__p] = this._forms[__p];
235 else if (d ===
false)
237 delete this._selection[__p];
240 else if ( d instanceof
node )
242 console.log(
"was node!",__p,d);
247 else if ( d !==
null && d !==
false )
259 for (var s in this._selection)
261 this._selection[s]._wrapper.wrapper.show();
305 this._widgets =
null;
307 this._objectLoader =
null;
308 this._selection =
null;
327 var f = $(
"<div class='nodePropertiesForm'>" ).appendTo( this._content );
328 var h = $(
"<div class='nodePropertiesFormHeader'>").appendTo(f);
329 var c = $(
"<div class='nodePropertiesFormContent'>").appendTo(f);
331 var hi = $(
"<img class='nodePropertiesFormHeaderIcon'/>").attr(
"src",spinner).appendTo(h);
333 var ht = $(
"<div class='nodePropertiesFormHeaderTitle'>").appendTo(h);
334 ht.text(
"Loading '"+
form._path+
"'");
336 var b = $(
"<div class='nodePropertiesFormHeaderButtons'>").appendTo(h);
337 var bh = $(
"<div class='nodePropertiesFormHeaderButton' title='Help Text'>?</div>").appendTo(b);
338 var bm = $(
"<div class='nodePropertiesFormHeaderButton' title='Collapse / Expand'>═</div>").appendTo(b);
339 var bc = $(
"<div class='nodePropertiesFormHeaderButton' title='Close'>✕</div>").appendTo(b);
341 form._formJq.appendTo(c);
351 class:
"nodePropertiesFormHeaderColor",
361 var a =
form._attributes;
362 if (a && a.node && a.node.value && a.node.value.color)
371 var wch = ch.createWidget();
372 var cvw = ch.visibleWidget;
374 cvw.attr(
"title",
"Node Background Color");
376 cvw.bind(
"pointerdown",
function(e)
384 bh.bind(
"pointerdown",
false);
385 bh.bind(
"click",
function()
387 modal.alert(
form._help,
null,
"Help" );
393 bh.attr(
"title",
form._help.replace(/<br>/i,
"\n") );
400 if ( c.is(
":visible") ) bm.html(
"═");
401 else bm.html(
"+");
404 h.bind(
"dblclick", toggler );
405 h.bind(
"mousedown",
function() { h.addClass(
"nodePropertiesFormHeaderActive"); } );
406 h.bind(
"mouseup",
function() { h.removeClass(
"nodePropertiesFormHeaderActive"); } );
409 bm.bind(
"pointerdown",
false);
410 bm.bind(
"click", toggler );
413 bc.bind(
"pointerdown",
false);
414 bc.bind(
"click",
function()
447 this._content.sortable( {
448 handle:
'.nodePropertiesFormHeader',
450 containment:
'parent',
452 items:
'.nodePropertiesForm',
491 this._nodeProperties = _nodeProperties;
492 this._icon = icon ||
null;
532 var base = data.base;
533 return this._nodeProperties._objectLoader.fetchDefinition( base, {}, this.
createForm.bind(
this,data) );
554 this._diffList.push( diff );
588 if ( this._nodeProperties._forms[
this._path] instanceof
form )
590 return this._nodeProperties._forms[this._path];
593 var spec = this._nodeProperties._objectLoader.applyValues( diff, definition );
599 this._icon = spec.icon;
602 var f =
new form( {
path:this._path, parent:this._nodeProperties, enabledFilter:this._nodeProperties._enabledFilter } );
603 this._nodeProperties.addForm( this._path, f );
607 f._wrapper.wrapper.hide();
610 { var ii = this._icon;
611 if (ii.startsWith(
"data:image/svg+xml;utf8,"))
613 ii = $(ii.replace(
"data:image/svg+xml;utf8,",
""));
615 ii.addClass(
"nodePropertiesFormHeaderIcon");
616 f._wrapper.icon.replaceWith(ii);
617 f._wrapper.icon = ii;
619 else if (ii.startsWith(
"data:image/"))
621 f._wrapper.icon.attr(
"src", this._icon );
637 var oAD = f.applyDiff;
639 f.applyDiff =
function(diff,
user)
643 console.log(
"node properties loader diff was null. returning.");
650 if (
"attributes" in diff)
652 var r = oAD.call(
this,diff.attributes,
user);
657 if (
"name" in diff.attributes)
659 f._wrapper.title.text( f._attributes.name.value );
663 var oc = f._attributes.name._change;
664 f._attributes.name._change =
function(variable,
value,
widget)
667 f._wrapper.title.text(
value );
674 if (
"node" in diff.attributes &&
675 "value" in diff.attributes.node &&
676 "color" in diff.attributes.node.value
680 f._wrapper.color.value = diff.attributes.node.value.color.value || diff.attributes.node.value.color;
704 var oPU = f.postUpdate;
705 f.postUpdate =
function(u)
707 u = { attributes: u };
715 return oPU.call(
this, u);
721 while (this._diffList.length)
723 var d = this._diffList.shift();
728 f._subscribed =
true;
applySubscription(data, metadata)
setter color
a setter DOCME
getter html
Get the html color representation of this object.
setter value
a setter DOCME
getter id
returns the number of milliseconds since midnight January 1, 1970 UTC
setter widget
a setter DOCME
getter nodeMenu
a getter DOCME
createHTML()
Create the jquery html content object for this pane. If it already exists, it will be returned.
applySubscription(data, metadata)
Load a form from the VFS, including any base form references.
nodePropertiesLoader(path, _nodeProperties, diff, icon)
applyDiff(id, diff, user, except)
registerObject(id, o, nosubscribe)
Register an object in the registry, and call the pathAddedCallback.
unregisterObject(id, o, silent, nounsubscribe, now)
Unregister an object from the registry.
Create a pane which will be mounted into a paneManager layout.
getter help
A getter that will return a pane object's help message, or a default message indicating that no help ...
The paneManager manages panes in a user layout.
getter path
a getter DOCME
applyRequestSuccess()
If an adminstrator has deleted his own preferences, this function will be called on success.
createHTML()
Create the HTML contents of the pane.
Utility functions for javascript clients.
cleanPath(path)
Clean and normalize a resource path.
resolveContextValues(o, ctx)
Recursively resolve any context values in an object.