@Override
  public void bind(final Component component) {
    super.bind(component);

    component.setOutputMarkupId(true);
    component.add(AttributeModifier.replace("rel", createRelAttribute()));
    component.add(AttributeModifier.replace("title", label));
  }
  protected void rptList_PopulateItem(Item<Map<String, Object>> item) {
    Map<String, Object> dataRow = item.getModelObject();
    // ID
    FWLabel index = new FWLabel("index");
    index.setRenderBodyOnly(true);
    index.setValue(ConvUtils.convToString(rptList.getFirstItemOffset() + item.getIndex() + 1));
    item.add(index);
    // 用户名称
    FWModalPopupLink userName = new FWModalPopupLink("userName");
    userName.setLabel(ConvUtils.convToString(dataRow.get("USER_NAME")));
    userName.add(
        AttributeModifier.replace(
            "onclick",
            "layer_show('360','','"
                + ConvUtils.convToString(dataRow.get("USER_NAME"))
                + "','"
                + fwContext.getContextRoot()
                + TransitionUrlConst.USER_DETAIL_PAGE
                + "?USER_ID="
                + ConvUtils.convToString(dataRow.get("OID_USER_ID"))
                + "')"));
    item.add(userName);
    // 手机
    FWLabel mobile = new FWLabel("mobile");
    mobile.setRenderBodyOnly(true);
    mobile.setValue(ConvUtils.convToString(dataRow.get("MOBILE")));
    item.add(mobile);
    // 邮箱
    FWLabel email = new FWLabel("email");
    email.setRenderBodyOnly(true);
    if (!StringUtils.isEmpty(ConvUtils.convToString(dataRow.get("EMAIL")))) {
      email.setValue(
          ConvUtils.convToString(dataRow.get("EMAIL"))
              + " "
              + (ConvUtils.convToBool(dataRow.get("EMAIL_VERIFY_FLG")) ? "已验证" : "未验证"));
    } else {
      email.setValue("未填写");
    }
    item.add(email);

    FWContainer selectBtn = new FWContainer("selectBtn");
    selectBtn.add(
        AttributeModifier.replace(
            "onclick",
            "selectUserAccount('"
                + ConvUtils.convToString(dataRow.get("USER_NAME"))
                + "', '"
                + ConvUtils.convToString(dataRow.get("OID_USER_ID"))
                + "', '"
                + ConvUtils.convToString(dataRow.get("BORROWER_NAME"))
                + "', '"
                + ConvUtils.convToString(dataRow.get("BORROWER_ID_CARD"))
                + "')"));
    item.add(selectBtn);
  }
  /**
   * 填充明细控件。
   *
   * @param 明细结构体
   * @return 没有
   */
  protected void rptList_PopulateItem(Item<Map<String, Object>> item) {
    Map<String, Object> dataRow = item.getModelObject();

    // ID
    FWLabel index = new FWLabel("index");
    index.setRenderBodyOnly(true);
    index.setValue(ConvUtils.convToString(rptList.getFirstItemOffset() + item.getIndex() + 1));
    item.add(index);

    // 投资人
    FWLabel tender = new FWLabel("tender");
    tender.setRenderBodyOnly(true);
    item.add(tender);
    String mobile = ConvUtils.convToString(dataRow.get("MOBILE"));
    String email = ConvUtils.convToString(dataRow.get("EMAIL"));
    String connectChar = "/";
    if (StringUtils.isEmpty(mobile) || StringUtils.isEmpty(email)) {
      connectChar = "";
    }
    tender.setValue(mobile + connectChar + email);

    // 产品标题
    FWModalPopupLink titleLink = new FWModalPopupLink("title");
    titleLink.setLabel(ConvUtils.convToString(dataRow.get("FINANCE_PROD_TITLE")));

    titleLink.add(
        AttributeModifier.replace(
            "onclick",
            "layer_show('450','','宝宝产品明细','"
                + fwContext.getContextRoot()
                + TransitionUrlConst.PROD_FINANCE_OPERATION_PAGE
                + "?"
                + PageParamConstant.VIEW_DETAIL
                + "=0&"
                + PageParamConstant.OBJECT_ID
                + "="
                + dataRow.get("OID_FINANCE_PROD_ID")
                + "')"));
    item.add(titleLink);

    // 理财金额
    FWLabel financeProdAmount = new FWLabel("financeProdAmount");
    financeProdAmount.setRenderBodyOnly(true);
    financeProdAmount.setValue(ConvUtils.convToMoney(dataRow.get("FINANCE_PROD_AMOUNT")));
    item.add(financeProdAmount);

    // 理财天数
    FWLabel financeProdaDays = new FWLabel("financeProdaDays");
    financeProdaDays.setRenderBodyOnly(true);
    financeProdaDays.setValue(ConvUtils.convToString(dataRow.get("FINANCE_PROD_DAYS")));
    item.add(financeProdaDays);

    // 收益总额
    FWLabel operationAmount = new FWLabel("operationAmount");
    operationAmount.setRenderBodyOnly(true);
    operationAmount.setValue(ConvUtils.convToMoney(dataRow.get("OPERATION_AMOUNT")));
    item.add(operationAmount);
  }
  @Override
  public void bind(Component component) {
    super.bind(component);

    component.add(AttributeModifier.replace("data-tooltip", true));

    this.selector = JQueryWidget.getSelector(component);
    this.setOption("items", Options.asString("[data-tooltip]"));
    this.setOption(
        "content",
        String.format("function() { return \"%s\"; }", this.render(this.newContent(CONTENT_ID))));
  }
 /**
  * Adds a SimpleAttributeModifier("title", ...) to the given component. Does not modify the given
  * tool tip text!
  *
  * @param component
  * @param title
  * @param text If the string contains "\n" characters then html=true and &lt;br/&gt; are used.
  * @param rightAlignment If false (default is true) the tooltip will be aligned at the bottom.
  */
 public static Component addTooltip(
     final Component component,
     final IModel<String> title,
     final IModel<String> text,
     final boolean rightAlignment) {
   @SuppressWarnings("serial")
   final IModel<String> myModel =
       new Model<String>() {
         /** @see org.apache.wicket.model.Model#getObject() */
         @Override
         public String getObject() {
           if (text != null && text.getObject() != null && text.getObject().indexOf("\n") > 0) {
             final String newText = HtmlHelper.escapeHtml(text.getObject(), true);
             return newText;
           }
           return text.getObject();
         }
       };
   component.add(AttributeModifier.replace("data-html", true));
   if (title != null && title.getObject() != null) {
     component.add(AttributeModifier.replace("rel", rightAlignment ? "mypopup-right" : "mypopup"));
     component.add(AttributeModifier.replace("data-original-title", title));
     component.add(AttributeModifier.replace("data-content", myModel));
   } else {
     component.add(
         AttributeModifier.replace("rel", rightAlignment ? "mytooltip-right" : "mytooltip"));
     component.add(AttributeModifier.replace("title", myModel));
   }
   return component;
 }
 /**
  * Add JavaScript function showDeleteEntryQuestionDialog(). Depending on BaseDao.isHistorizable()
  * a delete or mark-as-deleted question will be displayed. Usage in markup: &lt;script
  * wicket:id="showDeleteEntryQuestionDialog"&gt;[...]&lt;/script&gt;
  *
  * @param parent
  * @param dao
  */
 public static void addShowDeleteRowQuestionDialog(
     final MarkupContainer parent, final BaseDao<?> dao) {
   final StringBuffer buf = new StringBuffer();
   buf.append("function showDeleteEntryQuestionDialog() {\n").append("  return window.confirm('");
   if (dao.isHistorizable() == true) {
     buf.append(parent.getString("question.markAsDeletedQuestion"));
   } else {
     buf.append(parent.getString("question.deleteQuestion"));
   }
   buf.append("');\n}\n");
   parent.add(
       new Label("showDeleteEntryQuestionDialog", buf.toString())
           .setEscapeModelStrings(false)
           .add(AttributeModifier.replace("type", "text/javascript")));
 }
 /**
  * Sets attribute size (only for TextFields) and style="length: width"; The width value is size +
  * 0.5 em and for drop down choices size + 2em;
  *
  * @param component
  * @param size
  * @param important If true then "!important" is appended to the width style (true is default).
  * @return This for chaining.
  */
 public static FormComponent<?> setSize(
     final FormComponent<?> component, final int size, final boolean important) {
   if (component instanceof TextField) {
     component.add(AttributeModifier.replace("size", String.valueOf(size)));
   }
   final StringBuffer buf = new StringBuffer(20);
   buf.append("width: ");
   if (component instanceof DropDownChoice) {
     buf.append(size + 2).append("em");
   } else {
     buf.append(size).append(".5em");
   }
   if (important == true) {
     buf.append(" !important;");
   }
   buf.append(";");
   component.add(AttributeModifier.append("style", buf.toString()));
   return component;
 }
 @SuppressWarnings("serial")
 public void redraw() {
   clearContent();
   {
     gridBuilder.newSecurityAdviceBox(Model.of(getString("calendar.icsExport.securityAdvice")));
     addFormFields();
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("calendar.abonnement.url")).setLabelSide(false);
     urlTextArea =
         new TextArea<String>(
             fs.getTextAreaId(),
             new Model<String>() {
               @Override
               public String getObject() {
                 return WicketUtils.getAbsoluteContextPath() + getUrl();
               };
             });
     urlTextArea.setOutputMarkupId(true);
     fs.add(urlTextArea);
     urlTextArea.add(AttributeModifier.replace("onClick", "$(this).select();"));
   }
 }
 protected void rptList_PopulateItem(Item<Map<String, Object>> item) {
   Map<String, Object> dataRow = item.getModelObject();
   // ID
   FWLabel index = new FWLabel("index");
   index.setRenderBodyOnly(true);
   index.setValue(ConvUtils.convToString(rptList.getFirstItemOffset() + item.getIndex() + 1));
   item.add(index);
   // 产品标题
   FWLabel productTitle = new FWLabel("productTitle");
   productTitle.setRenderBodyOnly(true);
   productTitle.setDefaultModelObject(ConvUtils.convToString(dataRow.get("PRODUCTS_TITLE")));
   item.add(productTitle);
   // 应回款日期
   FWLabel date = new FWLabel("date");
   date.setRenderBodyOnly(true);
   date.setDefaultModelObject(ConvUtils.convToString(dataRow.get("RECOVER_DATE")));
   item.add(date);
   // 应回款本金
   FWLabel amountCapital = new FWLabel("amountCapital");
   amountCapital.setRenderBodyOnly(true);
   amountCapital.setDefaultModelObject(
       ConvUtils.convToDecimal(dataRow.get("RECOVER_AMOUNT_CAPITAL")));
   item.add(amountCapital);
   // 应回款利息
   FWLabel amountInterest = new FWLabel("amountInterest");
   amountInterest.setRenderBodyOnly(true);
   amountInterest.setDefaultModelObject(
       ConvUtils.convToDecimal(dataRow.get("RECOVER_AMOUNT_INTEREST")));
   item.add(amountInterest);
   // 应回款总额
   FWLabel amountTotal = new FWLabel("amountTotal");
   amountTotal.setRenderBodyOnly(true);
   amountTotal.setDefaultModelObject(ConvUtils.convToDecimal(dataRow.get("RECOVER_AMOUNT_TOTAL")));
   item.add(amountTotal);
   // 实际回款日期
   FWLabel dateYes = new FWLabel("dateYes");
   dateYes.setRenderBodyOnly(true);
   dateYes.setDefaultModelObject(ConvUtils.convToString(dataRow.get("RECOVER_DATE_YES")));
   item.add(dateYes);
   // 实际回款本金
   FWLabel amountCapitalYes = new FWLabel("amountCapitalYes");
   amountCapitalYes.setRenderBodyOnly(true);
   amountCapitalYes.setDefaultModelObject(
       ConvUtils.convToDecimal(dataRow.get("RECOVER_AMOUNT_CAPITAL_YES")));
   item.add(amountCapitalYes);
   // 实际回款利息
   FWLabel amountInterestYes = new FWLabel("amountInterestYes");
   amountInterestYes.setRenderBodyOnly(true);
   amountInterestYes.setDefaultModelObject(
       ConvUtils.convToDecimal(dataRow.get("RECOVER_AMOUNT_INTEREST_YES")));
   item.add(amountInterestYes);
   // 实际回款总额
   FWLabel amountTotalYes = new FWLabel("amountTotalYes");
   amountTotalYes.setRenderBodyOnly(true);
   amountTotalYes.setDefaultModelObject(
       ConvUtils.convToDecimal(dataRow.get("RECOVER_AMOUNT_TOTAL_YES")));
   item.add(amountTotalYes);
   // 回款状态
   FWLabel status = new FWLabel("status");
   status.setDefaultModelObject(
       RecoverFlgEnum.getEnumDisp(ConvUtils.convToString(dataRow.get("RECOVER_FLG"))).getValue());
   item.add(status);
   // 回款状态样式控制
   if (RecoverFlgEnum.RECOVER_STATUS_NO
       .getValue()
       .equals(ConvUtils.convToString(dataRow.get("RECOVER_FLG")))) {
     status.add(AttributeModifier.replace("class", "label label-default"));
   } else if (RecoverFlgEnum.RECOVER_STATUS_YES
       .getValue()
       .equals(ConvUtils.convToString(dataRow.get("RECOVER_FLG")))) {
     status.add(AttributeModifier.replace("class", "label label-success"));
   }
 }
 protected void setNoBackButton() {
   headerContainer.add(AttributeModifier.replace("data-nobackbtn", "true"));
 }
Пример #11
0
 /**
  * Sets readonly="readonly" and "readOnly" as class.
  *
  * @param component
  * @return This for chaining.
  */
 public static FormComponent<?> setReadonly(final FormComponent<?> component) {
   component.add(AttributeModifier.append("class", "readonly"));
   component.add(AttributeModifier.replace("readonly", "readonly"));
   return component;
 }
Пример #12
0
 /**
  * Sets the html attribute placeholder.
  *
  * @param component
  * @param value
  */
 public static void setPlaceHolderAttribute(Component component, final String value) {
   if (component instanceof ComponentWrapperPanel) {
     component = ((ComponentWrapperPanel) component).getFormComponent();
   }
   component.add(AttributeModifier.replace("placeholder", value));
 }
Пример #13
0
 /**
  * Adds onclick attribute with "javascript:rowClick(this);".
  *
  * @param row Html tr element.
  */
 public static void addRowClick(final Component row) {
   row.add(AttributeModifier.replace("onclick", "javascript:rowClick(this);"));
   // add marker css class for contextMenu javaScript
   row.add(new AttributeAppender("class", Model.of("withContextMenu"), " "));
 }
Пример #14
0
 public static AttributeModifier javaScriptConfirmDialogOnClick(final String message) {
   final String escapedText = message.replace("'", "\'");
   return AttributeModifier.replace(
       "onclick", "javascript:return showConfirmDialog('" + escapedText + "');");
 }