有谁知道如何根据某个属性过滤日历事件?
例如,基于提供者ID或其他内容。我想要的是有一些复选框,并通过检查日历事件将相应显示。
答案 0 :(得分:2)
使用View Object View Criterias是最好的方法。
如果要访问提供程序,可以通过日历绑定访问它。设置Calendar Tag的bindings属性,因此它绑定到辅助bean。
private RichCalendar thecal;
//getter and setter for ca
public RichCalendar getthecal() {
return thecal;
}
public void setthecal(RichCalendar calendar) {
this.thecal = calendar;
}
然后,您可以通过getthecal()。getValue()访问日历模型数据(如提供程序)以获取CalendarModel对象。请参阅此处以获取Java参考:http://docs.oracle.com/cd/E14571_01/apirefs.1111/e10684/oracle/adf/view/rich/model/CalendarModel.html
但是,我通过View Object Attributes和View Criterias进行所有过滤。我在我的应用程序模块实现类中创建了一个方法,并从绑定到支持bean操作的按钮调用它。
按钮操作:
//get the application module
DCBindingContainer dcbindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
AppModule am = (AppModule)dcbindings.getDataControl().getApplicationModule();
//Run the filtering logic
am.nameOfYourMethod(PassSomeData,BlahBlah);
AM方法:
//get the view object your calendar uses
CalendarVOImpl voImpl = getCalendarVO();
ViewCriteria vc = voImpl.createViewCriteria();
//Just some name for the view criteria
vc.setName("filterCalendar");
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
//Set the name of the attribute and the value you're looking to filter by
vcRow.setAttribute("NameOfAttribute", "IN (" + valueFilter + ")");
vc.insertRow(vcRow);
voImpl.applyViewCriteria(vc);
voImpl.executeQuery();
确保在此方法运行后,您有一些部分触发器设置来刷新日历。
答案 1 :(得分:1)
我尝试调整adf-demo-aplication中实现的解决方案:http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx#%2Fcomponents%2Fcalendar.jspx 但我发现它太复杂了,所以我通过在Calendar组件的ViewObject中使用ViewCriteria找到了解决方案。我创建了三个绑定变量,并创建了一个ViewCriteria,它将显示那些事件与提供者相等的每个事件(“OR”相关)。然后我在我的VOImpl类中创建了一个方法,并将其绑定在我的日历页面中。单击按钮,然后在不同情况下使用所需的值执行ViewCriteria。
希望这有助于其他人