annotate src/implab/di/ValueDescriptor.js @ 17:9c21e656cbec

Разработка кнопки выбора координат с карт
author nickolay
date Tue, 19 Sep 2017 20:37:56 +0300
parents 93fb6c09f2e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
93fb6c09f2e1 minor fixes
cin
parents: 0
diff changeset
1 define([ "../declare", "./Descriptor", "../safe" ],
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
2
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
3 function(declare, Descriptor, safe) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
4 return declare(Descriptor, {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
5 _value : undefined,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
6 _raw : false,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
7 constructor : function(value, raw) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
8 this._value = value;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
9 this._raw = Boolean(raw);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
10 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
11
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
12 activate : function(context, name) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
13 context.enter(name, this);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
14 var v = this._raw ? this._value : context.parse(
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
15 this._value,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
16 ".params");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
17 context.leave(this);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
18 return v;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
19 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
20
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
21 isInstanceCreated : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
22 return this._raw;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
23 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
24
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
25 getInstance : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
26 if (!this._raw)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
27 throw new Error("The instance isn't constructed");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
28 return this._value;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
29 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
30
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
31 toString : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
32 if (this._raw)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
33 return "@value {raw}";
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
34 else
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
35 return safe.isNull(this._value) ? "@value <null>" : "@value";
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
36 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
37 });
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
38 });