东盟建设集团有限公司网站,建设一个网站大概多少钱,网络营销推广公司获客,怎么做 niche网站adf4351使用JDev 11g R2具有有趣的新功能“ UI类别”。 它使我们可以在视图对象定义级别上以声明方式对VO的属性进行分组。 例如#xff0c;我的VEmployees视图对象的“ UI Categories”选项卡如下所示#xff1a; 默认情况下#xff0c;每个视图对象都有一个预定义的类别“… adf4351使用 JDev 11g R2具有有趣的新功能“ UI类别”。 它使我们可以在视图对象定义级别上以声明方式对VO的属性进行分组。 例如我的VEmployees视图对象的“ UI Categories”选项卡如下所示 默认情况下每个视图对象都有一个预定义的类别“默认”。 我创建了三个新类别“名称”“联系人”“其他”并为其分配了属性。 在此选项卡上我们还可以为我们的类别定义标签和工具提示。 在“应用程序模块测试器”窗口中它看起来像这样 根据文档 动态表格和搜索表格应使用UI类别。 ADF Faces动态表单组件确实具有新的属性Category 。 该表格过滤VO的属性仅显示指定类别的属性。 例如如果我想显示“ 名称”类别的属性则可以使用以下构造 dynamic:form value#{bindings.VEmployeesIterator} idf3 categoryName/ 因此如果我们要分别显示不同的类别则必须对每个类别使用dynamicform标记。 但是文档提供了一个非常有趣的句子“ 对于动态表单每个类别的属性将出现在单独的选项卡中 ”。 我想我们应该自己实现此功能:)。 在这篇文章中我将展示我们如何做到这一点 在我的视图对象的实现类中我定义了一些API方法来获取视图对象的所有UI类别默认类别除外 public ListCategory getAttrCategries() {return getOrderedCategories(false, //except DefaultCategoryType.ATTRIBUTE, null); } 为了在页面上为每个UI分类绘制标签我使用了以下jspx代码 因此在这种简单的构造中我在navgationPane中使用forEach标签为每个类别绘制commandNavigationItem。 MainDynamicBean托管bean的Java代码如下所示 //Currently selected tabprivate String selectedItem;//Getting categories listpublic ListCategory getCategoryList() {return (ListCategory) resolveExpression(#{bindings.VEmployeesIterator.viewObject.attrCategries});}//Just a setterpublic void setSelectedItem(String selectedItem) {this.selectedItem selectedItem;}//Getting selected itempublic String getSelectedItem() {//If nothing is selected, then select the first oneif (selectedItem null) {ListCategory l getCategoryList();if (l.size()0) selectedItem l.get(0).getName(); } return selectedItem;}//Resolving EL expressionspublic static Object resolveExpression(String expression) {FacesContext facesContext FacesContext.getCurrentInstance();Application app facesContext.getApplication();ExpressionFactory elFactory app.getExpressionFactory();ELContext elContext facesContext.getELContext();ValueExpression valueExp elFactory.createValueExpression(elContext, expression, Object.class);return valueExp.getValue(elContext);} 最后我使用以下构造绘制具有所选类别属性的动态表单 dynamic:form value#{bindings.VEmployeesIterator} idf2binding#{MainDynamicBean.dynform}forceRefresh#{MainDynamicBean.needRefresh}/ 和适当的一段Java代码 private DynamicForm dynform;//Setterpublic void setDynform(DynamicForm dynform) {this.dynform dynform;}//Getterpublic DynamicForm getDynform() {return dynform;}public Boolean getNeedRefresh() {//If selected category is not equal to dynforms category//then set needed category and refresh the dynamic formif (dynform.getCategory()!getSelectedItem()) {this.dynform.setCategory(getSelectedItem()); return true;}else return false; } 作为我们工作的结果我们得到了以下屏幕 就这样 您可以下载此帖子的示例应用程序 。 参考来自ADF实践博客的JCG合作伙伴 Eugene Fedorenko的“ 动态使用UI类别”表单 。 翻译自: https://www.javacodegeeks.com/2012/04/adf-using-ui-categories-with-dynamic.htmladf4351使用