2019-07-24 08:08:02 +02:00
|
|
|
/**
|
|
|
|
* API Component Interface - Do not construct objects of this type directly
|
|
|
|
* @param parent
|
|
|
|
* @param id
|
|
|
|
* @param name
|
2019-08-10 19:48:08 +02:00
|
|
|
* @param register
|
|
|
|
* @param selected
|
2019-07-24 08:08:02 +02:00
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
R3.API.Component = function(
|
|
|
|
parent,
|
|
|
|
id,
|
2019-08-10 19:48:08 +02:00
|
|
|
name,
|
|
|
|
register,
|
|
|
|
selected
|
2019-07-24 08:08:02 +02:00
|
|
|
) {
|
|
|
|
|
|
|
|
if (R3.Utils.UndefinedOrNull(parent)) {
|
|
|
|
parent = null;
|
|
|
|
}
|
|
|
|
this.parent = parent;
|
|
|
|
|
|
|
|
if (R3.Utils.UndefinedOrNull(id)) {
|
|
|
|
id = R3.Utils.RandomId();
|
|
|
|
}
|
|
|
|
this.id = id;
|
|
|
|
|
2019-10-06 21:11:18 +02:00
|
|
|
this.componentType = R3.GetComponentType(this);
|
2019-07-24 08:08:02 +02:00
|
|
|
|
|
|
|
if (R3.Utils.UndefinedOrNull(name)) {
|
|
|
|
name = R3.Component.GetComponentFriendlyName(this.componentType) + ' (' + this.id + ')';
|
|
|
|
}
|
|
|
|
this.name = name;
|
2019-08-10 19:48:08 +02:00
|
|
|
|
|
|
|
if (R3.Utils.UndefinedOrNull(register)) {
|
|
|
|
register = true;
|
|
|
|
}
|
|
|
|
this.register = register;
|
|
|
|
|
|
|
|
if (R3.Utils.UndefinedOrNull(selected)) {
|
|
|
|
selected = false;
|
|
|
|
}
|
|
|
|
this.selected = selected;
|
2019-07-24 08:08:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
R3.API.Component.prototype.constructor = R3.API.Component;
|
|
|
|
|
2019-08-07 05:17:41 +02:00
|
|
|
/**
|
|
|
|
* Wrapper for R3.Utils.GetFirstParent
|
|
|
|
* @param constructor
|
|
|
|
* @returns {*}
|
|
|
|
*/
|
|
|
|
R3.API.Component.prototype.getFirstParent = function(constructor) {
|
|
|
|
return R3.D3.GetFirstParent(this, constructor);
|
|
|
|
};
|
2019-07-24 14:45:42 +02:00
|
|
|
|
2019-08-07 05:17:41 +02:00
|
|
|
/**
|
|
|
|
* Wrapper for R3.Utils.GetParent
|
|
|
|
* @param property
|
|
|
|
* @param index
|
|
|
|
* @param constructor
|
|
|
|
* @returns {*}
|
|
|
|
*/
|
|
|
|
R3.API.Component.getParent = function(property, index, constructor) {
|
|
|
|
return R3.D3.GetParent(this, property, index, constructor);
|
2019-07-24 14:45:42 +02:00
|
|
|
};
|