~~ $Id$ ~~ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ ----------- Nesting and Extending Definitions ----------- Nesting Definitions Sometimes it is useful to have a structured page with, say, a structured body. Tipically, there is a main layout (for example, the "classic" layout) and the body is made of certain number of sections. In this case, nesting a definition (the one for the body) inside another definition (the main layout) can be useful. * {Named subdefinitions} Tiles supports nesting definitions natively. One way of usng nested definitions is creating a named "subdefinition" and using it as an attribute. For example: ------------------------------------ ------------------------------------ The <<>> definition will be put inside the <<>>, by putting it inside its <<>> attribute. You will be seeing the definition one inside the other. * {Anonymous nested definitions} What you can do with named subdefinitions can be done with nested anonymous definitions. The above example can be rewritten in: ------------------------------------ ------------------------------------ The anonymous definition put under the "body" attribute can be used only by the surrounding definition. Moreover, you can nest a definition into a nested definition, with the desired level of depth. * {Cascaded attributes} Attributes defined into a definition can be cascaded to be available to all nested definitions and templates. For example the {{{#Named_subdefinitions}sample definition}} detailed above can be rewritten this way: ------------------------------------ ------------------------------------ The template of <<>> definitionhas been used as the <<>> attribute in the <<>> definition. All of the attributes of <<>> has been then moved as attributes of <<>> definition, but with the addition of the "cascade" flag. Extending Definitions You can extend definitions like a Java class. The concepts of , and are available. * <>: it is a definition in which the template attributes are not completely filled. They are useful to create a base page and a number of extending definitions, reusing already created layout. For example: ------------------------------------ ------------------------------------ * <>: a definition can inherit from another definition, to reuse an already made (abstract or not) definition: ------------------------------------ ------------------------------------ In this case, the <<
>>, <<>> and <<