vaadin / vaadin/framework

Long-running calendar events are not displayed as correctly

Open
#10,129 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale v7
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Case 1: Calendar event lasts longer than a week

The allDay property is false

Sample Code
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Calendar;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.components.calendar.event.BasicEvent;
import com.vaadin.ui.components.calendar.event.BasicEventProvider;
import com.vaadin.ui.themes.ValoTheme;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;

@Theme(ValoTheme.THEME_NAME)
public class TestUI extends UI {

    @Override
    protected void init(VaadinRequest request) {
        java.util.Calendar date = new GregorianCalendar();
        date.set(2017, java.util.Calendar.SEPTEMBER, 4, 0, 0, 0);
        Date startDate = date.getTime();

        date.set(2017, java.util.Calendar.SEPTEMBER, 12, 0, 0, 0);
        Date endDate = date.getTime();

        BasicEventProvider eventProvider = new BasicEventProvider();
        BasicEvent event = new BasicEvent("Event 1", null, startDate, endDate);
        eventProvider.addEvent(event);

        final Calendar calendar = new Calendar(eventProvider);
        calendar.setLocale(Locale.ENGLISH);
        calendar.setSizeFull();
        date.set(2017, java.util.Calendar.SEPTEMBER, 1, 0, 0, 0);
        calendar.setStartDate(date.getTime());
        date.set(2017, java.util.Calendar.SEPTEMBER, 30, 0, 0, 0);
        calendar.setEndDate(date.getTime());

        VerticalLayout layout = new VerticalLayout(calendar);
        layout.setMargin(true);
        layout.setSpacing(true);
        setContent(layout);
    }
}

ER:
The event is fully displayed.

AR:
The visual representation of the event is cropped.

For instance, for the event from 2017-09-04 to 2017-09-12 is displayed as one-day event
image

Case 2: Calendar event lasts longer than a day but less than a week

The allDay property is false

ER:
The last day of the event has end-day style, i.e. has rounded corners in its visual representation.

AR:
The last day of the event has no end-day style
image


For case 1: the com.vaadin.client.ui.VCalendar#isEventInDayWithTime method compares the day of the week which results to a bug with events last longer than a week
For case 2: the com.vaadin.client.ui.calendar.schedule.SimpleDayCell#createMonthEventLabel does not take into account case with long-running events without allDay=true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with com.vaadin.client.ui.VCalendar#isEventInDayWithTime and com.vaadin.client.ui.calendar.schedule.SimpleDayCell#createMonthEventLabel, then reproduce both cases with the supplied TestUI sample. Check how non-all-day events spanning more than a week and events spanning several days are represented. Done means the first event is fully displayed and the final day of the shorter event has the end-day style.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.