Esempio n. 1
0
 _createHeadersRec: function (attrs, selectedAttrs, Headers, path, expanded) {
     if (_.size(selectedAttrs) > 0) {
         for (var i = 0; i < attrs.length; ++i) {
             if (attrs[i].visible === true) {
                 var attr = attrs[i];
                 if (this._isSelectedAttr(attr, selectedAttrs)) {
                     if (isCompoundAttr(attr)) {
                         // for a selected compound attribute select all child attributes (= the wildcard),
                         // child attributes might be expanded so include the selected attributes as well when recursing
                         this._createHeadersRec(attr.attributes, _.extend({'*': null}, selectedAttrs), Headers, path, expanded);
                     } else {
                         var attrPath = path.concat(attr.name);
                         if (this._isExpandedAttr(attr, selectedAttrs)) {
                             var EntityCollapseBtn = EntityCollapseBtnFactory({
                                 attrPath: attrPath,
                                 onCollapse: this.props.onCollapse
                             });
                             Headers.push(th({
                                 className: 'expanded-left compact',
                                 key: 'c' + attrPath.join()
                             }, EntityCollapseBtn));
                             this._createHeadersRec(attr.refEntity.attributes, selectedAttrs[attr.name], Headers, path.concat(attr.name), true);
                         }
                         else {
                             if (this._canExpandAttr(attr, path)) {
                                 var EntityExpandBtn = EntityExpandBtnFactory({
                                     attrPath: attrPath,
                                     onExpand: this.props.onExpand
                                 });
                                 Headers.push(th({
                                     className: 'compact',
                                     key: 'e' + attrPath.join()
                                 }, EntityExpandBtn));
                             }
                             var TableHeaderCell = TableHeaderCellFactory({
                                 className: i === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                                 attr: attr,
                                 path: path,
                                 canSort: path.length === 0, // only allow sorting of top-level attributes
                                 sortOrder: this._getSortOrder(attr, path),
                                 onSort: this.props.onSort,
                                 key: attrPath.join()
                             });
                             Headers.push(TableHeaderCell);
                         }
                     }
                 }
             }
         }
     } else {
         // add an empty non-compacted column so that compact column stay compact
         Headers.push(th({key: 'dummy'}));
     }
 },
Esempio n. 2
0
		_createColsRec: function(item, entity, attrs, selectedAttrs, Cols, path, expanded, parentAttr) {
			if(_.size(selectedAttrs) > 0) {
				for(var j = 0; j < attrs.length; ++j) {
					var attr = attrs[j];
					if(this._isSelectedAttr(attr, selectedAttrs)) {
						if(attr.visible === true) {
							var attrPath = path.concat(attr.name);
							if(isCompoundAttr(attr)) {
								this._createColsRec(item, entity, attr.attributes, {'*': null}, Cols, path, expanded, parentAttr);
							} else {

								if(this._isExpandedAttr(attr, selectedAttrs)) {
									Cols.push(td({className: 'expanded-left', key : attrPath.join()}));
									var value = (item !== undefined && item !== null) ? (_.isArray(item) ? _.map(item, function(value) { return value[attr.name];}) : item[attr.name]) : null;
									this._createColsRec(value, attr.refEntity, attr.refEntity.attributes, selectedAttrs[attr.name], Cols, attrPath, true, attr);
								} else {
									if(this._canExpandAttr(attr, path)) {
										Cols.push(td({key: 'e' + attrPath.join()}));
									}
									var value = (item !== undefined && item !== null) ? (_.isArray(item) ? _.map(item, function(value) { return value[attr.name];}) : item[attr.name]) : null;
									var TableCell = TableCellFactory({
										className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
										entity: entity,
										attr : attr,
										value: value,
										expanded: expanded,
										onEdit: this.props.onEdit,
										key : attrPath.join(),
										parentAttr : parentAttr
									});
									Cols.push(TableCell);
								}
							}
						}
					}
				}
			} else {
				// add an empty non-compacted column so that compact column stay compact
				Cols.push(td({key: 'dummy'}));
			}
		}
Esempio n. 3
0
 _createColsRec: function (item, entity, attrs, selectedAttrs, Cols, path, expanded, behindMref) {
     if (_.size(selectedAttrs) > 0) {
         for (var j = 0; j < attrs.length; ++j) {
             var attr = attrs[j];
             if (this._isSelectedAttr(attr, selectedAttrs)) {
                 if (attr.visible === true) {
                     var attrPath = path.concat(attr.name);
                     if (isCompoundAttr(attr)) {
                         this._createColsRec(item, entity, attr.attributes, {'*': null}, Cols, path, expanded, behindMref);
                     } else {
                         behindMref |= attr.fieldType === 'MREF' || attr.fieldType === 'CATEGORICAL_MREF' || attr.fieldType === 'ONE_TO_MANY';
                         if (this._isExpandedAttr(attr, selectedAttrs)) {
                             Cols.push(td({className: 'expanded-left', key: attrPath.join()}));
                             this._createColsRec(this._getAttributeValues(item, attr.name), attr.refEntity, attr.refEntity.attributes, selectedAttrs[attr.name], Cols, attrPath, true, behindMref);
                         } else {
                             if (this._canExpandAttr(attr, path)) {
                                 Cols.push(td({key: 'e' + attrPath.join()}));
                             }
                             var TableCell = TableCellFactory({
                                 className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                                 entity: entity,
                                 attr: attr,
                                 value: this._getAttributeValues(item, attr.name),
                                 expanded: expanded,
                                 onEdit: this.props.onEdit,
                                 key: attrPath.join(),
                                 behindMref: behindMref
                             });
                             Cols.push(TableCell);
                         }
                     }
                 }
             }
         }
     } else {
         // add an empty non-compacted column so that compact column stay compact
         Cols.push(td({key: 'dummy'}));
     }
 }
Esempio n. 4
0
 _createColsRec: function (item, entity, attrs, selectedAttrs, Cols, path, expanded, behindMref) {
     if (_.size(selectedAttrs) > 0) {
         for (var j = 0; j < attrs.length; ++j) {
             var attr = attrs[j];
             if (this._isSelectedAttr(attr, selectedAttrs)) {
                 if (attr.visible === true) {
                     var attrPath = path.concat(attr.name);
                     if (attr.name === "cDNAchange1") {
                         var mut1 = [];
                         if (item["cDNAchange1"] !== undefined) mut1 = item["cDNAchange1"];
                         var mut2 = [];
                         if (item["cDNAchange2"] !== undefined) mut2 = item["cDNAchange2"];
                         var attrPath = path.concat(mutationAttr.name);
                         var TableCell = TableCellFactory({
                             className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                             entity: mut1,
                             attr: mutationAttr,
                             value: [mut1, mut2],
                             expanded: true,
                             key: attrPath.join(),
                             behindMref: true,
                             onRowInspect: this.props.onRowInspect
                         });
                         Cols.push(TableCell);
                         var attrPath = path.concat(proteinAttr.name);
                         var TableCell = TableCellFactory({
                             className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                             entity: mut1,
                             attr: proteinAttr,
                             value: [mut1.aanotation, mut2.aanotation],
                             expanded: true,
                             key: attrPath.join(),
                             onRowInspect: this.props.onRowInspect,
                             behindMref: true
                         });
                         Cols.push(TableCell);
                         var attrPath = path.concat(consequenceAttr.name);
                         var TableCell = TableCellFactory({
                             className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                             entity: mut1,
                             attr: consequenceAttr,
                             value: [this._getAttributeValues(mut1, consequenceAttr.name), this._getAttributeValues(mut2, consequenceAttr.name)],
                             expanded: true,
                             key: attrPath.join(),
                             onRowInspect: this.props.onRowInspect,
                             behindMref: true
                         });
                         Cols.push(TableCell);
                         var attrPath = path.concat(exonAttr.name);
                         var TableCell = TableCellFactory({
                             className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                             entity: mut1,
                             attr: exonAttr,
                             value: [this._getAttributeValues(mut1, exonAttr.name), this._getAttributeValues(mut2, exonAttr.name)],
                             expanded: true,
                             key: attrPath.join(),
                             onRowInspect: this.props.onRowInspect,
                             behindMref: true
                         });
                         Cols.push(TableCell);
                     }
                     else {
                         if (isCompoundAttr(attr)) {
                             this._createColsRec(item, entity, attr.attributes, {'*': null}, Cols, path, expanded, behindMref);
                         } else {
                             behindMref |= attr.fieldType === 'MREF' || attr.fieldType === 'CATEGORICAL_MREF';
                             if (this._isExpandedAttr(attr, selectedAttrs)) {
                                 Cols.push(td({className: 'expanded-left', key: attrPath.join()}));
                                 this._createColsRec(this._getAttributeValues(item, attr.name), attr.refEntity, attr.refEntity.attributes, selectedAttrs[attr.name], Cols, attrPath, true, behindMref);
                             } else {
                                 if (this._canExpandAttr(attr, path)) {
                                     Cols.push(td({key: 'e' + attrPath.join()}));
                                 }
                                 var TableCell = TableCellFactory({
                                     className: j === attrs.length - 1 && expanded ? 'expanded-right' : undefined,
                                     entity: entity,
                                     attr: attr,
                                     value: this._getAttributeValues(item, attr.name),
                                     expanded: expanded,
                                     onEdit: this.props.onEdit,
                                     onRowInspect: this.props.onRowInspect,
                                     key: attrPath.join(),
                                     behindMref: behindMref
                                 });
                                 Cols.push(TableCell);
                             }
                         }
                     }
                 }
             }
         }
     } else {
         // add an empty non-compacted column so that compact column stay compact
         Cols.push(td({key: 'dummy'}));
     }
 }