refactor(core): rename ViewContainer to ViewContainerRef

This also renames InternalAppViewContainer into AppViewContainer

Related to #1477
Closes #1554
This commit is contained in:
Tobias Bosch
2015-04-27 09:26:55 -07:00
parent 0676fef61f
commit 6dece68bb8
22 changed files with 145 additions and 147 deletions

View File

@ -8,7 +8,7 @@ import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility';
import {Attribute, Query} from 'angular2/src/core/annotations/di';
import * as viewModule from 'angular2/src/core/compiler/view';
import * as avmModule from './view_manager';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import {Directive, Component, onChange, onDestroy, onAllChangesDone} from 'angular2/src/core/annotations/annotations';
import {ChangeDetector, ChangeDetectorRef} from 'angular2/change_detection';
@ -31,14 +31,14 @@ export class ElementRef {
boundElementIndex:number;
injector:Injector;
elementInjector:ElementInjector;
viewContainer:ViewContainer;
viewContainer:ViewContainerRef;
constructor(elementInjector, hostView, boundElementIndex, injector, viewManager, defaultProtoView){
this.elementInjector = elementInjector;
this.hostView = hostView;
this.boundElementIndex = boundElementIndex;
this.injector = injector;
this.viewContainer = new ViewContainer(viewManager, this, defaultProtoView);
this.viewContainer = new ViewContainerRef(viewManager, this, defaultProtoView);
}
}
@ -57,7 +57,7 @@ class StaticKeys {
this.defaultProtoViewId = Key.get(viewModule.AppProtoView).id;
this.viewId = Key.get(viewModule.AppView).id;
this.ngElementId = Key.get(NgElement).id;
this.viewContainerId = Key.get(ViewContainer).id;
this.viewContainerId = Key.get(ViewContainerRef).id;
this.changeDetectorRefId = Key.get(ChangeDetectorRef).id;
this.elementRefId = Key.get(ElementRef).id;
}

View File

@ -8,9 +8,7 @@ import {SetterFn} from 'angular2/src/reflection/types';
import {IMPLEMENTS, int, isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
import * as renderApi from 'angular2/src/render/api';
// TODO(tbosch): rename ViewContainer -> ViewContainerRef
// and InternalAppViewContainer -> ViewContainer!
export class InternalAppViewContainer {
export class AppViewContainer {
views: List<AppView>;
constructor() {
@ -36,7 +34,7 @@ export class AppView {
/// Host views that were added by an imperative view.
/// This is a dynamically growing / shrinking array.
imperativeHostViews: List<AppView>;
viewContainers: List<InternalAppViewContainer>;
viewContainers: List<AppViewContainer>;
preBuiltObjects: List<PreBuiltObjects>;
proto: AppProtoView;
renderer: renderApi.Renderer;

View File

@ -9,7 +9,7 @@ import * as avmModule from './view_manager';
/**
* @exportedAs angular2/view
*/
export class ViewContainer {
export class ViewContainerRef {
_viewManager: avmModule.AppViewManager;
_location: eiModule.ElementRef;
_defaultProtoView: viewModule.AppProtoView;

View File

@ -3,7 +3,7 @@ import {ListWrapper, MapWrapper, Map, StringMapWrapper, List} from 'angular2/src
import {isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
import * as eli from './element_injector';
import * as viewModule from './view';
import {Renderer, ViewRef, ViewContainerRef} from 'angular2/src/render/api';
import {Renderer, ViewRef, RenderViewContainerRef} from 'angular2/src/render/api';
import {AppViewManagerUtils} from './view_manager_utils';
import {AppViewPool} from './view_pool';
@ -121,7 +121,7 @@ export class AppViewManager {
}
_getRenderViewContainerRef(parentView:viewModule.AppView, boundElementIndex:number) {
return new ViewContainerRef(parentView.render, boundElementIndex);
return new RenderViewContainerRef(parentView.render, boundElementIndex);
}
_createViewRecurse(protoView:viewModule.AppProtoView) {

View File

@ -112,7 +112,7 @@ export class AppViewManagerUtils {
parentView.changeDetector.addChild(view.changeDetector);
var viewContainer = parentView.viewContainers[boundElementIndex];
if (isBlank(viewContainer)) {
viewContainer = new viewModule.InternalAppViewContainer();
viewContainer = new viewModule.AppViewContainer();
parentView.viewContainers[boundElementIndex] = viewContainer;
}
ListWrapper.insert(viewContainer.views, atIndex, view);