Decoration

Decoration

Sitemesh is well used in the pure Java world for webapps. It decorates pages on the server side so that a browser may see a set of pages with the same header, left and/or right nav bars and footers. Sitemesh's own site says it all in a single picture.

In a similar way (to be coded) we will allow Swiby pages to be decorated. For example this ...

require 'swiby'

	
title "Hello Demo"
	
content {
    Label {
        text "hello"    
    } 
}

visible true

gets transformed into ...

require 'swiby'

	
title "Button Demo"
	
content {
    BorderPanel {
        north {
            Label {
                text "standard header"    
            }
        }
        center {
            Label {
                text "hello"    
            }
        }
        south {
            Label {
                text "standard footer"    
            }
        }
    } 
}

visible true

with this decorator page template ...

require 'swiby'

	
title = ${title}
	
content {
    BorderPanel {
        north {
            Label {
                text "standard header"    
            }
        }
        center {
            ${content}
        }
        south {
            Label {
                text "standard footer"    
            }
        }
    } 
}
${footer}