JBoss.orgCommunity Documentation
The page flow of the application is illustrated in the diagram.
This section covers how the particular elements that govern page flow are implemented in the application.
Registering in is basically the first step a user takes in the application if he/she wants to have access to all features of the application. Have a look at a piece of code from \includes\index\index.xhtml
:
...
<h:panelGroup rendered="#{!identity.loggedIn}" styleClass="top-right-bottom-menu-item-link" layout="block">
<h:form style="margin: 0px">
<a4j:commandLink value="#{messages['login.register']}"actionListener="#{authenticator.goToRegister}" reRender="mainArea" />
</h:form>
</h:panelGroup>
...
When the button is hit the goToRegister
method of the Authenticator
class is invoked and the START_REGISTER_EVENT
is raised. These action display the registration form that is included from \includes\register.xhtml
.
The <a4j:commandLink> displays the link to the registration form and invokes the goToRegister
method.
When all fields are filled out with correct values the authenticator.register(user)
is triggered and a new user object is declared.
Technically, user does not browse between pages of the application: every content page is included into the content area of index.xhtml
file after a certain action performed by user.
...
<h:panelGroup styleClass="content_box" layout="block">
<ui:include src="#{model.mainArea.template}" />
</h:panelGroup>
...
The NavigationEnum
enumeration encapsulated all possible states, that can be applied to content area ("mainArea") on the page.
...
public enum NavigationEnum {
ANONYM("includes/publicShelves.xhtml"),
FILE_UPLOAD("includes/fileUpload.xhtml"),
USER_PREFS("includes/userPrefs.xhtml"),
REGISTER("includes/register.xhtml"),
SEARCH("includes/search.xhtml"),
ALBUM_PREVIEW("includes/album.xhtml"),
ALBUM_IMAGE_PREVIEW("/includes/image.xhtml"),
SHELF_PREVIEW("/includes/shelf.xhtml"),
ALL_SHELFS("/includes/userShelves.xhtml"),
TAGS("includes/tag.xhtml"),
ALL_ALBUMS("/includes/userAlbums.xhtml"),
ALL_IMAGES("/includes/userImages.xhtml"),
ALBUM_IMAGE_EDIT("/includes/imageEdit.xhtml"),
ALBUM_EDIT("/includes/albumEdit.xhtml"),
SHELF_EDIT("/includes/shelfEdit.xhtml"),
SHELF_UNVISITED("/includes/shelfUnvisited.xhtml"),
USER_SHARED_ALBUMS("/includes/userSharedAlbums.xhtml"),
USER_SHARED_IMAGES("/includes/userSharedImages.xhtml"),
ALBUM_UNVISITED("/includes/albumUnvisited.xhtml");
...
}
This class specifies which file is included depending on some user action.
The template to be loaded is identified according to some condition in the Controller
(Controllor.java
) class and is saved to the Model (Model.java
). During index.xhtml
page rendering the value is taken from the Model to define what should be rendered to the page.