API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.web.views. JOTMessageView View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */
package net.jot.web.views;

import net.jot.web.view.*;

/**
 * Implements a simple/generic user message View
 * The request should provide the attributes MESSAGE_TITLE,MESSAGE_TEXT,MESSAGE_LINK
 * 
 * The view implementation will then use link,message and title and a template to render the message to the user.
 * 
 * @author thibautc
 */
public class JOTMessageView extends JOTView
{
  public static final String MESSAGE_TITLE="JOT_MESSAGE_TITLE";
  public static final String MESSAGE_TEXT="JOT_MESSAGE_TEXT";
  // where do we go when the user click "ok".
  public static final String MESSAGE_LINK="JOT_MESSAGE_LINK";
  
  public void prepareViewData() throws Exception
  {
    String link=(String)request.getAttribute(MESSAGE_LINK);
    if(link==null) link="javascript:history.back();";
    String message=(String)request.getAttribute(MESSAGE_TEXT);
    if(message==null) message="";
    String title=(String)request.getAttribute(MESSAGE_TITLE);
    if(title==null) title="Message";
    
    addVariable("link", link);
    addVariable("message", message);
    addVariable("title", title);
  }

  public boolean validatePermissions()
  {
    // no permisiiosn required to see the message.
    return true;
  }
  
  
}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar