Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

t/95: Remove the Controller class #100

Merged
merged 24 commits into from
Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
259682e
Flattened UI architecture by moving Controller logic into View class.
oleq Oct 27, 2016
85f3404
Allowed ViewCollection in TemplateDefinition.
oleq Oct 27, 2016
96b6067
Extended View class tests with child collection management test cases.
oleq Oct 27, 2016
00d7062
Tests: Minor code refactoring in View tests.
oleq Oct 27, 2016
8d0ed91
Created ViewCollection class.
oleq Oct 27, 2016
e069a3d
Tests: Minor fixes to Template tests after API changes in ViewCollect…
oleq Oct 27, 2016
d905c66
Minor fixes to ViewCollection docs.
oleq Oct 28, 2016
70743a7
Code refactoring in ViewCollection class.
oleq Oct 28, 2016
fb9a683
Removed Controller and ControllerCollection classes which are obsolete.
Nov 3, 2016
0799aa6
Simplified ComponentFactory class.
Nov 3, 2016
da5a689
Allowed adding View instances to ViewCollection before it has been in…
Nov 4, 2016
6085e09
Fixed: Don't inject child view's element into DOM if collection has n…
Nov 4, 2016
e2b9385
Fixed: parent–less ViewCollection should modify DOM.
Nov 4, 2016
22dc868
Renamed and refactored createTestUIController -> createTestUIView.
Nov 4, 2016
4f2d716
Post rebase fixes.
Nov 4, 2016
f3f8819
Removed obsolete Region class.
Nov 4, 2016
073cbf8
Bulletproofed DOMEmitterMixin tests by cleanin-up after each one.
Nov 4, 2016
8b3680b
Code refac: Used ...spread instead of slicing arguments in DOMEmitter…
Nov 7, 2016
775cef8
Docs: getNodeUID returns a String, not a Number.
Nov 7, 2016
dfb77b6
Merge branch 'master' into t/95
Reinmar Nov 7, 2016
fbf6535
Tests: Improved test coverage in Template class.
Nov 7, 2016
a822476
Simplified setting #ready state of the ViewCollection.
Nov 7, 2016
6f7e658
Docs: Added docs to the View class.
Nov 7, 2016
4ac7816
Merge branch 'master' into t/95
Reinmar Nov 8, 2016
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
23 changes: 7 additions & 16 deletions src/componentfactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,26 @@ export default class ComponentFactory {
* @param {String} name The name of the component.
* @param {Function} ControllerClass The component controller constructor.
* @param {Function} ViewClass The component view constructor.
* @param {ui.Model} model The model of the component.
* @param {Function} [callback] The callback to process the view instance,
* i.e. to set attribute values, create attribute bindings, etc.
*/
add( name, ControllerClass, ViewClass, model ) {
add( name, callback ) {
if ( this._components.get( name ) ) {
throw new CKEditorError(
'componentfactory-item-exists: The item already exists in the component factory.', { name }
);
}

this._components.set( name, {
ControllerClass,
ViewClass,
model
} );
this._components.set( name, callback );
}

/**
* Creates a component instance.
* Creates a component view instance.
*
* @param {String} name The name of the component.
* @returns {ui.Controller} The instantiated component.
* @returns {ui.View} The instantiated component view.
*/
create( name ) {
const component = this._components.get( name );

const model = component.model;
const view = new component.ViewClass( model, this.editor.locale );
const controller = new component.ControllerClass( model, view, this.editor );

return controller;
return this._components.get( name )( this.editor.locale );
}
}
289 changes: 0 additions & 289 deletions src/controller.js

This file was deleted.

Loading