Friday, March 13, 2009

Nested Views support in MVC


Nested view is a view that is based on other views. In other words, it is a view which contains multiple views (or) widgets.

For example,


Nested views are used to create complex user interfaces. There are so many mechanisms to handle nested views, but the most common one is "Treat individual views and nested views in the same way" .This reduces design complexity and increases flexibility. This mechanism can be achieved by using Composite design pattern.


Composite design pattern:


  • Composite allows a group of objects to be treated in the same way as a single instance of an object.

  • Composite lets clients treat individual objects and compositions uniformly.


Both Views and Nested Views are derived from the same View base class. Nested View classes will have some extra functionality to support multiple Views or widgets.

The VIEW framework that handles and maintains Views is programmed using View base class interfaces, so no changes in logic are needed to support different types of Views.

Let's take, For example, how Draw () Interface of Views looks like.





Composite design pattern – Wikipedia, for more information about composite pattern.






No comments:

Post a Comment