FacesUtil.getComponentFor 对比 ExtLibUtil.getComponentFor
FacesUtil.getComponentFor vs. ExtLibUtil.getComponentFor
我想隐藏一个 Extension Library Dialog in my application using Java. Therefore I need to get a handle on this UIComponent (com.ibm.xsp.extlib.component.dialog.UIDialog)
经过一番调查,我发现了两种实现方式:
com.ibm.xsp.util.FacesUtil.getComponentFor(start, id)
com.ibm.xsp.extlib.util.ExtLibUtil.getComponentFor(start, id)
IBM 的 API 是否存在差异或不必要的冗余?
提前致谢。
ExtLibUtil 只是一个包装器,参见 https://github.com/OpenNTF/XPagesExtensionLibrary/blob/master/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/src/com/ibm/xsp/extlib/util/ExtLibUtil.java#L845
但是,每次都查询组件树。更好的方法是使用组件上的 binding
属性 将其绑定到 Java class 中的 属性。您只需要记住将 属性 设置为 transient
,因为组件不可序列化。请参阅 Tim Tripcony 的 NotesIn9 http://www.notesin9.com/2014/05/22/notesin9-143-component-vs-value-binding-in-xpages/
我想隐藏一个 Extension Library Dialog in my application using Java. Therefore I need to get a handle on this UIComponent (com.ibm.xsp.extlib.component.dialog.UIDialog)
经过一番调查,我发现了两种实现方式:
com.ibm.xsp.util.FacesUtil.getComponentFor(start, id)
com.ibm.xsp.extlib.util.ExtLibUtil.getComponentFor(start, id)
IBM 的 API 是否存在差异或不必要的冗余?
提前致谢。
ExtLibUtil 只是一个包装器,参见 https://github.com/OpenNTF/XPagesExtensionLibrary/blob/master/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/src/com/ibm/xsp/extlib/util/ExtLibUtil.java#L845
但是,每次都查询组件树。更好的方法是使用组件上的 binding
属性 将其绑定到 Java class 中的 属性。您只需要记住将 属性 设置为 transient
,因为组件不可序列化。请参阅 Tim Tripcony 的 NotesIn9 http://www.notesin9.com/2014/05/22/notesin9-143-component-vs-value-binding-in-xpages/