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

http://struts2yuiplugin.googlecode.com/ · Java · 55 lines · 39 code · 12 blank · 4 comment · 0 complexity · 34d855bc562dd1ae274b682c3b7f2535 MD5 · raw file

  1. package com.googlecode.struts2yuiplugin.views.jsp.ui;
  2. import com.googlecode.struts2yuiplugin.components.Anchor;
  3. import com.googlecode.struts2yuiplugin.components.Div;
  4. import com.googlecode.struts2yuiplugin.components.XHRComponent;
  5. import com.opensymphony.xwork2.util.ValueStack;
  6. import org.apache.struts2.components.Component;
  7. import javax.servlet.http.HttpServletRequest;
  8. import javax.servlet.http.HttpServletResponse;
  9. /**
  10. * A div that can load its own HTML content via XHR
  11. *
  12. */
  13. public class DivTag extends AbstractYUITag implements XHRComponent {
  14. private String formId;
  15. private String href;
  16. private String method;
  17. private String callback;
  18. @Override
  19. public Component getBean(ValueStack valueStack, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
  20. return new Div(valueStack, httpServletRequest, httpServletResponse);
  21. }
  22. @Override
  23. protected void populateParams() {
  24. super.populateParams();
  25. Div div = (Div) this.component;
  26. div.setFormId(formId);
  27. div.setHref(href);
  28. div.setMethod(method);
  29. div.setCallback(callback);
  30. }
  31. public void setFormId(String formId) {
  32. this.formId = formId;
  33. }
  34. public void setHref(String href) {
  35. this.href = href;
  36. }
  37. public void setMethod(String method) {
  38. this.method = method;
  39. }
  40. public void setCallback(String callback) {
  41. this.callback = callback;
  42. }
  43. }