/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
import _isArray from 'lodash/isArray'
+import _set from 'lodash/set'
+import _get from 'lodash/get'
import guid from '../guid'
import Position from '../graph/Position'
import IconFactory from './IconFactory'
*/
export default class DescriptorModel {
- constructor(model = {uiState: {}}, parent = null) {
+ constructor(model = {uiState: {}}, parent = null, readonly = false) {
// when our instance has no more strong references
// then our properties will get garbage collected.
this._props_ = new WeakMap();
if (parent instanceof DescriptorModel) {
parent.addChild(this);
}
+ this.isReadOnly = readonly;
}
get fieldNames() {
return length !== this[propertyName].length;
}
+ setUiState(setting, path, value){
+ _set(this.uiState, [setting].concat(path), value);
+ }
+
+ getUiState(setting, path, defaultValue){
+ return _get(this.uiState, [setting].concat(path), defaultValue);
+ }
+
}