Beispiel #1
0
  public int doEndTag() throws JspException {
    if (!beanId.equals("")) {
      textBean = (TextBean) getTagBean();
      if (textBean == null) {
        textBean = new TextBean();
        this.setBaseComponentBean(textBean);
      } else {
        // this.updateBaseComponentBean(textBean);
        this.overrideBaseComponentBean(textBean);
        textBean.setStyle(style);
        key = textBean.getValue();
      }
    } else {
      textBean = new TextBean();
      this.setBaseComponentBean(textBean);
      textBean.setStyle(style);
      textBean.setCssClass(this.cssClass);
      textBean.setCssStyle(this.cssStyle);
    }

    Locale locale = getLocale();
    textBean.setLocale(locale);

    if (key != null) {
      textBean.setValue(getLocalizedText(key));
    }

    if ((this.getBodyContent() != null) && (value == null)) {
      textBean.setValue(this.getBodyContent().getString());
    }

    Tag parent = getParent();
    if (parent instanceof DataGridColumnTag) {
      DataGridColumnTag dataGridColumnTag = (DataGridColumnTag) parent;
      dataGridColumnTag.addTagBean(this.textBean);
    } else {
      if (var == null) {
        try {
          JspWriter out = pageContext.getOut();
          out.print(textBean.toEndString());
        } catch (Exception e) {
          throw new JspException(e.getMessage());
        }
      } else {
        if (key != null) value = getLocalizedText(key);
        pageContext.setAttribute(var, value, PageContext.PAGE_SCOPE);
      }
    }
    return EVAL_PAGE;
  }
Beispiel #2
0
 protected void overrideBaseComponentBean(BaseComponentBean componentBean) {
   super.setBaseComponentBean(componentBean);
   // 1st of property defined in tag put it in bean
   // if (style != null) ((TextBean)componentBean).setStyle(style);
   // 2nd if property exists in bean then use it
   if (((TextBean) componentBean).getStyle() != null) {
     style = ((TextBean) componentBean).getStyle();
   } else {
     ((TextBean) componentBean).setStyle(style);
   }
 }
Beispiel #3
0
 protected void setBaseComponentBean(BaseComponentBean componentBean) {
   super.setBaseComponentBean(componentBean);
   if (style != null) ((TextBean) componentBean).setStyle(style);
 }
Beispiel #4
0
 protected void updateBaseComponentBean(BaseComponentBean componentBean) {
   super.setBaseComponentBean(componentBean);
   if (style != null && ((TextBean) componentBean).getStyle() == null) {
     ((TextBean) componentBean).setStyle(style);
   }
 }