View
Extends:
An Arva View. Can be constructed explicitly by using new View() but is more commonly used as a base class for views used by the app.
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
decorations: * |
|
public |
layout: * |
|
public |
this member was deprecated. `
The old way of setting the spec of the renderables created by adding renderables through
`this.renderables.myRenderable = ....
|
|
public |
A copy of the options that were passed in the constructor |
|
public |
The renderables "outputted" by the view that are passed to the underlying famous-flex layer |
Method Summary
Public Methods | ||
public |
addRenderable(renderable: Renderable, renderableName: String, Decorator: Decorator): Renderable Adds a renderable to the layout. |
|
public |
build(): void this method was deprecated.
Deprecated, it is no longer required to call build() from within your View instances. |
|
public |
cancelRepeatFlowState(renderableName: *) Cancel a repeating renderable. |
|
public |
Returns true if the view contains uncalculated surfaces |
|
public |
decorateRenderable(renderableName: String) Decorates a renderable with other decorators. |
|
public |
getRenderableFlowState(renderableName: String): String Gets the name of a flow state of a renderable. |
|
public |
getResolvedSize(renderableOrName: Renderable/Name): * Gets the size used when displaying a renderable on the screen the last tick |
|
public |
Gets the scroll view that was set if @layout.scrollable was used on the view |
|
public |
getSize(): *[] getSize() is called by this view and by layoutControllers. |
|
public |
Gets the name of the flow state of a view. |
|
public |
hideRenderable(renderableName: *): Promise Hides a renderable that has been declared with @layout.animate |
|
public |
Passes a callback that gets called every time the context size changes. |
|
public |
Gets a (new) context size of the view. |
|
public |
prioritiseDockAfter(renderableName: String, prevRenderableName: String): * |
|
public |
prioritiseDockBefore(renderableName: String, nextRenderableName: String): * Rearranges the order in which docked renderables are parsed for rendering, ensuring that 'renderableName' is processed before 'nextRenderableName'. |
|
public |
Reflows the layout while also informing any subscribing parents that a reflow has to take place |
|
public |
removeRenderable(renderableName: String) Removes the renderable from the view |
|
public |
repeatFlowState(renderableName: *, stateName: *): Promise Repeat a certain flowState indefinitely |
|
public |
replaceRenderable(newRenderable: *) Replaces an existing decorated renderable with a new renderable, preserving all necessary state and decorations |
|
public |
setDefaultState(renderableName: *, stateName: *) Initiate a renderable to a default flow state. |
|
public |
Sets a renderable flow state as declared in the @flow.stateStep, or @flow.defaultState |
|
public |
setViewFlowState(): * Sets a renderable flow state as declared in the @flow.viewState |
|
public |
showRenderable(renderableName: String): Promise |
Public Constructors
public constructor source
Params:
Name | Type | Attribute | Description |
options. | Object | The options passed to the view will be stored in this.options, but won't change any behaviour of the core functionality of the view. Instead, configuration of the View is done by decorators. |
Example:
HomeController extends Controller {
Index() {
let view = new View();
view.add(new Surface({properties: {backgroundColor: 'red'}}));
return view
}
}
class HomeView extends View {
@layout.size(100, 100)
@layout.place.center()
mySurface = new Surface({properties: {backgroundColor: 'red'}})
}
Public Members
public decorations: * source
public layout: * source
Public Methods
public addRenderable(renderable: Renderable, renderableName: String, Decorator: Decorator): Renderable source
Adds a renderable to the layout.
Params:
Name | Type | Attribute | Description |
renderable | Renderable | The renderable to be added |
|
renderableName | String | The name (key) of the renderable |
|
Decorator | Decorator | Any decorator(s) to apply to the renderable |
Return:
Renderable | The renderable that was assigned |
public build(): void source
Deprecated, it is no longer required to call build() from within your View instances.
Return:
void |
public cancelRepeatFlowState(renderableName: *) source
Cancel a repeating renderable. This will cancel the animation for next flow-cycle, it won't interject the current animation cycle.
Params:
Name | Type | Attribute | Description |
renderableName | * |
public containsUncalculatedSurfaces(): Boolean source
Returns true if the view contains uncalculated surfaces
public decorateRenderable(renderableName: String) source
Decorates a renderable with other decorators. Using the same decorators as used previously will override the old ones.
Params:
Name | Type | Attribute | Description |
renderableName | String | The name of the renderable |
|
...decorators | * | The decorators that should be applied |
Example:
this.decorateRenderable('myRenderable',layout.size(100, 100));
public getRenderableFlowState(renderableName: String): String source
Gets the name of a flow state of a renderable.
Params:
Name | Type | Attribute | Description |
renderableName | String | the name of the renderable of which the flow state is concerned |
public getResolvedSize(renderableOrName: Renderable/Name): * source
Gets the size used when displaying a renderable on the screen the last tick
Params:
Name | Type | Attribute | Description |
renderableOrName | Renderable/Name | The renderable or the name of the renderable of which you need the size |
Return:
* |
public getScrollView(): ReflowingScrollView source
Gets the scroll view that was set if @layout.scrollable was used on the view
public getSize(): *[] source
getSize() is called by this view and by layoutControllers. For lazy people that don't want to specifiy their own getSize() function, we provide a fallback. This function can be performance expensive when using non-docked renderables, but for docked renderables it is efficient and convenient]
Return:
*[] |
public hideRenderable(renderableName: *): Promise source
Hides a renderable that has been declared with @layout.animate
Params:
Name | Type | Attribute | Description |
renderableName | * |
public onNewSize(callback: Function) source
Passes a callback that gets called every time the context size changes.
Params:
Name | Type | Attribute | Description |
callback | Function | a callback with arguments (width, height) |
public onceNewSize(): Promise source
Gets a (new) context size of the view. This will always happen at least once immediately after the view is constructed. Hence, it can safely be used in the constructor to get the (initial) size of the view.
Example:
constructor(options){
super(options);
onceNewSize.then((width, height) => {
console.log(width, height);
});
}
public prioritiseDockBefore(renderableName: String, nextRenderableName: String): * source
Rearranges the order in which docked renderables are parsed for rendering, ensuring that 'renderableName' is processed before 'nextRenderableName'.
Return:
* |
public reflowRecursively() source
Reflows the layout while also informing any subscribing parents that a reflow has to take place
public removeRenderable(renderableName: String) source
Removes the renderable from the view
Params:
Name | Type | Attribute | Description |
renderableName | String | The name of the renderable |
public repeatFlowState(renderableName: *, stateName: *): Promise source
Repeat a certain flowState indefinitely
Params:
Name | Type | Attribute | Description |
renderableName | * | ||
stateName | * | ||
persistent. | Boolean | If true, then it will keep on repeating until explicitly cancelled by cancelRepeatFlowState. If false, it will be interrupted automatically by any interrput to another state. Defaults to true |
Return:
Promise | resolves to false if the flow state can't be repeated due to an existing running repeat |
public replaceRenderable(newRenderable: *) source
Replaces an existing decorated renderable with a new renderable, preserving all necessary state and decorations
Params:
Name | Type | Attribute | Description |
renderableName. | String | The name of the renderable |
|
newRenderable | * |
public setDefaultState(renderableName: *, stateName: *) source
Initiate a renderable to a default flow state.
Params:
Name | Type | Attribute | Description |
renderableName | * | ||
stateName | * |
public setRenderableFlowState(): * source
Sets a renderable flow state as declared in the @flow.stateStep, or @flow.defaultState
Return:
* |
public setViewFlowState(): * source
Sets a renderable flow state as declared in the @flow.viewState
Return:
* |