3 'remoto!stdlib:js/include/utils.js',
4 'remoto!stdlib:js/include/preferences.js',
5 'remoto!stdlib:js/paneManager/arrowMessage.js',
6 'remoto!stdlib:js/widgets/widget.css',
78 this._label = d.label ||
null;
79 this._variable =
null;
80 this._value = (
"value" in d) ? d.value : d.default;
81 this._options = d.options || {};
82 this._change = d.change
83 this._default = d.default;
84 this._tip = d.tip ||
"";
86 this._activeUser =
null;
87 this._validator = d.validator ||
null;
89 this._changeTimer =
null;
90 this._immediate =
false;
93 this._enabled = (
"enabled" in this._options) ? this._options.enabled :
true;
98 this._widgetJq =
null;
101 this._arrowAt =
null;
102 this._arrowMessage =
null;
119 if (this._html)
return this._html;
123 this._html = $(
"<div class='widgetRow'>");
126 if (this._options[
"class"])
127 this._html.addClass(this._options[
"class"]);
129 a.attr(
"title",this._tip);
138 var w = $(
"<div class='widgetField'>");
143 if (this._options[
"hidden"]===
true)
147 this._widgetJq.bind(
"keydown",
function(e)
149 if (e.keyCode === 83 && (e.metaKey || e.ctrlKey))
154 if (e.keyCode === 27)
175 if (this._widgetJq)
return this._widgetJq;
178 this._widgetJq = $(
"<input class='widgetInputField' id='' type='text' value=''/>");
179 this._widgetJq.attr( {
id:this._id} );
180 this._widgetJq.val(this._value);
182 if (this._options[
"spellcheck"]===
false)
183 this._widgetJq.attr(
"spellcheck",
"false");
185 if (this._options[
"enabled"]!==
true || !this._enabled)
188 if (this._options[
"placeholder"])
189 this._widgetJq.attr(
"placeholder",this._options[
"placeholder"]);
191 if (this._options[
"autofocus"])
192 this._widgetJq.attr(
"autofocus",
"");
194 if (this._options.class)
195 this._widgetJq.addClass(this._options.class);
201 this._widgetJq.bind(
"contextmenu",
function(e) { e.stopPropagation(); } )
203 return this._widgetJq;
217 if (this._labelJq)
return this._labelJq;
219 this._labelJq = $(
"<label class='widgetLabel' for='"+this._id+
"'>");
221 if (this._options.hideLabel)
222 { this._labelJq.css(
"visibility",
"hidden");
231 this._labelJq.text(this._label || this._variable);
233 return this._labelJq;
248 if (this._widgetJq && this._change)
249 { this._widgetJq.unbind(
"change input");
250 this._widgetJq.bind(
"change input", this.
sync.bind(
this));
269 this._widgetJq.unbind(
"change input blur click");
287 var v = this._widgetJq ? this._widgetJq.val() :
null;
316 case "enabled": this.
enabled = v;
break;
317 case "hidden": this.
hidden = v;
break;
319 default:
if (o in this._options)
320 this._options[o] = v;
341 if (this._changeTimer)
342 clearTimeout( this._changeTimer );
346 if (!this._immediate)
349 this._changeTimer = setTimeout(
function() {
350 THIS._change(THIS._variable,THIS._value,THIS);
351 THIS._changeTimer =
null;
355 this._change(this._variable,this._value,
this);
395 if (this._value !== v)
397 var i = this._immediate;
398 this._immediate =
true;
402 if (this._activeUser)
429 var ov = this._value;
435 if (this._widgetJq && this._widgetJq.val()!==v)
436 this._widgetJq.val(v);
440 if (this._change &&
valid===
true)
454 return this._default;
465 return this._default;
475 return this._widgetJq;
531 {
if (e===
false || e===undefined || e===
null)
532 { this._labelJq.css(
"color",
"");
534 this._labelJq.removeAttr(
"title");
538 this._labelJq.css(
"color",
widget.errorColor);
539 this._labelJq.attr(
"title",this._error);
569 this._activeUser = u;
578 get enabled() {
return this._enabled; },
589 this._enabled = e ? true :
false;
594 { this._widgetJq.removeAttr(
"disabled");
597 { this._widgetJq.attr(
"disabled",
"disabled");
601 return this._enabled;
626 this._html.css(
"display",
"none");
628 this._html.css(
"display",
"");
631 console.log(
"no _html to hide!");
652 { var r = this._validator(this._value,this._options);
679 if (this._arrowMessage)
681 this._arrowMessage.destroy();
686 this._arrowMessage._completeCallback =
function() { THIS._arrowMessage =
null; };
730 if (this._widgetJq) this._widgetJq.remove();
731 if (this._html) this._html.remove();
733 this._widgetJq =
null;
741 widget.errorColor =
"#FF6400";
Create a message with an arrow pointing to a DOM element.
arrowMessage(message, o, at, my, offset, persistent)
The arrowMessage constructor.
setter value
a setter DOCME
getter id
returns the number of milliseconds since midnight January 1, 1970 UTC
setter widget
a setter DOCME
deactivate()
Deactivate this element and call deactivate on all its children.
getter valid
a getter DOCME
createHTML()
Create the HTML contents of the pane.
Utility functions for javascript clients.
uuid()
Generate a universally unique identifier.