Package org.beangle.struts2.helper

Examples of org.beangle.struts2.helper.DownloadHelper


    }
    return model;
  }

  public TagModel getUserinfo() {
    TagModel model = models.get(Userinfo.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new Userinfo(stack, authorityManager);
        }
      };
      models.put(Userinfo.class, model);
View Full Code Here


    library.authorityManager = authorityManager;
    return library;
  }

  public TagModel getGuard() {
    TagModel model = models.get(Guard.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new Guard(stack, authorityManager);
        }
      };
      models.put(Guard.class, model);
View Full Code Here

    }
    return model;
  }

  public TagModel getAvatar() {
    TagModel model = models.get(AvatarImage.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new AvatarImage(stack, authorityManager);
        }
      };
      models.put(AvatarImage.class, model);
View Full Code Here

    }
    return model;
  }
 
  public TagModel getUserinfo() {
    TagModel model = models.get(Userinfo.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new Userinfo(stack, authorityManager);
        }
      };
      models.put(Userinfo.class, model);
View Full Code Here

  public TagModel getA() {
    TagModel model = models.get(Anchor.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new Anchor(stack);
        }
      };
      models.put(Anchor.class, model);
    }
    return model;
View Full Code Here

  public TagModel getA() {
    TagModel model = models.get(Anchor.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new Anchor(stack);
        }
      };
      models.put(Anchor.class, model);
    }
    return model;
View Full Code Here

    }
  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public Writer getWriter(Writer writer, Map params) throws TemplateModelException, IOException {
    Component bean = getBean();
    // Container container = (Container)
    // stack.getContext().get(ActionContext.CONTAINER);
    // container.inject(bean);
    BeansWrapper objectWrapper = BeansWrapper.getDefaultInstance();

    for (Iterator iterator = params.entrySet().iterator(); iterator.hasNext();) {
      Map.Entry<String, Object> entry = (Map.Entry<String, Object>) iterator.next();
      String key = entry.getKey();
      Object value = entry.getValue();
      if (value != null) {
        Method m = ComponentHelper.getWriteMethod(bean, key);
        if (null != m) {
          if (value instanceof TemplateModel) {
            try {
              value = objectWrapper.unwrap((TemplateModel) value);
            } catch (TemplateModelException e) {
              logger.error("failed to unwrap [" + value + "] it will be ignored", e);
            }
          }
          try {
            m.invoke(bean, value);
          } catch (Exception e) {
            e.printStackTrace();
          }
        } else {
          bean.getParameters().put(key, value);
        }
      }
    }
    return new ResetCallbackWriter(bean, writer);
  }
View Full Code Here

public class BeangleTagLibrary implements TagLibrary {

  public Object getFreemarkerModels(ValueStack stack, HttpServletRequest req,
      HttpServletResponse res) {
    return new BeangleModels(stack, req, res);
  }
View Full Code Here

  public TextModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    super(stack, req, res);
  }

  protected Component getBean() {
    return new Text(stack);
  }
View Full Code Here

  protected void buildCfg() {
    cfg = new freemarker.template.Configuration();
    cfg.setTemplateLoader(new StrutsClassTemplateLoader());
    cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
    cfg.setObjectWrapper(new BeangleObjectWrapper(true));
    cfg.setDefaultEncoding("utf-8");
  }
View Full Code Here

TOP

Related Classes of org.beangle.struts2.helper.DownloadHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.