Pow2WebGui provides abstract and concrete classes that define a hierarchy of "html widgets". It is possible to add new visual components creating further implementations or extending the existing ones.
PWG provides the following abstract classes:
The Widget class defines the default attributes and the behaviour of the component. Subclasses of a new widget could add other attributes or define a custom behaviour.
The Drawer class defines the draw()
abstract method.
Every subclass must provide the implementation of that method for the visual rendering of the component.
The BaseContentProvider class defines the getContent()
abstract method.
Every widget that uses a custom contentProvider class to generate and manage the business data,
must provide the implementation of that method.
Pow2WebGui let the user to specify additional components registering the related Widget, Drawer and ContentProvider classes in a preferences file:
# widgets (concrete widget classes) # # format is: # widget.${widgetName} = ${widgetClass} # widget.window = com.pow2.webgui.window.Window widget.tabbedSelector = com.pow2.webgui.tabbedselector.TabbedSelector widget.tab = com.pow2.webgui.tabbedselector.Tab widget.lister = com.pow2.webgui.lister.Lister # widgets drawers (concrete drawing stategies) # # format is: # drawer.${widgetName}.${drawerName} = ${drawerClass} # drawer.window.backoffice = com.pow2.webgui.window.BOWindowDrawer drawer.window.pow2 = com.pow2.webgui.window.Pow2WindowDrawer drawer.tabbedSelector.backoffice = com.pow2.webgui.tabbedselector.BOTabbedDrawer drawer.tab.backoffice = com.pow2.webgui.tabbedselector.BOTabDrawer drawer.tabbedSelector.amazon = com.pow2.webgui.tabbedselector.AmazonTabbedDrawer drawer.tab.amazon = com.pow2.webgui.tabbedselector.AmazonTabDrawer drawer.lister.amazon = com.pow2.webgui.lister.AmazonListerDrawer # widgets content providers # # format is: # contentprovider.${widgetName}.${contentProviderName} = ${contentProviderClass} # contentprovider.lister.default = com.pow2.webgui.contentprovider.ContentProvider
Pow2WebGui uses Jakarta Velocity template engine to decouple the HTML presentation of the component from its business classes.
PGW provides a JSP tag library to define and render the visual components. For example, it is possible to render a tabbedPanel component using this code:
<gui:tabbedSelector name = "ts1" drawer = "backoffice" followUp = "tab2.jsp" selectedTab = "<%=selectedTab %>" color = "#f0f0f0"> <gui:tab drawer="backoffice" name="tab1" title="click me"> Hello !! This is tab1. </gui:tab> <gui:tab drawer="backoffice" name="tab2" title="or me" followUp="<%=anotherFollowUp %>"> ...and this is tab2. </gui:tab> <gui:tab drawer="backoffice" name="tab3" title="and me?"> while this is tab3.. </gui:tab> </gui:tabbedSelector>