Git Product home page Git Product logo

calendar-component's Introduction

Calendar Add-on for Vaadin 8

Calendar-component is a UI component add-on for Vaadin 8.

Release notes

Version 2.0.2

  • Change: [Issue#48] Fix Vaadin 8.12 listener deprecations (by evanzel)
  • Update: [Issue#47] Update JUnit to 8.13.1
  • Enhanced: [Issue#44] Month view : Add possibility to set the minimum number of days in the first week (by voltor)
  • Fix: [Issue#39] Fix time zones (by neovmt)

Thanks to all contributors.

Version 2.0.1

  • Enhanced: Ability to add styled timeboxes added See addTimeBlock( start, end, style) and addTimeBlock( day, start, end, style). Braking change: -> The two methods without style has being removed. Use the methods above with your custom style.

Version 2.0

  • Fix: [Issue#32] Resolves the cell scaling issue when a fixed calendar height (or 100%) is used. - Thanks to datadobi
  • Enhanced: [Issue#27] Added possibility to set first day of week - Thanks to voltor
  • Change: [Issue#33] Range selection events are now also triggered on single clicks - Thanks to danieljsv
  • Change: Vaadin version 8.8.5

Version 2.0-BETA4

  • Change: Vaadin version 8.4.0 for the demo
  • Fix: [Issue#17] BasicBackwardHandler and BasicForewardHandler loop cycle fixed
  • Fix: [Issue#19] Calendar Days respond if the locale has changes now

Version 2.0-BETA3

  • Fix: [Issue#11] Calculation of day names fixed
  • Fix: [Issue#13] Fix default caption set from current locale.
  • Enhanced: more builder methods added
  • Timeblocks now uses LocalDate instead of Date
  • minor fixes

Version 2.0-BETA2

  • Fix: [Issue#1] missing toolips in month view
  • Fix: [Issue#6] SetHeight to 100% gives wrong height
  • Fix: [Issue#9] items are moveable still even with isMoveable()=false, again only in monthly View
  • Fix: [Issue#10] Calendar scroll not work
  • Fix: Get handler registration
  • Fix: Styling issues
  • Fix: Wrong heights with time blocks added (Experimental feature)
  • Fix: Item not clickable in month view
  • Enhanced: individual time caption pattern for time added
  • Enhanced: new api to set date ranges added
    • withDay, withDayInMonth, withWeek, withWeekInYear, withMonth, withMonthInYear
  • Enhanced: new controls for switching forward and back in month view.
  • Enhanced: extended styling of first day in month

Version 2.0-BETA1

  • Change: Java8 Date/Time-API
  • Change: parsing of dates replaced by object states
  • Enhanced: weekly caption provider added
  • Change: deprecated code removed

Version 1.0

  • Fixed: cell selection style is not added to calendar items anymore
  • Enhanced: convenience methods for time blocks added

Version 1.0-BETA3

  • Fixed: cell selection style is not added to calendar items anymore
  • Enhanced: convenience methods for time blocks added

Version 1.0-BETA2

  • Fixed: forward and backward day calculation
  • Enhanced: BasicDateClickHandler has a new property to exclude month from cycle
  • Enhanced: add blocked timeslots all over or per day. Blocked slots can be styled.
  • Enhanced: input states per item added. (CalendarItem.isResizeable | .isMoveable | .isClickable)

Version 1.0-BETA1

  • JS-Errors fixed on moving items
  • Naming of events changed to items
  • Refactorings
  • custom styles in demo-app

Version 1.0-ALPHA3

  • EventProvider generics
  • respect descriptionContentMode from state
  • getter/setter for ContentMode

Version 1.0-ALPHA2

  • tooltips fixed
  • deprecated API partial removed
  • getters for daily mode and weekly mode added
  • BasicDateClickHandler now cycles between daily, weekly and monthly mode by default
  • more interactive demo added

Version 1.0-ALPHA1

  • extracted calendar component from current v7 compatibility package
  • container based item providers removed

Roadmap

This component is developed as a hobby with no public roadmap or any guarantees of upcoming releases. That said, the following features are planned for upcoming releases:

  • move over to native Vaadin 8 and Java 8 DateTime-API

Download release

Official releases of this add-on are available at Vaadin Directory. For Maven instructions, download and reviews, go to https://vaadin.com/directory#!addon/calendar-add-on

Building and running demo

git clone mvn clean install cd demo mvn jetty:run

To see the demo, navigate to http://localhost:8080/

Debugging server-side

If you have not already compiled the widgetset, do it now by running vaadin:install Maven target for calendar-component-root project.

If you have a JRebel license, it makes on the fly code changes faster. Just add JRebel nature to your calendar-component-demo project by clicking project with right mouse button and choosing JRebel > Add JRebel Nature

To debug project and make code modifications on the fly in the server-side, right-click the calendar-component-demo project and choose Debug As > Debug on Server. Navigate to http://localhost:8080/calendar-component-demo/ to see the application.

Debugging client-side

Debugging client side code in the calendar-component-demo project:

  • run "mvn vaadin:run-codeserver" on a separate console while the application is running
  • activate Super Dev Mode in the debug window of the application or by adding ?superdevmode to the URL
  • You can access Java-sources and set breakpoints inside Chrome if you enable source maps from inspector settings.

Issue tracking

The issues for this add-on are tracked on its github.com page. All bug reports and feature requests are appreciated.

Contributions

Contributions are welcome, but there are no guarantees that they are accepted as such. Process for contributing is the following:

  • Fork this project
  • Create an issue to this project about the contribution (bug or feature) if there is no such issue about it already. Try to keep the scope minimal.
  • Develop and test the fix or functionality carefully. Only include minimum amount of code needed to fix the issue.
  • Refer to the fixed issue in commit
  • Send a pull request for the original project
  • Comment on the original issue that you have implemented a fix for it

License & Author

Add-on is distributed under Apache License 2.0. For license terms, see LICENSE.txt.

The original source of calendar is written by Vaadin Ltd.

Fixes and additions by: Lutz Güttler

calendar-component's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calendar-component's Issues

Month view : Add possibility to set the minimum number of days in the first week : feature

The first week of the year calculation can differ per country or region. Therefore, it will be nice to have the possibility to configure it independently from any Windows or browser settings, so that the user can set it.

The feature will depend on the 'minimum number of days in the first week' and 'first day of week' configurations.
If the 'minimum number of days in the first week' or 'the first day of the week' values are null, the feature uses the 'locale' value by default.

SetHeight to 100% gives wrong height

When calendar.SetHeight is 100% it gives a bigger height than it should and the last row is usually cut off.
It is more apparent with bigger sizes.

To be fair, it is the same in Vaadin 7 and in Vaadin 8 compatibility packages.
See also open issue vaadin/framework#8333

Apparently only in monthly View.

Change ZoneDateTime API to LocalDateTime

I'm wondering why the calendar API was changed to use ZoneDateTime instead of LocalDateTime? I was thinking it would be better to have the public API all be LocalDateTime so applications don't have to constantly convert back and forth. Inside the Calendar's private methods ZoneDateTime would be figured out using the ZoneID set on the calendar.

Also I don't see ZoneDateTime used on the DateField Vaadin component. So it might also be more consistent as well.

how it can support vaadin7.7.7 ?

sir, i want to use this calendar addon in my legacy project, vaadin version is 7.7.7, i try the branch V1.1, but it's seem not successfully , it exist any version addon match my request? thanks.

BasicBackwardHandler Daily Mode Problem

In BasicBackwardHandler class there is a bug in finding previous day in daily mode (Same bug exists in BasicForwardHandler). If not showing weekends on calendar (getFirstVisibleDayOfWeek => 1, getLastVisibleDayOfWeek => 5), when you press back button on Monday (i expect to see previous friday) there is a bug at line :
dayOfWeek = start.get(ChronoField.DAY_OF_WEEK);
It has to be:
dayOfWeek = newDate.get(ChronoField.DAY_OF_WEEK);

Calendar with PUSH pooling method

You have issue with polling method.
in Method beforeClientResponse(boolean initial) you always call setupCalendarItems(); , but with polling it always sets items when poolled.
It is interesting that it only happens when you are in Week view and scroll down a bit.

Wating for a fix asap!

Kristaps.

Some issues found

1. height is fix, not matter set sizeFull or a larger height. <- this was my fault, the old style fixed the size...
2. rows are only rendered on today
strangerenderingcalendar <-- another style error
3. header column local is rendering dayname correctly but date format is not corresponding to locals one. See previous screenshot
4. style for calendar items does not work it does

Your "all-day-calculation" seems to be broken

I noticed that the thin beam for all-day-appointments in your calendar appears not only, when an appointment takes from 00:00 to 00:00 of the next day, but also if an appointment is longer than 24 hours.
For example:
If an appointment starts today at 13:00 oclock and ends tomorrow at 14:00 oclock, the cal recognizes this as a all-day-appointment for today AND tomorrow and shows its all-day-beam for these two days.
But its not a all-day-event for even one of these two days.
If I set the end time of this appointment back to 12:30 the event shows in cal like a normal event.

cal1
cal2

Month view: Week row height bug

SCENARIO:
1 - clone the code source 2.0.1
2 - remove the row "calendar.setHeight(100.0f, Unit.PERCENTAGE);" calendar-component-demo -> MeetingCalendar::initCalendar
image
3 - run the project

EXPECTED:
image

ACTUALLY:
image

Switch view mode

Hello!
Is it possible to switch view mode (month, week, day) from server side?
(e. g. setMode(Mode.WEEK))

Request: Timeslot 15 minutes?

Hi,
at the moment the predefined timeslots are set to 30 minutes.
Would it be possible to change it to 15 minutes? Maybe configurable?

Thanks and regards,
Marcel

Full-day events in week modus are sometimes misaligned

Problem

When the calendar displays multiple full-day events in week modus that overlap, in some cases the UI incorrectly aligns the event bars when a certain events stops. This problem however doesn't occur when using the calendar in month mode.

calendar_week_view_misalignment

Steps to reproduce

  1. Add 2 events:
    1.1. One from Monday till Thursday
    1.2. One from Tuesday till Sunday

Also Tested

  • Adding the same data to the demo project - Same problem
  • Sorting events based on end date - Same problem

Version

2.0.1

Retain style name when switching from month/week/day mode

In month mode, I set the style name for each calendar item per my color preference. However, when switching to the week or day mode, the style name is reset to default. Is there a way to retain or set the style name when the week or day mode is activated?

Daterange is too big (max 60) = 61

While testing the addon on Vaadin 8, I came across a runtime error. The strange thing is it only happens when you jump from March to April in month mode. You can reproduce the error by overriding the BasicForwardHandler forward(ForwardEvent event) method.

		// Forward handler
		accountCalendar.setHandler(new BasicForwardHandler() {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			/*
			 * (non-Javadoc)
			 * 
			 * @see
			 * org.vaadin.addon.calendar.handler.BasicForwardHandler#forward(org.vaadin.
			 * addon.calendar.ui.CalendarComponentEvents.ForwardEvent)
			 */
			@Override
			public void forward(ForwardEvent event) {
				ZonedDateTime bstart = event.getComponent().getStartDate();
				ZonedDateTime bend = event.getComponent().getEndDate();
				
				long bduration = Duration.between(bstart, bend).toDays();

				System.out.println("Before super start " + bstart);
				System.out.println("Before super end " + bend);
				System.out.println("Before super duration " + bduration);
				
				
				// Let the super handle the rest
				super.forward(event);
				
				ZonedDateTime astart = event.getComponent().getStartDate();
				ZonedDateTime aend = event.getComponent().getEndDate();
				
				long aduration = Duration.between(bstart, bend).toDays();
				
				System.out.println("After super start " + astart);
				System.out.println("After super end " + aend);
				
				System.out.println("After super duration " + aduration);
			}
		});

Stacktrace

java.lang.RuntimeException: Daterange is too big (max 60) = 61
at org.vaadin.addon.calendar.Calendar.setupDaysAndActions(Calendar.java:595)
at org.vaadin.addon.calendar.Calendar.beforeClientResponse(Calendar.java:323)
at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:126)
at com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:168)
at com.vaadin.server.communication.PushHandler.lambda$new$1(PushHandler.java:149)
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:248)
at com.vaadin.server.communication.PushHandler.onMessage(PushHandler.java:534)
at com.vaadin.server.communication.PushAtmosphereHandler.onMessage(PushAtmosphereHandler.java:87)
at com.vaadin.server.communication.PushAtmosphereHandler.onRequest(PushAtmosphereHandler.java:77)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:225)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:114)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:67)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2297)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:594)
at org.atmosphere.websocket.DefaultWebSocketProcessor$3.run(DefaultWebSocketProcessor.java:345)
at org.atmosphere.util.VoidExecutorService.execute(VoidExecutorService.java:101)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:340)
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:448)
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:272)
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:269)
at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:395)
at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:119)
at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:495)
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:294)
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:82)
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171)
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

setMinShownHours(int hours), setMaxShownHours(int hours)

Rather a feature request than a issue,

but it would be great to have the possibility to restrict the shown hours in the "single-day-view", because often you don't need the early morning hours in a business application and you don't want to waste the space for these ...

Maybe this is already possible right now and I couldn't find out how.

I know that there's the possibility to have a scrollbar, but this is really annoying for the user if he HAS to scroll every time he / she uses the widget. I think this would be a bad UX practice.

Any feedback would be appreciated!

I attached a screenshot to clarify what I mean:

2018-08-24 16_02_58-v8 demo stuff

java.io.NotSerializableException

I get a java.io.NotSerializableException: java.time.format.DateTimeFormatter when the session gets serialized.

The issue does not seem to be adressed yet.

Calendar Days not Responding to Locale Changes?

Hello,

First, thank you for working on a Calendar add-on for Vaadin. The framework most certainly needs a calendar.

I cannot figure out how to change the order of the days in the Calendar. The default order is:

Mon, Tue, Wed, Thu, Fri, Sat, Sun

but this does not match the typical US calendar. I want the days to be in the following order:

Sun, Mon, Tue, Wed, Thu, Fri, Sat

Code example:

calendar = new Calendar<>(eventProvider);
calendar.setLocale(Locale.ENGLISH);
calendar.markAsDirty();

Thank you for your time!

Current hour don't use zoneId

Current hour don't use zoneId. I set the user's zoneId but the component get system default.

`
calendar = new Calendar<>(eventProvider);

    calendar.setZoneId(defaultZoneId);
    calendar.withDay(ZonedDateTime.now(defaultZoneId));
    calendar.withDayInMonth(ZonedDateTime.now(defaultZoneId));
    calendar.addStyleName("meetings");
    calendar.setWidth(100.0f, Unit.PERCENTAGE);
    calendar.setHeight(100.0f, Unit.PERCENTAGE);
    calendar.setResponsive(true);
    calendar.setItemCaptionAsHtml(true);
    calendar.setContentMode(ContentMode.HTML);
    calendar.withVisibleDays(1, 5);
    calendar.withVisibleHours(8, 18);
    calendar.setLocale(CurrentUser.get().getLocale());
    calendar.setTimeFormat(TimeFormat.Format24H);
    calendar.setStartDate(ZonedDateTime.of(2017, 9, 10, 0,0,0, 0, defaultZoneId));
    calendar.setEndDate(ZonedDateTime.of(2017, 9, 16, 0,0,0, 0, defaultZoneId));`

Stretch a full day event in the month view

This is more like a feature request. I'd like to have the possibility to stretch a full day event if that event is only one on that day like this:

image

Is this somehow possible in the current version?
Thanks, cheers.

Month view: entries for one day are not displayed in chronological order

Later appointments are displayed before earlier appointment in month view. The error always seems to occur when an entry has more than a "30 minutes" timeslot.

Steps to reproduce:

  • Compile the demo and run jetty.
  • Visit localhost:8080.
  • You are presented with the week view.
  • Add an entry by clicking on the 09:00 timeslot on one day.
  • Use the same day but this time add an entry which uses two consecutive timeslots (e.g. 10:00am-11:00am).
  • Switch to month view. The 10:00AM entry will be above the 9:00AM entry in the month view.

week view:
01

month view:
02

Switch off day and week view, change listener

Hi! As I’m pretty new to the calendar addon, I’d appreciate your help.

  1. I want to switch off day and week calendar view, leaving only the monhly view. Do you guys happen to know how to do that? So far I managed to show monthly view as the defaul one.

  2. I want to redirect to custom page when the user clicks a day in calendar. Also, any help appreciated!

Thanks in advance!

Label ignores time zone

Label in calendar ignores time zone. This is cause by no zoneId in formatter.
Test case:
LocalDateTime = 2019-11-08 09:16:00
Time zone = Europe/Bratislava (UTC+2)

Calendar timezone = Europe/London (UTC+1)
Label should be "8:16 AM", not "9:16 AM"

Screenshot:
Screenshot from 2019-11-08 09-16-35

Testcase example:
BasicItem basicItem = new BasicItem();
basicItem.setDescription("Test 1");
basicItem.setStart(ZonedDateTime.of(LocalDateTime.now(), ZoneId.of("Europe/Bratislava")));
basicItem.setEnd(ZonedDateTime.of(LocalDateTime.now().plusHours(1), ZoneId.of("Europe/Bratislava")));
BasicItemProvider basicItemBasicItemProvider = new BasicItemProvider<>();
basicItemBasicItemProvider.addItem(basicItem);

Calendar calendar = new Calendar<>(basicItemBasicItemProvider);
calendar.setWidth(100f, Unit.PERCENTAGE);
calendar.setHeight(100f, Unit.PERCENTAGE);
calendar.setZoneId(ZoneId.of("Europe/London"));
calendar.setFirstDayOfWeek(DayOfWeek.MONDAY);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.