The Notice Board example application: http://askvikrant.com/vaadin-7-sample-application/
WEB-INF/Web.xml
- context-param: productionMode = true
- servlets, UI and mappings
- resource-ref:
- res-ref-name: jdbc/nbpool
- res-type: javax.sql.DataSource
- res-auth: Container
- res-sharing-scope: Shareable
META-INF/context.xml
- username, password, driver, URL, etc.
Tomcat configuration, see http://tomcat.apache.org/tomcat-7.0-doc/config/
class
- extends UI
- implements series of self-defined event listener interfaces
members
- transient BusinessLogic instance, instantiated
- transient Blackboard event bus, obtained
- User
- Navigator
- panels, views, windows
init
- setup panels and views
- obtain blackboard instance,
- register events - link type of listeners to type of events by calling blackboard.register()
- add listeners - add self to blackboard listener
- new navigator for content panel
- initialize guest user
my comment:
DatabaseManager
- holds connection / DataSource, and a message
- on initialize - look up data source from context
- transaction management methods: begin / commit / rollback... with proper logging
- sql methods
- checkIfExists_xxx / delete / insert_xxx / select_xxx / update_xxx
- manual ORM
BusinessLogic
- initializing - connect to database
- get / saveNew / update / delete methods
- calls database manager
- manages transactions manually
- extends a layout
- layouts and widgets
- fire events (e.g. when button clicked, etc.), so the button handling is really simple
- setXXX method
Comment:
- view components (e.g. NoticePanel) knows model (Notice) - this should be ok if only for data binding
- binding not used..., setXXX method is there
Events all implements the blackboard event, which is only an indicator; some event has properties
Listeners (basically one event with one listener) all extends blackboard listener, a method is annotated @ListenerMethod, an empty method
Needs reading about the blackboard event system to understand this part
Simply model objects
These views all implements View interface, which requires implementation of enter(ViewChangeEvent) method;
enter() method simply calls load(), which obtains business logic, get the data, and adds data
initializing method sets up all the gadgets and event listeners, some logic is in there....
Comment
- still business code in view......, in buttonClick..... though minimum