Package com.inductiveautomation.sfc.api
Class PyChartScope
- java.lang.Object
- 
- org.python.core.PyObject
- 
- org.python.core.AbstractDict
- 
- org.python.core.PyDictionary
- 
- com.inductiveautomation.sfc.api.PyChartScope
 
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.util.concurrent.ConcurrentMap,- java.util.Map,- org.python.core.Traverseproc
 
 public class PyChartScope extends org.python.core.PyDictionaryThis class represents any "scope" in the SFC system, and is fundamentally just an observable dictionary. Despite its name, it is not limited to chart scope. This class notifies listeners when values are changed, and wraps any dictionaries assigned to it as PyChartScopes as well.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfacePyChartScope.ScopeObserverAn observer that gets notified when the scope is modified.
 - 
Field SummaryFields Modifier and Type Field Description protected java.util.List<PyChartScope.ScopeObserver>observers
 - 
Constructor SummaryConstructors Modifier Constructor Description PyChartScope()protectedPyChartScope(java.util.Map<org.python.core.PyObject,org.python.core.PyObject> map)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.python.core.PyObject__findattr_ex__(java.lang.String name)void__set__(org.python.core.PyObject obj, org.python.core.PyObject value)void__setattr__(java.lang.String name, org.python.core.PyObject value)void__setitem__(org.python.core.PyObject key, org.python.core.PyObject value)voidaddScopeObserver(PyChartScope.ScopeObserver observer)org.python.core.PyDictionarycopy()protected static PyChartScopecreateFrom(org.python.core.PyDictionary dict)This goes deep through a dictionary and creates PyChartScopes for any embedded dictionaries.*org.python.core.PyDictionarycreateSerializableVersion()JSONObjectcreateSnapshot()java.util.HashMap<java.lang.Object,java.lang.Object>getSerializableMap()PyChartScopegetSubScope(java.lang.String id)A convenience function for obtaining sub scopes.booleanhasKey(java.lang.Object key)voidinsert(JSONObject json)Takes a JSON object and inserts it into this scope, creating deep observable scopes for all sub dictionaries.protected voidnotifyObservers(java.lang.String key, org.python.core.PyObject value)protected voidnotifyObservers(org.python.core.PyObject key, org.python.core.PyObject value)voidremoveScopeObserver(PyChartScope.ScopeObserver observer)voidsetVariable(java.lang.Object key, java.lang.Object value)Set or update a variable in the chart scope.booleansupportsSubScopes()If TRUE, keys of the nature "a.b.c" will be treated as sub scopes "a","b","c" under this one, and will be obtained through getSubScope.protected com.google.common.base.Optional<java.lang.Object>toJson(org.python.core.PyObject value)protected voidtransferObservers(PyChartScope newScope, PyChartScope existing)When we're replacing a scope, we need to notify everyone who is watching something in that scope.- 
Methods inherited from class org.python.core.PyDictionary__cmp__, __contains__, __delitem__, __eq__, __finditem__, __finditem__, __iter__, __len__, __ne__, __nonzero__, clear, containsKey, containsValue, dict___getitem__, dict___init__, entrySet, equals, fromkeys, fromkeys, get, get, get, getMap, has_key, hashCode, isEmpty, isMappingType, isSequenceType, items, iteritems, iterkeys, itervalues, keys, keySet, merge, mergeFromKeys, mergeFromSeq, pop, pop, popitem, put, putAll, putIfAbsent, pyKeySet, refersDirectlyTo, remove, remove, replace, replace, setdefault, setdefault, size, toString, traverse, update, updateCommon, values, viewitems, viewkeys, viewvalues
 - 
Methods inherited from class org.python.core.PyObject__abs__, __add__, __and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __coerce__, __coerce_ex__, __complex__, __delattr__, __delattr__, __delete__, __delitem__, __delslice__, __delslice__, __dir__, __div__, __divmod__, __ensure_finalizer__, __findattr__, __findattr__, __finditem__, __float__, __floordiv__, __format__, __ge__, __get__, __getattr__, __getattr__, __getitem__, __getitem__, __getnewargs__, __getslice__, __getslice__, __gt__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ifloordiv__, __ilshift__, __imod__, __imul__, __index__, __int__, __invert__, __ior__, __ipow__, __irshift__, __isub__, __iternext__, __itruediv__, __ixor__, __le__, __long__, __lshift__, __lt__, __mod__, __mul__, __neg__, __not__, __oct__, __or__, __pos__, __pow__, __pow__, __radd__, __rand__, __rawdir__, __rdiv__, __rdivmod__, __reduce__, __reduce_ex__, __reduce_ex__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __setattr__, __setitem__, __setitem__, __setslice__, __setslice__, __str__, __sub__, __tojava__, __truediv__, __trunc__, __unicode__, __xor__, _add, _and, _callextra, _cmp, _div, _divmod, _doget, _doget, _doset, _eq, _floordiv, _ge, _gt, _iadd, _iand, _idiv, _idivmod, _ifloordiv, _ilshift, _imod, _imul, _in, _ior, _ipow, _irshift, _is, _isnot, _isub, _itruediv, _ixor, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _unsupportedop, _xor, adaptToCoerceTuple, asDouble, asIndex, asIndex, asInt, asInt, asIterable, asLong, asLong, asName, asName, asString, asString, asStringOrNull, asStringOrNull, bit_length, conjugate, delDict, delType, dispatch__init__, fastGetClass, fastGetDict, finalize, getDict, getJavaProxy, getType, impAttr, implementsDescrDelete, implementsDescrGet, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isIndex, isInteger, isNumberType, mergeClassDict, mergeDictAttr, mergeListAttr, noAttributeError, object___subclasshook__, readonlyAttributeError, runsupportedopMessage, setDict, setType, unsupportedopMessage
 
- 
 
- 
- 
- 
Field Detail- 
observersprotected final transient java.util.List<PyChartScope.ScopeObserver> observers 
 
- 
 - 
Method Detail- 
createFromprotected static PyChartScope createFrom(org.python.core.PyDictionary dict) This goes deep through a dictionary and creates PyChartScopes for any embedded dictionaries.*
 - 
copypublic org.python.core.PyDictionary copy() - Overrides:
- copyin class- org.python.core.PyDictionary
 
 - 
supportsSubScopespublic boolean supportsSubScopes() If TRUE, keys of the nature "a.b.c" will be treated as sub scopes "a","b","c" under this one, and will be obtained through getSubScope. If FALSE, such a key will be treated as a flat key value.
 - 
addScopeObserverpublic void addScopeObserver(PyChartScope.ScopeObserver observer) 
 - 
removeScopeObserverpublic void removeScopeObserver(PyChartScope.ScopeObserver observer) 
 - 
getSubScopepublic PyChartScope getSubScope(java.lang.String id) A convenience function for obtaining sub scopes. *
 - 
hasKeypublic boolean hasKey(java.lang.Object key) 
 - 
setVariablepublic void setVariable(java.lang.Object key, java.lang.Object value)Set or update a variable in the chart scope. This method (or__setitem__(PyObject, PyObject)) must be used in order for observers to be notified.- Parameters:
- key- entry key.
- value- entry value.
 
 - 
__setitem__public void __setitem__(org.python.core.PyObject key, org.python.core.PyObject value)- Overrides:
- __setitem__in class- org.python.core.PyDictionary
 
 - 
transferObserversprotected void transferObservers(PyChartScope newScope, PyChartScope existing) When we're replacing a scope, we need to notify everyone who is watching something in that scope. Also, we need to go deep and transfer observers/notify for any deeper dictionaries.
 - 
__findattr_ex__public org.python.core.PyObject __findattr_ex__(java.lang.String name) - Overrides:
- __findattr_ex__in class- org.python.core.PyObject
 
 - 
__setattr__public void __setattr__(java.lang.String name, org.python.core.PyObject value)- Overrides:
- __setattr__in class- org.python.core.PyObject
 
 - 
__set__public void __set__(org.python.core.PyObject obj, org.python.core.PyObject value)- Overrides:
- __set__in class- org.python.core.PyObject
 
 - 
notifyObserversprotected void notifyObservers(org.python.core.PyObject key, org.python.core.PyObject value)
 - 
notifyObserversprotected void notifyObservers(java.lang.String key, org.python.core.PyObject value)
 - 
createSerializableVersionpublic org.python.core.PyDictionary createSerializableVersion() 
 - 
createSnapshotpublic JSONObject createSnapshot() throws java.lang.Exception - Throws:
- java.lang.Exception
 
 - 
toJsonprotected com.google.common.base.Optional<java.lang.Object> toJson(org.python.core.PyObject value) throws java.lang.Exception- Throws:
- java.lang.Exception
 
 - 
insertpublic void insert(JSONObject json) Takes a JSON object and inserts it into this scope, creating deep observable scopes for all sub dictionaries.
 - 
getSerializableMappublic java.util.HashMap<java.lang.Object,java.lang.Object> getSerializableMap() - Returns:
- a HashMap of the PyChartScope's internal map that can be safely serialized and deserialized.
 
 
- 
 
-