Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ABApplicationCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,12 +994,14 @@ module.exports = class ABApplicationCore extends ABMLClass {
/**
* @method viewNew()
*
* return an instance of a new (unsaved) ABView.
* return an instance of a new (unsaved) ABView tied to this ABApplication.
*
* @param {object} values view definition/settings
* @param {ABView} [parent=null] parent view of the new view
* @return {ABView}
*/
viewNew(values, application, parent) {
return this.ViewManager.newView(values, application, parent);
viewNew(values, parent = null) {
return this.ViewManager.newView(values, this, parent);
}

///
Expand Down
2 changes: 1 addition & 1 deletion ABFactoryCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ class ABFactory extends EventEmitter {
if (!this._mockApp) {
this._mockApp = this.applicationNew({});
}
return this._mockApp.viewNew(values, this._mockApp);
return this._mockApp.viewNew(values, null);
}

//
Expand Down
2 changes: 1 addition & 1 deletion mobile/ABMobilePageCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ module.exports = class ABMobilePageCore extends ABMobileView {
// NOTE: this returns a new ABView component.
// when creating a new page, the 3rd param should be null, to signify
// the top level component.
var page = this.application.viewNew(values, this.application, null);
var page = this.application.viewNew(values, null);
page.parent = this;
return page;
}
Expand Down
20 changes: 6 additions & 14 deletions mobile/ABMobileViewCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ module.exports = class ABMobileViewCore extends ABMLClass {
*/
static newInstance(application, parent) {
// return a new instance from ABViewManager:
return application.viewNew(
{ key: this.common().key },
application,
parent
);
return application.viewNew({ key: this.common().key }, parent);
}

viewKey() {
Expand Down Expand Up @@ -210,7 +206,7 @@ module.exports = class ABMobileViewCore extends ABMLClass {
(values.viewIDs || []).forEach((id) => {
var def = this.AB.definitionByID(id);
if (def) {
views.push(this.application.viewNew(def, this.application, this));
views.push(this.application.viewNew(def, this));
} else {
this.__missingViews.push(id);
}
Expand Down Expand Up @@ -552,12 +548,8 @@ module.exports = class ABMobileViewCore extends ABMLClass {
* @method viewNew()
* @return {ABView}
*/
viewNew(values, application, parent) {
return this.application.viewNew(
values,
application || this.application,
parent || this
);
viewNew(values, parent) {
return this.application.viewNew(values, parent || this);
}

/**
Expand Down Expand Up @@ -811,7 +803,7 @@ module.exports = class ABMobileViewCore extends ABMLClass {
}

// copy from settings
let result = this.viewNew(config, this.application, parent);
let result = this.viewNew(config, parent);

// change id
if (parent == null) {
Expand Down Expand Up @@ -885,7 +877,7 @@ module.exports = class ABMobileViewCore extends ABMLClass {
}

// copy from settings
let result = this.application.viewNew(config, this.application, parent);
let result = this.application.viewNew(config, parent);

// keep the parent
result.parent = parent || this.parent;
Expand Down
2 changes: 0 additions & 2 deletions views/ABViewConditionalContainerCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = class ABViewConditionalContainerCore extends ABViewContainer {
removable: false,
},
},
application,
this
);

Expand All @@ -47,7 +46,6 @@ module.exports = class ABViewConditionalContainerCore extends ABViewContainer {
removable: false,
},
},
application,
this
);

Expand Down
21 changes: 6 additions & 15 deletions views/ABViewCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ module.exports = class ABViewCore extends ABMLClass {
*/
static newInstance(application, parent) {
// return a new instance from ABViewManager:
return application.viewNew(
{ key: this.common().key },
application,
parent
);
return application.viewNew({ key: this.common().key }, parent);
}

viewKey() {
Expand Down Expand Up @@ -214,7 +210,7 @@ module.exports = class ABViewCore extends ABMLClass {
(values.viewIDs || []).forEach((id) => {
var def = this.AB.definitionByID(id);
if (def) {
views.push(this.application.viewNew(def, this.application, this));
views.push(this.application.viewNew(def, this));
} else {
this.__missingViews.push(id);
}
Expand Down Expand Up @@ -555,15 +551,10 @@ module.exports = class ABViewCore extends ABMLClass {
/**
* @method viewNew()
*
*
* @return {ABView}
*/
viewNew(values, application, parent) {
return this.application.viewNew(
values,
application || this.application,
parent || this
);
viewNew(values, parent) {
return this.application.viewNew(values, parent || this);
}

/**
Expand Down Expand Up @@ -805,7 +796,7 @@ module.exports = class ABViewCore extends ABMLClass {
}

// copy from settings
let result = this.viewNew(config, this.application, parent);
let result = this.viewNew(config, parent);

// change id
if (parent == null) {
Expand Down Expand Up @@ -879,7 +870,7 @@ module.exports = class ABViewCore extends ABMLClass {
}

// copy from settings
let result = this.application.viewNew(config, this.application, parent);
let result = this.application.viewNew(config, parent);

// keep the parent
result.parent = parent || this.parent;
Expand Down
1 change: 0 additions & 1 deletion views/ABViewLayoutCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module.exports = class ABViewLayoutCore extends ABViewWidget {
{
key: ABViewContainer.common().key,
},
this.application,
this
)
);
Expand Down
2 changes: 1 addition & 1 deletion views/ABViewPageCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ module.exports = class ABViewPageCore extends ABViewContainer {
// NOTE: this returns a new ABView component.
// when creating a new page, the 3rd param should be null, to signify
// the top level component.
var page = this.application.viewNew(values, this.application, null);
var page = this.application.viewNew(values, null);
page.parent = this;
return page;
}
Expand Down
1 change: 0 additions & 1 deletion views/ABViewTabCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ module.exports = class ABViewTabCore extends ABViewWidget {
label: tabName,
tabicon: tabIcon,
},
this.application,
this
)
.save();
Expand Down
Loading