@function initModelIndex

create list view controller

@param {object} args
770393
function initModelList (args) {
    var controller = this
    var model = this.model
    // make sure args is object
    args = requireValidOptionalObject(args)
    // make sure list is defined
    args.list = requireValidOptionalObject(args.list)
    // make sure query args are object
    var queryArgs = requireValidOptionalObject(args.list.query)
    // create title from name
    var title = model.title+' Records'
    // create new form instance configured to submit from list page
    if (controller.form && _.get(args, 'list.form') !== false) {
        var form = controller.form.newInstance({
            action: './?redirect=./',
        })
    }
    // get role
    var role = args.defaultRole || 'all'
    // build fields for table view
    this.fields = buildFields(model, args.list && args.list.fields)
    // index inputs
    var input = {
        // included deleted records
        deleted: 'query.deleted',
        // limit - overrides value in query if any
        limit: 'query.limit',
        // offset - overrides value in query if any
        offset: 'query.offset',
        // column to sort by
        orderColumn: 'query.orderColumn',
        // direction to sort in
        orderDirection: 'query.orderDirection',
        // free-form search string
        search: 'query.search',
        // list of columns to select
        select: 'query.select',
        // json encoded where arguments
        where: 'query.where',
    }
    // if model has an original id column then add to query options
    if (model.columnName('originalId')) {
        input.originalId = 'query.originalId'
    }
    // add extra columns as query param options
    _.each(model.extraColumns, (spec, name) => {
        // only add column if it has index
        if (!spec.index && !spec.unique) {
            return
        }
        // do not overwrite core inputs
        if (input[name]) {
            return
        }
        // add column to inputs
        input[name] = 'query.'+name
    })
    // links to display at top of page
    var links
    // use links from list view
    if (Array.isArray(args.list.links)) {
        links = args.list.links
    }
    // use global controller links
    else if (Array.isArray(args.links)) {
        links = args.links
    }
    // set default links
    else {
        links = [
            {href: './new', title: 'Create New'},
        ]
    }
    // create path if it does not exist
    if (!this.paths['/']) {
        this.paths['/'] = {}
    }
    // add list handler for GET on /
    this.paths['/'].get = [
        {
            before: function (args) {
                // load records
                return beforeList(controller, args, _.cloneDeep(controller.fields), title, form, links, queryArgs)
            },
            input: input,
            method: function (args) {
                return args.json
                    ? _.pick(args, ['records', 'result'])
                    : _.pick(args, ['clear', 'fields', 'form', 'links', 'pager', 'query', 'records', 'result', 'title'])
            },
            methodName: 'list',
            role: role,
        },
    ]
}
63604
function initModelUpdate (args) {
    var controller = this
    var model = this.model
    // if model does not have id column then cannot use default controller
    if (!model.columnName('id') || !model.columnName('parentId')) {
        return
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // index inputs
    var input = {
        // get current revision of instance
        current: 'query.current',
        // get record even if deleted
        deleted: 'query.deleted',
        // ignore conflicts
        force: 'query.force',
        // instance id
        id: 'params.id',
        // merge update data into existing data
        merge: 'query.merge',
        // input data includes meta columns
        meta: 'query.meta',
    }
    // instance data is in body under model name
    input[model.name] = 'body.'+model.name
    // create path for PUT for API requests
    if (!this.paths['/:id']) {
        this.paths['/:id'] = {}
    }
    // create path for POST for form requests
    if (!this.paths['/:id/update']) {
        this.paths['/:id/update'] = {}
    }
    // add handler for PUT /:id and POST /:id/update
    // to update instance
    this.paths['/:id'].put = this.paths['/:id/update'].post = [
        {
            before: function (args) {
                // load model
                return loadRecordForUpdate(controller, args)
            },

            input: input,
            method: function (args) {
                // perform update
                return update(controller, args)
            },
            methodName: 'update',
            role: role,
            template: 'instance',
        },
    ]
}
1073287
public static void show(Map<String, Object> args, IInputCallback callback) {
        Window dialog = (Window) PageUtil
                .createPage(DialogConstants.RESOURCE_PREFIX + "inputDialog.fsp", ExecutionContext.getPage(), args).get(0);

        dialog.modal(callback == null ? null : (event) -> {
            callback.onComplete(dialog.getAttribute("result", String.class));
        }
783662
function(arg, callback) {
    if (!arg || typeof arg !== 'object') return;

    if (arg instanceof Array) {
      arg.forEach(callback);
    } else {
      for (var k in arg) {
        callback(arg[k], k);
      }
    }
  }
812297
function(args) {
  var argsMap = {};
  var mainPos = 1;

  while (args[mainPos].indexOf('--') > 0) {
    mainPos++;
  }
  argsMap.main = args[mainPos];

  for (var i = (mainPos + 1); i < args.length; i++) {
    var arg = args[i];
    var sep = arg.indexOf('=');
    var key = arg.slice(0, sep);
    var value = arg.slice(sep + 1);
    if (!isNaN(Number(value)) && (value.indexOf('.') < 0)) {
      value = Number(value);
    }
    argsMap[key] = value;
  }

  return argsMap;
}
114408
function AppView(options) {
        View.apply(this, arguments);

        // Init
        this.transitionable = new Transitionable(0);
        this.modifier = new StateModifier();
        this.renderable = this.add(this.modifier);

        // Create rows
        this._createRows();
        this._createCounter();
        this._createEndScreen();
        this._createLagometer();

        // Reset
        this.reset();
    }
894809
function (args, callback) {
            var a = _.extend({}, args, {
                method: 'createWithView'
            });
            this._openWithViewManager(a, callback);
        }
200294
function (args) {
    Model.call(this, args);
    this.modelType = messageContents.modelType;
    this.attributes = [];
    for (var a in messageContents.attributes) {
      var attrib = new Attribute(messageContents.attributes[a].name, messageContents.attributes[a].type);
      if (attrib.name == 'id') { // TODO only If mongo! or refactor mongo to normalize IDs
        attrib.value = messageContents.attributes[a].value;
      } else {
        attrib.value = messageContents.attributes[a].value;
      }
      this.attributes.push(attrib);
    }
  }
866341
function init (args) {
    // get values from args
    this.model = args.model
    this.promise = args.promise
    this.raw = args.raw
    this.session = args.session
    // list of instance properties
    this.properties = []
    // add default properties to instance
    _.each(this.model.defaultColumns, (defaultName, columnName) => {
        // skip row (n)um column
        if (columnName === 'c' || columnName === 'n') {
            return
        }
        // use d column to set deleted flag
        if (columnName === 'd') {
            this.isDeleted = this.raw[columnName] === 1 ? true : false
        }
        // and column to instance
        else {
            // add property using default name (e.g. id, createTime) to object
            this[defaultName] = this.raw[columnName]
            // add to properties
            this.properties.push(defaultName)
        }
    })
    // if model has data then make sure extra columns are set in data
    if (defined(this.model.columnName('data'))) {
        // check that extra properties defined in data
        _.each(this.model.extraColumns, (spec, columnName) => {
            // if extra property is in column but not data then set in data
            if (defined(this.raw[columnName]) && !defined(_.get(this.data, spec.path))) {
                // convert boolean
                if (spec.type === 'boolean') {
                    _.set(this.data, spec.path, this.raw[columnName] === 1 ? true : false)
                }
                // convert int
                else if (spec.type === 'int' || spec.type === 'smallint') {
                    var val = parseInt(this.raw[columnName])
                    // set value only if valid integer
                    if (!Number.isNaN(val)) {
                        _.set(this.data, spec.path, val)
                    }
                }
                // set all other values directly
                else {
                    _.set(this.data, spec.path, this.raw[columnName])
                }
            }
        })
    }
    // if model does not have data then any extra columns go on instance
    else {
        // add extra properties to instance
        _.each(this.model.extraColumns, (spec, columnName) => {
            this[columnName] = this.raw[columnName]
            // add to properties
            this.properties.push(columnName)
        })
    }
    // list of states record is in for checking access
    var states = []
    // add deleted to states if set
    if (this.isDeleted) {
        states.push('deleted')
    }
    // if there are reladed records loaded copy them to instance
    if (this.raw._related) {
        this.related = this.raw._related
        delete this.raw._related
    }
    // if child id was selected use to determin if record is current
    if (this.raw.hasOwnProperty('childId')) {
        // if record has child it is not current
        this.isCurrent = defined(this.raw.childId) ? false : true
        // add isCurrent to properties
        this.properties.push('isCurrent')
    }
    // default scope for access control
    this.scope = 'any'
    // id that grants ownership access to record
    this.accessId = undefined
    // set access id for raw if defined
    if (defined(this.raw[this.model.accessIdName])) {
        this.accessId = this.raw[this.model.accessIdName]
    }
    // otherwise set from data - may be undefined
    else if (defined(this.data) && defined(this.data[this.model.accessIdName])) {
        this.accessId = this.data[this.model.accessIdName]
    }
    // if session has accessId set and it is used for model then use it
    if (defined(this.session.accessId) && this.session.accessIdName === this.model.accessIdName) {
        // if access id is in data and matches session then change scope to own
        if (this.session.accessId = this.accessId) {
            this.scope = 'own'
        }
    }
    // otherwise try account id
    else if (defined(this.session.accountId) && this.model.defaultColumnsInverse.accountId) {
        // if account id matches session then change scope to own
        if (this.session.accountId === this.accountId) {
            this.scope = 'own'
        }
    }
    // check access unless allow override set - only check access on primary model
    // records and not on action records
    if (!args.allow && !this.model.isAction) {
        // get global access control instance
        var accessControl = ImmutableAccessControl.getGlobal()
        // build args for access check - default to any scope
        var allowArgs = {
            action: 'read',
            model: this.model.name,
            scope: this.scope,
            session: this.session,
            states: states,
        }
        // check access
        var allow = accessControl.allowModel(allowArgs)
        // throw access denied error if not allowed
        if (!allow) {
            httpError(403, null, accessControl.audit)
        }
    }
}
578319
function( /*arguments*/ ) {
			gui.Array.make(arguments).forEach(function(type) {
				var Type = edb.Type.is(type) ? type.constructor : type;
				this.$input.$oninput(
					new edb.Input(Type, null)
				);
			}, this);
		}
323554
public void f(int i, Object... args) {
    setIndex(i);
    setArguments(args);
    if (args.length == 1 && args[0] instanceof JavaScriptObject) {
      if (JsUtils.isElement((JavaScriptObject) args[0])) {
        setElement((com.google.gwt.dom.client.Element) args[0]);
        f(getElement(), i);
      } else if (JsUtils.isEvent((JavaScriptObject) args[0])) {
        setEvent((Event) args[0]);
        f(getEvent());
      } else {
        f();
      }
    }
  }
1122948
function store(index, value) {
    // We don't store any static data for local variables, so the first time
    // we see the template, we should store as null to avoid a sparse array
    var adjustedIndex = index + HEADER_OFFSET;
    if (adjustedIndex >= tView.data.length) {
        tView.data[adjustedIndex] = null;
    }
    viewData[adjustedIndex] = value;
}
965138
function (args) {
                var refreshMgrInfo = this._registerInRefreshMgr();
                refreshMgrInfo.queue = null;
                if(refreshMgrInfo.refreshArgs && refreshMgrInfo.refreshArgs.animate){
                    args.animate = true;
                }
                refreshMgrInfo.refreshArgs = args;
            }
794652
function initRelations (args) {
    // create map of relations
    this.relations = {}
    // get relations from args
    var relations = requireValidOptionalObject(args.relations)
    // validate and add relations
    _.each(relations, (relation, relatedModelName) => {
        this.relations[relatedModelName] = relation
    })
}
335679
@Override
  public void init(IndexSchema schema, Map<String, String> args) {
    args.put(PARSER_IMPL, MtasPreAnalyzedParser.class.getName());
    super.init(schema, args);
  }
230777
function createViewmodel(name,component,params,pre,post)
      {
        /* creates blank observable data set */
        var obsv = _mixed({},name);

        /* Attach Pre properties, or pre designed attachments for every Data set */
        for(var x=0,keys=Object.keys(pre),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(pre[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(pre.pointers)
            {
              if(pre.pointers[keys[x]] === undefined) obsv.set(keys[x],pre[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],pre[keys[x]]);
            }
          }
        }
        
        if(pre.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(pre.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = pre.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* if there are any prototypes on this component they are added to the Data sets prototype */
        for(var x=0,keys=Object.keys(component.prototype),len=keys.length;x<len;x++)
        {
          Object.defineProperty(obsv,[keys[x]],setDescriptor(component.prototype[keys[x]],true));
        }
        
        /* we then apply the component constructor to the data set in order to add the 'this' properties from it and pass in the params */
        component.apply(obsv,params);
        
        /* Post attachments, overwritables, for data or pointers */
        for(var x=0,keys=Object.keys(post),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(post[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(post.pointers)
            {
              if(post.pointers[keys[x]] === undefined) obsv.set(keys[x],post[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],post[keys[x]]);
            }
          }
        }
        
        /* post pointers */
        if(post.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(post.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = post.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* map filters as binded to vm */
        for(var x=0,keys=Object.keys(obsv.filters),len=keys.length;x<len;x++)
        {
          obsv.filters[keys[x]] = obsv.filters[keys[x]].bind(obsv);
        }

        /* Apply session storage if set, this allows for storing this vm in session storage, only those values that are enumerable */
        if(obsv.sessionStorage)
        {
            var storage = sessionStorage.getItem((obsv.id || name));
            
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }

        /* Apply local storage if set, similiar to session Storage except this persists even after browser is closed */
        if(obsv.localStorage)
        {
            var storage = localStorage.getItem((obsv.id || name));
          
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                localStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                localStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }
        
        if(obsv.store)
        {
            /* adds a pointer in model to this viewmodel, look into using id as an id from component: <test id="storeid"></test> */
            _model.set((obsv.id || name),obsv);
        }

        return obsv;
      }
19934
function (args) {
  if (false === (this instanceof MemoryStore)) throw new Error('new operator required');
  args = args || {};
  this.storeType = args.storeType || "MemoryStore";
  this.name = args.name || 'a ' + this.storeType;
  this.storeProperty = {
    isReady: true,
    canGetModel: true,
    canPutModel: true,
    canDeleteModel: true,
    canGetList: true
  };
  this.data = [];// Each ele is an array of model types and contents (which is an array of IDs and Model Value Store)
  this.idCounter = 0;
  var unusedProperties = getInvalidProperties(args, ['name', 'storeType']);
  var errorList = [];
  for (var i = 0; i < unusedProperties.length; i++) errorList.push('invalid property: ' + unusedProperties[i]);
  if (errorList.length > 1) throw new Error('error creating Store: multiple errors');
  if (errorList.length) throw new Error('error creating Store: ' + errorList[0]);
}