14 Replies Latest reply: Nov 27, 2013 9:22 AM by d5755772-3e6b-46c5-b724-2bb2beb3cc2f RSS

    How to change ADF Calendar colors from different providers?

    1006360

      Hello again, I am using JDeveloper 11.1.2.3.0,

      This might be the third question I am asking here about this and till now I got no answers.

      CAN ANYONE PLEASE PROVIDE AN EXAMPLE OR A TUTORIAL ON HOW TO CHANGE THE COLORS OF THE ADF CALENDAR COMPONENT?

      Excuse me for asking again but I am finding it very wired that nobody doesn't respond to these questions. Is there a bug or nobody really knows how to customize the calendar component?

        • 1. Re: How to change ADF Calendar colors from different providers?
          Jhon Carrillo

          Hi user,

           

          Here some steps:

           

          1) Create a Bean

          2) Create a variable with datatype HashMap, for example:

           

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

           

          3) Create a method where you load the styles you want, for example:

           

            public void loadactivityStyles() {

                 try{

                   HashSet setconf = new HashSet<String>();

                   HashSet setnoconf = new HashSet<String>();

                   HashSet setadm = new HashSet<String>();

                   setconf.add("STATUS 1");

                   setnoconf.add("STATUS 2");

                   setadm.add("STATUS 3");

                   activityStyles.put(setconf, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.GREEN));

                   activityStyles.put(setnoconf, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.ORANGE));

                   activityStyles.put(setadm, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.BLUE));

            }

           

          4) Set the variable activityStyles in the calendar component property "activityStyles=#{myBean.activityStyles}"

           

          5) Set your calendar Tag field (located in the Wizard) with the VO field that contain the values configured in the method (STATUS 1,STATUS 2,STATUS 3,etc). It allows to match with the variable activityStyles at runtime.

           

          6) Run and see the colors.

           

          Good luck.

           

          Jhon Carrillo

          • 2. Re: How to change ADF Calendar colors from different providers?
            Arunkumar Ramamoorthy-Oracle

            Hi,

             

            Can you be more specific on your question? What do you mean by changing color of the calendar component? What colors?

             

            Did you go through the skinning demo? Calendar Skinning Key Demo

             

            Also, did you go through the documentation? Especially the Activity Style Customization part? Oracle ADF Faces - &lt;af:calendar&gt;

             

            -Arun

             

            P.S :

            CAN ANYONE PLEASE PROVIDE AN EXAMPLE OR A TUTORIAL ON HOW TO CHANGE THE COLORS OF THE ADF CALENDAR COMPONENT?

            Typing with CAPS LOCK means shouting. Its bad etiquette to shout in the forum.

            • 3. Re: How to change ADF Calendar colors from different providers?
              Frank Nimphius-Oracle

              Hi,

               

              Excuse me for asking again but I am finding it very wired that nobody doesn't respond to these questions. Is there a bug or nobody really knows how to customize the calendar component?

               

              All of this may apply. However, one other option is that your question is not clear. From the question you posted my answer would be skinning:

               

              See: http://docs.oracle.com/cd/E35521_01/apirefs.111230/e17497/toc.htm#calendar

               

              And here's the skinning documentation

               

              http://docs.oracle.com/cd/E35521_01/web.111230/e16181/af_skin.htm#BAJFEFCJ

               

              The skin editor is part of the 11g R2 IDE and you can choose to create a new skin from the New Gallery

               

              Frank

              • 4. Re: How to change ADF Calendar colors from different providers?
                1006360

                Thank you for your response sir and I am sorry about "shouting" but as I said this is the third question of the same thing and you are the first that replied.

                I think my question is clear, I am asking on how to display different colors in calendar for events from different providers. I went through the documentation and I did like I explained in my other post : https://forums.oracle.com/thread/2556113  - I created a method that returns a Map<Set<String>, InstanceStyles> but nothing is changing in my calendar. That is why I asked here for whatever solution anyone would give me.

                I am sorry once more for the way I asked in the first place.

                • 5. Re: How to change ADF Calendar colors from different providers?
                  1006360

                  Thank you for your response sir but I want something like ActivityStyles as I read this should do the job, but I did not find anywhere the way how.

                  At the other side, I read the documentation for that but I think I did not understood it correctly. That is why I asked about any example or tutorial about this.

                  Thank you anyway.

                  • 6. Re: How to change ADF Calendar colors from different providers?
                    1006360

                    Thank you very much, you saved me and others like me that had this problem because as I saw these days there was a big number of developers that got problems with this.

                    • 7. Re: How to change ADF Calendar colors from different providers?
                      e035db6b-71ea-477f-9f5b-548374f7c38b

                      Hello Sir,

                       

                      First, sorry for my bad english vocabulars !

                       

                      I have try to build a calendar with multi-provider. I attempt to make a unique color for each provider. I a have write a methode for the activityStyles. A color for authorized (bliue) and non authorized (red). When i display the calendar, i see the good color. But when a user, create or update a activity, all color change in the others.

                       

                      I have attempt to use your method, but i block on the step 5.

                       

                      Have you got more information for progress ?

                       

                      One more time, sorry for my very bad english !

                       

                      Good evening all and good week end,

                       

                      Raphaël

                      • 8. Re: How to change ADF Calendar colors from different providers?
                        1006360

                        Hello, the steps that JohnCarillo explained are exactly what you need. The 5 step is the one where you select in the Tags field of your calendar (click on the little pen in the calendar property inspector) the attribute that is used for changing the colors. Done this I think you will be fine.

                        • 9. Re: How to change ADF Calendar colors from different providers?
                          e035db6b-71ea-477f-9f5b-548374f7c38b

                          Thanks for you answer,

                           

                          But (sorry i'm very noob !). I saw, in the calendar documentation, in the facultativ fields :

                           

                          Field : Tags

                          Type : Set of Strings or a semicolon separated list of Strings.

                           

                          Where i'am lost is : "How to define a collection for the type of the field named tags in my VO and/od VE ? To help you, see my method for activityStyles MAP like this :


                          If the providers in the arguemnt is the owner of the activity (blue color) else (red color).


                          public Map<Set<String>, InstanceStyles> buildMap(String provider){

                                   Map<Set<String>, InstanceStyles> map = new HashMap<Set<String>, InstanceStyles>();

                                   Set<String> providerOk = new HashSet<String>();

                                   Set<String> providerKo = new HashSet<String>();

                                   for(Row row:ADFUtils.findIterator("CalendarView2Iterator").getAllRowsInRange()){

                                    String thisProvider = row.getAttribute("Provider").toString();

                                    if(thisProvider.equalsIgnoreCase(provider)){

                                          providerOk.add(thisProvider);

                                    else{

                                          providerKo.add(thisProvider);

                                    }

                                    map.put(providerOk,CalendarActivityRamp.getActivityRamp (CalendarActivityRamp.RampKey.ORANGE));
                                    map.put(providerKo,CalendarActivityRamp.getActivityRamp (CalendarActivityRamp.RampKey.RED));
                                    return map;

                           

                          So, how to define my tags field in my VO ?

                           

                          Thanks for your reply,

                          Have a nice day and a good week,

                           

                          Raphaël

                          • 10. Re: How to change ADF Calendar colors from different providers?
                            1006360

                            You are getting it wrong, below is the right method:

                            public void loadactivityStyles() {
                                   try{
                                     HashSet setconf = new HashSet<String>();
                                     HashSet setnoconf = new HashSet<String>();
                                     setconf.add("Provider1");
                                     setnoconf.add("Provider2");
                                     activityStyles.put(setconf, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.GREEN));
                                     activityStyles.put(setnoconf, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.ORANGE));
                              }
                            

                            In this case "Provider1" and "Provider2" are the values of the attribute "Name" of your VO for example. In this case this attribute also

                            has to be selected in the Tags field of the calendar as I explained above. Make another method that will call this method and will return the HashMap, or

                            modify this.

                            • 11. Re: How to change ADF Calendar colors from different providers?
                              e035db6b-71ea-477f-9f5b-548374f7c38b

                              Thanks for the time you take to explain me,

                               

                              But, I'm no sur to understand all that you say.

                               

                              My VO have :: Name : Calendar

                              AttributeType
                              idCalendarvarchar2(20)
                              providervarchar2(40)
                              startDateoracle.jbo.domain.date
                              endDateoracle.jbo.domain.date
                              titlevarchar2(255)

                               

                              Question :

                               

                              1) The tags fields is mandatory or not for the activityStyles ? If Yes, how to define it ?

                               

                              I would be very obliged if you would send me a sample project. I'am lost and more i try more i don't understant.


                              Thanks

                              • 12. Re: How to change ADF Calendar colors from different providers?
                                1006360

                                Yes, so Provider is the attribute that you have to select in the Tags field, as I told you previously you have to select in the little Pen in the Calendar Property Inspector in the right of your JDeveloper and in the Tags field, select this attribute. Change the "Provider1" and "Provider2" to the names of your providers (you may add more than two) and select the activityStyles method in your calendar. This should help: http://www.gebs.ro/blog/oracle/oracle-adf-calendar-step-by-step-implementation/

                                • 13. Re: How to change ADF Calendar colors from different providers?
                                  e035db6b-71ea-477f-9f5b-548374f7c38b

                                  Yeah !

                                   

                                  Your last comment help me ! I have not understoond at the start off my first comment, that i must reuse the provider fields in the tags field. I think, i must creat a new field in my table, with Set<String> in type.

                                   

                                  A big thanks for you help !

                                   

                                  Have a nice day, in waiting my next question !

                                   

                                  Raphaël

                                  • 14. Re: How to change ADF Calendar colors from different providers?
                                    d5755772-3e6b-46c5-b724-2bb2beb3cc2f

                                    can u post a complete and thorough answer to this problem plz!?