Posts Tagged ‘Calendar Component’

This post is about some tricks to the  <af:calendar> component. For a detailed guide and tutorial to <af:calendar> you may follow these links:

Working with ADF Faces Calendar Component – An Oracle JDeveloper How To Document 

ADF Calendar Summary – oracle.adf.view.rich.component.rich.data.RichCalendar

To change the colors of the events in <af:calendar> we should override the activityStyles. In your managed bean create a HashMap variable and override its get() method as shown below:

private HashMap activityStyles = new HashMap<Set<String>, InstanceStyles>();

public HashMap getActivityStyles() {
try {
HashSet event1 = new HashSet<String>();
HashSet event2= new HashSet<String>();
HashSet event3= new HashSet<String>();

event1.add(“Milestone”);
event2.add(“Obligation”);
event3.add(“Task”);

activityStyles.put(event1, CalendarActivityRamp.getActivityRamp( CalendarActivityRamp.RampKey.PLUM ));
activityStyles.put(event2, CalendarActivityRamp.getActivityRamp( CalendarActivityRamp.RampKey.ORANGE ));
activityStyles.put(event3, CalendarActivityRamp.getActivityRamp( CalendarActivityRamp.RampKey.MIDNIGHTBLUE ));

} catch (Exception e) {
e.printStackTrace();
}
return activityStyles;
}

In calendar property:

activityStyles

 

In calendar activity attributes you have to select in Tags the property of your view object, based on which the colors are meant to change.

tags

 

The other calendar activities in the above photo are not relevant, you may have other names for your attributes.