All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.startups.webui.Model

java.lang.Object
   |
   +----com.startups.validation.ValidatableObject
           |
           +----com.startups.webui.Model

public abstract class Model
extends com.startups.validation.ValidatableObject
The base class of all Model objects, which represent the dynamic state of a web page. Each page is represented by a Model object, a ControllerServlet, and one or more views implemented as jsp pages. Model contains some generic presentation convenience methods to be called from jsp pages.


Constructor Index

 o Model()

Method Index

 o activateValidationDisplay()
 o displayFailedValidations()
Return a list of failed form validations in red.
 o fontColorTagFor(String)
Returns a red font color tag if the given fieldName in the given model is invalid, otherwise returns a black font color tag.
 o getAccessSuccessfulURL()
Return the url to send the user to after the user successfully logs in.
 o getLoginPageMessage()
Return the message to display on the login page when it is presented to the user.
 o getLoginPageTitle()
Return the title to display on the login page when it is presented to the user.
 o getPermissionDeniedURL()
Return the url to send the user to if the user successfully logs in, but the user does not contain the role specified by getRequiredRole().
 o getRequiredRole()
Return the Class of the required UserRole needed to access this state.
 o isAccessibleTo(StartupsUser)
Return true if the page corresponding to this model is accessible to the given user.

Constructors

 o Model
 public Model()

Methods

 o isAccessibleTo
 public boolean isAccessibleTo(com.startups.business.StartupsUser user)
Return true if the page corresponding to this model is accessible to the given user. This method may be overridden by subclasses if the default behavior of checking to see if the user contains the role required by getRequiredRole() is insufficient. For example, if roles were to contain individual permissions, an overridden version of isAccessibleTo() could check for these.

 o getRequiredRole
 public java.lang.Class getRequiredRole()
Return the Class of the required UserRole needed to access this state. Return null otherwise. Subclasses should override this method to return the needed class. If there is a series of states that require access protection, the developer may find it useful to create an abstract subclass of Model to use as a base:
 public abstract class ResourceLocatorAccessModel extends Model {
     public Class getRequiredRole() {
         return ResourceLocatorRole.class;
     }
 }
 public class SomeStateModel extends ResourceLocatorAccessModel {
     ...
 }
 

See Also:
getPermissionDeniedURL
 o getAccessSuccessfulURL
 public java.lang.String getAccessSuccessfulURL()
Return the url to send the user to after the user successfully logs in. Typically this is a home or start page for the role. By default it returns null, which will be interpreted by the system to go to the page that the user originally attempted to access. Subclasses should override this method if they desire a successful login to send the user somewhere else.

See Also:
getRequiredRole
 o getPermissionDeniedURL
 public java.lang.String getPermissionDeniedURL()
Return the url to send the user to if the user successfully logs in, but the user does not contain the role specified by getRequiredRole(). By default it sends the user to a role missing error page. Subclasses should override this method if they desire to send the user somewhere else--like perhaps a signup page.

 o getLoginPageMessage
 public java.lang.String getLoginPageMessage()
Return the message to display on the login page when it is presented to the user. Subclasses should override this method if a generic login message is not sufficient.

 o getLoginPageTitle
 public java.lang.String getLoginPageTitle()
Return the title to display on the login page when it is presented to the user. Subclasses should override this method if "Startups.com Login" is not sufficient (for example, in the Job Connection section it might be overridden to return "Log in to Job Connection").

 o fontColorTagFor
 public java.lang.String fontColorTagFor(java.lang.String fieldName)
Returns a red font color tag if the given fieldName in the given model is invalid, otherwise returns a black font color tag. In order for this method to work properly, there should be a validation method with the signature public void validate() throws ValidationFailedException.

 o displayFailedValidations
 public java.lang.String displayFailedValidations()
Return a list of failed form validations in red. The display will look something like this:
 Please review the indicated fields:
    
    
    ...
 
If all validations passed, return an empty string.

 o activateValidationDisplay
 public void activateValidationDisplay()

All Packages  Class Hierarchy  This Package  Previous  Next  Index