Emerald Hand Wiki

Sider - Dev - View Component

Modified: 2007/03/21 10:02 by Ornus - Categorized as: Development, Sider
View components:

  • Sider - Essential view component on which type and view scripting is built.



Edit

Introduction

View component is a collection of files to be shared among the views. Often a JavaScript library or GUI control is a single component. They help avoid having numerous copies of the same files used by the views. They also eliminate the need to create a large number of references when there are a lot of files in a component.

View description file (view.xml) can describe specific files to include, but also view components to be used by the view. Sider then passes an XML tree describing all view component files to the view transformation is then passed. The transformation can then reference view component files at the appropriate places. If view component offers any XSLT files and view description references them, they will be automatically imported to the view transformation.

Like all extensions view component is located in viewComponentName/x.x.x.x (version)/.

Edit

Philosophy

View components are created either to let view use some new JavaScript library or to share common code (XSL to generate HTML for some control). It is often created as a result of view refactoring.

We believe code should be reused as much as possible. View component is code reuse tool and in many cases code that can be shared between different views should go to a view component (even if it's Sider specific).

In some cases the code can be reused by different views but supports only specific documents (XSLT to generate HTML for the view component control for example). The transformation should still go to the view component. It will be view developer's responsibility to figure out if supplied transformation can be used or if a new one will need to be created.

Edit

Usage

View components are used by the views and are often referenced from the view generated HTML page. A view references the view component from view.xml file. It is also the place to reference a view component transformation.

When view transformation is loaded and ran it is passed an XML tree with reference to all view component files. See View and View Foundation for more details.

Edit

viewComponent.xml

A view component usually consists of many files. They are all described by a viewComponent.xml file. All data that is passed to the view transformation is based on what is in that configuration file.

>
Node nameParent node nameDescriptionValue
viewComponentDocument elementRoot element for the view component descriptionNodes describing the view component.
@idviewComponentView component ID.GUID
@nameviewComponentView component name.String
@versionviewComponentView component version."x.x.x.x"
includesviewComponentHolds references to the view component files.List of file elements, each describing a view component file.
fileviewComponentReferences a single file to be available for any view that uses this view component.@href - Relative from the viewComponent.xml path to the file.For example:

Edit

Example

Example viewComponent.xml file.


<?xml version="1.0" encoding="utf-8" ?>
<viewComponent id="3144D754-9DB6-4B4A-A0F5-D85E9CA1DA5D" name="jsolait" version="0.5.0.0">
<includes>
<file href="jsolait.js"/>

<file href="packages/jsforms/generateTree.xslt"/>
<file href="packages/jsforms/generateAdvancedTree.xslt"/>

...

</includes>
</viewComponent>

Copyright © 2006-2008 Emerald Hand, Inc. All rights reserved.
Powered by ScrewTurn Wiki version 2.0.34. Some of the icons created by FamFamFam.