Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Event.setColor is not working

    CalendarEvent: ev1.setBackgroundColor("red"); is not working. Same for ev1.setTextColor("red");
    Since I am setting these colors from the DB, would it be possible to set the margin color in a similar way? I know you can set: setStyleName() , but it would be nice to have an API for setting the margin-color, similarly as the text-color and the background-color. Using smartgwt 6.0p power 13.08.16

    Code:
    public void onModuleLoad() {
    
            VLayout vlayout = new VLayout();
            final Timeline calendar = new Timeline();
            calendar.setHeight(451);
            calendar.setStartDate(new Date(112, 5, 2));
            calendar.setEndDate(new Date(112, 5, 22));
            calendar.setCanEditLane(true);
            calendar.setShowEventDescriptions(false);
    
            HeaderLevel[] headerLevels = new HeaderLevel[] { new HeaderLevel(TimeUnit.WEEK),
                    new HeaderLevel(TimeUnit.DAY) };
            calendar.setHeaderLevels(headerLevels);
            calendar.setLaneFields(new ListGridField[] { new ListGridField("title", "Developer", 120) });
            calendar.setLanes(TimelineLaneData.getRecords());
            calendar.setData(TimelineData.getRecords());
            calendar.setCanEditLane(false);
    
            vlayout.addMember(calendar);
    
            vlayout.setWidth100();
            vlayout.setHeight100();
            vlayout.draw();
        }
    Code:
    package de.mks_infofabrik.kids.client.test;
    
    import java.util.Date;
    
    import com.smartgwt.client.widgets.calendar.CalendarEvent;
    
    public class TimelineData {  
          
        private static CalendarEvent[] records;  
        private static Date today = new Date(112, 5, 2);  
        private static int year = today.getYear();  
        private static int month = today.getMonth();  
        private static int start = today.getDate();  
     
        public TimelineData() {  
        }  
        public static CalendarEvent[] getRecords() {  
            if (records == null) {  
                records = getNewRecords();  
            }  
            return records;  
        }  
     
        public static CalendarEvent[] getNewRecords() {  
            CalendarEvent ev1 = new CalendarEvent(1, "Add new Timeline view", "Add a new calendar Timeline component", new Date(year, month, start + 2), new Date(year, month, start + 8, 23, 59, 59), "darcyFeeney");
            ev1.setBackgroundColor("red");
            return new CalendarEvent[]{  
                    ev1,
                    new CalendarEvent(2, "ListGrid field autoSize", "Complex field-autosizing in ListGrid", new Date(year, month, start), new Date(year, month, start, 23, 59, 59), "kaiKong"),  
                    new CalendarEvent(3, "PDF Import/Export", "Implement native PDF import/export", new Date(year, month, start + 1), new Date(year, month, start + 5, 23, 59, 59), "garretMonroe"),  
                    new CalendarEvent(4, "Calculated Fields", "Formula and Summary fields for ListGrid", new Date(year, month, start), new Date(year, month, start + 4, 23, 59, 59), "charlesMadigen"),  
                    new CalendarEvent(5, "ListGrid cell-level selection", "Implement spreadsheet-like selection in ListGrid", new Date(year, month, start + 7), new Date(year, month, start + 14, 23, 59, 59), "charlesMadigen"),  
                    new CalendarEvent(6, "Text import", "Server text-import", new Date(year, month, start + 16), new Date(year, month, start + 20, 23, 59, 59), "charlesMadigen"),  
                    new CalendarEvent(7, "TabIndex enhancements", "Enhance formItem tabindex handling", new Date(year, month, start + 9), new Date(year, month, start + 11, 23, 59, 59), "kaiKong"),  
                    new CalendarEvent(8, "Visual Builder skin", "Skinning changes", new Date(year, month, start), new Date(year, month, start + 3, 23, 59, 59), "shelleyFewel"),  
                      
                    new CalendarEvent(9, "DataSource Transaction-handling", "New transaction features", new Date(year, month, start), new Date(year, month, start + 2, 23, 59, 59), "tamaraKane"),  
                    new CalendarEvent(10, "New Samples", "Add 20 samples for the following new features: ...", new Date(year, month, start + 4), new Date(year, month, start + 20, 23, 59, 59), "tamaraKane"),  
                    new CalendarEvent(11, "Localization", "Extend i18n support", new Date(year, month, start + 9), new Date(year, month, start + 14, 23, 59, 59), "darcyFeeney"),  
                    new CalendarEvent(12, "New Language Packs", "Add these 4 new language packs: ...", new Date(year, month, start + 16), new Date(year, month, start + 18, 23, 59, 59), "darcyFeeney"),  
                      
                    new CalendarEvent(13, "ComponentXML", "Add the following features and update documentation: ...", new Date(year, month, start + 5), new Date(year, month, start + 11, 23, 59, 59), "shelleyFewel"),  
                    new CalendarEvent(14, "TileGrid", "Change styling on builtin tiles as follows: ...", new Date(year, month, start + 14), new Date(year, month, start + 19, 23, 59, 59), "shelleyFewel"),  
                    new CalendarEvent(15, "Dev Meeting", "Weekly dev meeting", new Date(year, month, start + 1), new Date(year, month, start + 1, 23, 59, 59), false, "testStyle", "charlesMadigen"),  
                    new CalendarEvent(16, "Dev Meeting", "Weekly dev meeting", new Date(year, month, start + 8), new Date(year, month, start + 8, 23, 59, 59), false, "testStyle", "charlesMadigen"),  
                    new CalendarEvent(17, "Dev Meeting", "Weekly dev meeting", new Date(year, month, start + 15), new Date(year, month, start + 15, 23, 59, 59), false, "testStyle", "charlesMadigen"),  
     
                    new CalendarEvent(18, "Oracle enhancements", "Add the following 11g-specific enhancements: ...", new Date(year, month, start + 5), new Date(year, month, start + 7, 23, 59, 59), "garretMonroe"),  
                    new CalendarEvent(19, "Client export", "Excel export alterations", new Date(year, month, start + 11), new Date(year, month, start + 14, 23, 59, 59), "garretMonroe"),  
                    new CalendarEvent(20, "Record Components", "New ListGrid recordComponent modes: ...", new Date(year, month, start + 16), new Date(year, month, start + 20, 23, 59, 59), "garretMonroe"),  
                    new CalendarEvent(21, "SQLDataSource", "Enhancements to customSQL support", new Date(year, month, start + 2), new Date(year, month, start + 4, 23, 59, 59), "kaiKong"),  
                    new CalendarEvent(22, "includeFrom", "Update support via includeFrom", new Date(year, month, start + 6), new Date(year, month, start + 8, 23, 59, 59), "kaiKong"),  
                    new CalendarEvent(23, "FileItem", "Add milti-file upload support", new Date(year, month, start + 14), new Date(year, month, start + 16, 23, 59, 59), "kaiKong"),  
                    new CalendarEvent(24, "Doc viewer", "Enhance documentation viewer with these additional syntax-hilites: ...", new Date(year, month, start + 18), new Date(year, month, start + 19, 23, 59, 59), "kaiKong")  
            };  
        }  
    }

    #2
    The color attributes you're setting are for the body (or description) of the event - but your code calls setShowEventDescriptions(false), so the body is not visible.

    Either, show the bodies of the events, at which time colors will cha6nge, or use setHeader[Text/Background]Color instead.

    When you say "margin-color", we're not sure what you mean - do you mean the canvas border?

    Comment


      #3
      Originally posted by Isomorphic View Post

      When you say "margin-color", we're not sure what you mean - do you mean the canvas border?
      I mean the canvas border color, yes. So something similar as setHeader[Text/Background]Color, but for the border color.

      Comment


        #4
        You can only currently do that by applying a custom CSS style. However, we'll add CalendarEvent support for borderColor and headerBorderColor into our next release, 6.1.

        Comment


          #5
          wouldn't it be possible to include these methods in some of the next releases of 6.0?
          what I am trying to achieve is to get the colors from the DB. So setHeaderBackgroundColor() was perfect. I would need something similar for the borders.
          If I have to appy a custom CSS style, then I cannot dynamically set the colors from the DB. I would have to define a set of styles and then set the corresponding style. So it would not be possible to change configuration on-the-fly, by chagning the color defined in the DB.

          Comment


            #6
            We've ported CalendarEvent.setBorderColor() and setHeaderBorderColor() back to 6.0 - you can try them out in builds dated October 5 and later.

            Comment


              #7
              Thank you!

              Comment

              Working...
              X