Announcement

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

    Timelane with canEditLane(false)

    Code:
    public class TestingModule implements EntryPoint {  
     
        public void onModuleLoad() {  
            Timeline calendar = new Timeline();  
            calendar.setHeight(451);  
            calendar.setStartDate(new Date(112, 5, 2));  
            calendar.setEndDate(new Date(112, 5, 22));  
            calendar.setShowEventDescriptions(false);  
            calendar.setShowQuickEventDialog(false);
            calendar.setCanEditLane(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.draw();  
        }  
     
    }
    If I click the "+" icon on the timelane, I cannot set the lane, which is because of the setting: calendar.setCanEditLane(false);
    So it is impossible to create an event with these settings using the "+" button . Is this a bug?

    So what to do here? Remove the + button ? (how?)

    I created this testcase because of an exception when calling:
    Code:
    calendar.setEventEditorCustomizer(new EventEditorCustomizer() {
    
                @Override
                public boolean showEventEditor(final CalendarEvent calendarEvent, Boolean isNewEvent) {
                    Integer eventId = calendarEvent.getAttributeAsInt("f_id");
                    if (eventId == null) {
                        SC.logWarn("CalendarEvent: " + calendarEvent);
                        SC.logWarn("Get Event Lane: " + calendar.getEventLane(calendarEvent));
                        SC.logWarn("Name: " + calendar.getEventLane(calendarEvent).getName());
                        AbwesenheitEventEditWindow w = new AbwesenheitEventEditWindow(AbwesenheitsplanungWindow.this,
                                Optional.of(calendarEvent), getCalendar(), Optional.fromNullable((Record) null),
                                calendar.getEventLane(calendarEvent).getName());
                        getCalendar().addChild(w);
                        w.show();
                    } else {
                    }
    getEventLane(calendarEvent) returns null when clicking the + button.
    So, again, I would like to remove the + button in this case. Or what to do? What would you recommend?

    Using power 6.0-p20161005

    #2
    That's a good question - on reflection, can*Edit*Lane probably shouldn't dictate what happens creating a new event - that is, you need to be able to pick a Lane for a new event. We'll consider that and get back to you.

    In the meantime, setShowAddEventButton(false) will hide it altogether.

    Comment

    Working...
    X