Xpages:动态视图面板和 DominoViewCustomizer bean

Xpages: Dynamic View Panel and DominoViewCustomizer bean

我有动态视图面板,我正在使用定制程序 bean 根据列名隐藏列。但是,我需要:

  1. 知道在定制器 bean 中加载了哪个视图
  2. 获取 bean 中的文档句柄
  3. 在 bean 中添加额外的列

为什么我需要这个:在我的应用程序中,我正在处理文档映射。我想为映射的文档详细信息创建一个列。由于可以映射不同的文档类型,因此可以有多个列。

查看您正在使用哪个视图并生成列定义(通常与视图中的定义相同,但您可以添加其他定义)的工作是通过 ViewFactory 对象完成的由定制器 bean 中的 #getViewFactory 返回。您可以查看覆盖该方法并返回自定义工厂的示例 here. You can also find the source of the default one in the ExtLib here 作为另一个示例。 ViewFactory 的工作是发出包含一系列 ColumnDefViewDef - 基本上,视图设计的抽象表示。这将涵盖 1 和 3。

处理 2 号文件的问题有点间接。由于定制器 bean 仅在视图初始化期间执行,因此它与渲染每一行的过程没有直接挂钩(这是您可以获得文档的地方)。但是,您可以将属性或内容设置为 method/value 绑定,这些绑定本身可以访问文档,以便它们按行执行。我这样做是为了让颜色列工作:我 create an SSJS binding for the style property that can then see the viewEntry object. If you modify that code, you could write some SSJS like #{javascript:var doc = viewEntry.getDocument(); ...other stuff here...}. If you do that, you should make sure to either always use "viewEntry" as the var name in the view or use panel.getVar() to find the variable name dynamically.