PageRenderTime 54ms CodeModel.GetById 44ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/src/main/java/com/googlecode/struts2yuiplugin/views/jsp/ui/AnchorTag.java

http://struts2yuiplugin.googlecode.com/
Java | 65 lines | 48 code | 13 blank | 4 comment | 0 complexity | 0a3a9fca0ba927276a930e64daadf070 MD5 | raw file
 1package com.googlecode.struts2yuiplugin.views.jsp.ui;
 2
 3import com.googlecode.struts2yuiplugin.components.Anchor;
 4import com.googlecode.struts2yuiplugin.components.XHRComponent;
 5import com.opensymphony.xwork2.util.ValueStack;
 6import org.apache.struts2.components.Component;
 7
 8import javax.servlet.http.HttpServletRequest;
 9import javax.servlet.http.HttpServletResponse;
10
11/**
12 * A simple anchor with a default click event handler that makes an asynchronous request
13 *
14 */
15public class AnchorTag extends AbstractYUITag implements XHRComponent {
16
17    private String formId;
18    private String href;
19    private String method;
20    private String target;
21    private String callback;
22    private String clickListener;
23
24    @Override
25    public Component getBean(ValueStack valueStack, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
26        return new Anchor(valueStack, httpServletRequest, httpServletResponse);
27    }
28
29    @Override
30    protected void populateParams() {
31        super.populateParams();
32
33        Anchor anchor = (Anchor) this.component;
34        anchor.setFormId(formId);
35        anchor.setHref(href);
36        anchor.setMethod(method);
37        anchor.setTarget(target);
38        anchor.setCallback(callback);
39        anchor.setClickListener(clickListener);
40    }
41
42    public void setFormId(String formId) {
43        this.formId = formId;
44    }
45
46    public void setHref(String href) {
47        this.href = href;
48    }
49
50    public void setMethod(String method) {
51        this.method = method;
52    }
53
54    public void setTarget(String target) {
55        this.target = target;
56    }
57
58    public void setCallback(String callback) {
59        this.callback = callback;
60    }
61
62    public void setClickListener(String clickListener) {
63        this.clickListener = clickListener;
64    }
65}