1

有谁知道如何根据某个属性过滤日历事件?

例如,基于提供者 ID 或其他内容。我想要的是有一些复选框,并通过选中这些复选框,日历事件将相应地显示。

4

2 回答 2

2

使用 View Object View Criterias 是最好的方法。

如果您想访问 Providers,您可以通过日历绑定访问它。设置 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);

上午方法:

//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();

确保您设置了一些部分触发器以在此方法运行后刷新您的日历。

于 2013-07-09T12:33:20.353 回答
1

我试图调整在 adf-demo-aplication 中实现的解决方案:http: //jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx#%2Fcomponents%2Fcalendar.jspx 但我发现它太复杂了,所以我通过在日历组件的 ViewObject 中使用 ViewCriteria 找到了解决方案。我创建了三个绑定变量,并创建了一个 ViewCriteria,它将显示这些事件,提供者等于它们中的每一个(“或”相关)。然后我在我的 VOImpl 类中创建了一个方法,并将它绑定到我的日历页面中。在按钮单击上,然后我在不同情况下使用所需值执行 ViewCriteria。

希望这对其他人有帮助

于 2013-07-09T10:14:08.173 回答