1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.tapfx.components.confirm;
17
18 import org.apache.tapestry.ApplicationRuntimeException;
19 import org.apache.tapestry.BaseComponent;
20
21 /***
22 * @author <a href="mailto:shomburg@hsofttec.com">S.Homburg</a>
23 * @version $Id: ConfirmLink.java,v 1.2 2005/11/07 20:00:19 andyhot Exp $
24 */
25 public abstract class ConfirmLink extends BaseComponent
26 {
27 public abstract String getKey();
28 public abstract String getMessage();
29
30 public String getOnClickCommand()
31 {
32 String message = getKey();
33 if (message == null)
34 message = getMessage();
35 else
36 message = getPage().getMessages().getMessage(message);
37
38 if (message == null)
39 throw new ApplicationRuntimeException("Neither 'key' nor 'message' parameters were specified!");
40 return "return confirm('" + message + "');";
41 }
42 }