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:
Serializable
,ConcurrentMap
,Map
,org.python.core.Traverseproc
public class PyChartScope
extends org.python.core.PyDictionary
This 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An observer that gets notified when the scope is modified.Nested classes/interfaces inherited from class org.python.core.PyObject
org.python.core.PyObject.ConversionException
-
Field Summary
FieldsFields inherited from class org.python.core.PyDictionary
TYPE
Fields inherited from class org.python.core.PyObject
attributes, gcMonitorGlobal, objtype
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PyChartScope
(Map<org.python.core.PyObject, org.python.core.PyObject> map) -
Method Summary
Modifier and TypeMethodDescriptionorg.python.core.PyObject
__findattr_ex__
(String name) void
__set__
(org.python.core.PyObject obj, org.python.core.PyObject value) void
__setattr__
(String name, org.python.core.PyObject value) void
__setitem__
(org.python.core.PyObject key, org.python.core.PyObject value) void
addScopeObserver
(PyChartScope.ScopeObserver observer) org.python.core.PyDictionary
copy()
protected static PyChartScope
createFrom
(org.python.core.PyDictionary dict) This goes deep through a dictionary and creates PyChartScopes for any embedded dictionaries.*org.python.core.PyDictionary
getSubScope
(String id) A convenience function for obtaining sub scopes.boolean
void
insert
(JSONObject json) Takes a JSON object and inserts it into this scope, creating deep observable scopes for all sub dictionaries.protected void
notifyObservers
(String key, org.python.core.PyObject value) protected void
notifyObservers
(org.python.core.PyObject key, org.python.core.PyObject value) void
void
setVariable
(Object key, Object value) Set or update a variable in the chart scope.boolean
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<Object>
toJson
(org.python.core.PyObject value) protected void
transferObservers
(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
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Field Details
-
observers
-
-
Constructor Details
-
PyChartScope
public PyChartScope() -
PyChartScope
-
-
Method Details
-
createFrom
This goes deep through a dictionary and creates PyChartScopes for any embedded dictionaries.* -
copy
public org.python.core.PyDictionary copy()- Overrides:
copy
in classorg.python.core.PyDictionary
-
supportsSubScopes
public 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. -
addScopeObserver
-
removeScopeObserver
-
getSubScope
A convenience function for obtaining sub scopes. * -
hasKey
-
setVariable
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 classorg.python.core.PyDictionary
-
transferObservers
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__
- Overrides:
__findattr_ex__
in classorg.python.core.PyObject
-
__setattr__
- Overrides:
__setattr__
in classorg.python.core.PyObject
-
__set__
public void __set__(org.python.core.PyObject obj, org.python.core.PyObject value) - Overrides:
__set__
in classorg.python.core.PyObject
-
notifyObservers
protected void notifyObservers(org.python.core.PyObject key, org.python.core.PyObject value) -
notifyObservers
-
createSerializableVersion
public org.python.core.PyDictionary createSerializableVersion() -
createSnapshot
- Throws:
Exception
-
toJson
protected com.google.common.base.Optional<Object> toJson(org.python.core.PyObject value) throws Exception - Throws:
Exception
-
insert
Takes a JSON object and inserts it into this scope, creating deep observable scopes for all sub dictionaries. -
getSerializableMap
- Returns:
- a HashMap of the PyChartScope's internal map that can be safely serialized and deserialized.
-