Пример #1
0
  /**
   * 添加表单操作按钮,默认为保存按钮
   *
   * @param pageOption buildPageOption(editable)方法初始化好的对象
   * @param editable 是否为可编辑表单的配置,当调用create、edit方法时为true,调用open方法时为false
   */
  protected void buildPageButtons(PageOption pageOption, boolean editable) {
    boolean readonly = this.isReadonly();

    if (this.useFormPrint()) {
      // 添加打印按钮
      pageOption.addButton(this.getDefaultPrintButtonOption());
    }

    if (editable && !readonly) {
      // 添加默认的保存按钮
      pageOption.addButton(this.getDefaultSaveButtonOption());
    }
  }
Пример #2
0
  /**
   * 构建表单的对话框初始化配置
   *
   * @param editable 是否为可编辑表单的配置,当调用create、edit方法时为true,调用open方法时为false
   */
  protected PageOption buildPageOption(boolean editable) {
    PageOption pageOption = new PageOption().setMinWidth(250).setMinHeight(200).setModal(false);

    if (this.useFormPrint()) pageOption.setPrint("default.form");

    // 只有可编辑表单才按权限配置,其它情况一律配置为只读状态
    boolean readonly = this.isReadonly();
    if (editable && !readonly) {
      pageOption.put("readonly", readonly);
    } else {
      pageOption.put("readonly", true);
    }

    // 添加按钮
    buildFormPageButtons(pageOption, editable);

    return pageOption;
  }