/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

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