From b4f691ed415c3c4157086e770e7fa36d2a414994 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 27 Jan 2006 05:28:24 +0000 Subject: Added Master and Content tutorial. --- .../protected/pages/Advanced/MasterContent.page | 37 +++++++++++++++++++++ .../protected/pages/Advanced/mastercontent.gif | Bin 0 -> 10748 bytes .../protected/pages/Advanced/mastercontent.vsd | Bin 0 -> 54784 bytes .../protected/pages/Advanced/pcrelation.gif | Bin 0 -> 6600 bytes .../protected/pages/Advanced/pcrelation.vsd | Bin 0 -> 46080 bytes 5 files changed, 37 insertions(+) create mode 100644 demos/quickstart/protected/pages/Advanced/MasterContent.page create mode 100644 demos/quickstart/protected/pages/Advanced/mastercontent.gif create mode 100644 demos/quickstart/protected/pages/Advanced/mastercontent.vsd create mode 100644 demos/quickstart/protected/pages/Advanced/pcrelation.gif create mode 100644 demos/quickstart/protected/pages/Advanced/pcrelation.vsd (limited to 'demos/quickstart') diff --git a/demos/quickstart/protected/pages/Advanced/MasterContent.page b/demos/quickstart/protected/pages/Advanced/MasterContent.page new file mode 100644 index 00000000..6ac1b757 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/MasterContent.page @@ -0,0 +1,37 @@ + + +

Master and Content

+

+Pages in a Web application often share common portions. For example, all pages of this tutorial application share the same header and footer portions. If we repeatedly put header and footer in every page source file, it will be a maintenance headache if in future we want to something in the header or footer. To solve this problem, PRADO introduces the concept of master and content. It is essentially a decorator pattern, with content being decorated by master. +

+

+Master and content only apply to template controls (controls extending TTemplateControl or its child classes). A template control can have at most one master control and one or several contents (each represented by a TContent control). Contents will be inserted into the master control at places reserved by TContentPlaceHolder controls. And the presentation of the template control is that of the master control with TContentPlaceHolder replaced by TContent. +

+For example, assume a template control has the following template: + +<%@ MasterClass="MasterControl" %> +<com:TContent ID="A" > +content A +</com:TContent > +<com:TContent ID="B" > +content B +</com:TContent > +<com:TContent ID="B" > +content B +</com:TContent > + +which uses MasterControl as its master control. The master control has the following template, + +other stuff +<com:TContentPlaceHolder ID="A" /> +other stuff +<com:TContentPlaceHolder ID="B" /> +other stuff +<com:TContentPlaceHolder ID="C" /> +other stuff + +Then, the contents are inserted into the master control according to the following diagram, while the resulting parent-child relationship can be shown in the next diagram. Note, the template control discards everything in the template other than the contents, while the master control keeps everything and replaces the content placeholders with the contents according to ID matching. +

+ alt="Master and Content" /> + alt="Parent-child relationship between master and content" /> +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/mastercontent.gif b/demos/quickstart/protected/pages/Advanced/mastercontent.gif new file mode 100644 index 00000000..9354d65c Binary files /dev/null and b/demos/quickstart/protected/pages/Advanced/mastercontent.gif differ diff --git a/demos/quickstart/protected/pages/Advanced/mastercontent.vsd b/demos/quickstart/protected/pages/Advanced/mastercontent.vsd new file mode 100644 index 00000000..61f39b12 Binary files /dev/null and b/demos/quickstart/protected/pages/Advanced/mastercontent.vsd differ diff --git a/demos/quickstart/protected/pages/Advanced/pcrelation.gif b/demos/quickstart/protected/pages/Advanced/pcrelation.gif new file mode 100644 index 00000000..c1960d74 Binary files /dev/null and b/demos/quickstart/protected/pages/Advanced/pcrelation.gif differ diff --git a/demos/quickstart/protected/pages/Advanced/pcrelation.vsd b/demos/quickstart/protected/pages/Advanced/pcrelation.vsd new file mode 100644 index 00000000..328b0dfb Binary files /dev/null and b/demos/quickstart/protected/pages/Advanced/pcrelation.vsd differ -- cgit v1.2.3