Skip to content

Commit

Permalink
Moved new views into standard "views" package.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Oct 3, 2022
1 parent c7d6556 commit 9e2ab55
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 45 deletions.
60 changes: 60 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
-------------------------------------------------------------------------------
RELEASE NOTES, VERSION 11.12.x (October 2022)
-------------------------------------------------------------------------------

*** NEW FEATURES

ResourcesView
-------------

A new view called "ResourcesView" was added. It can be used to add allocations
to one or more resources / people. A typical use case would be a personal that
is working at a barber / hairdresser. The calendar entries would represent
customer appointments. This view can either display "dates over resources" or
"resources over dates". As part of the development of we added the "Resource"
model class. This class stores a regular calendar and a special one called the
"availability calendar". The availability of a resource can be edited when the
view's "editAvailability" property is set to true.

BackgroundCanvas
----------------

To visualize the availability of a Resource we decided to use a canvas instead
of scene graph nodes. The performance is just much better and availability is
usually expressed by greying out the background of a resource. For controlling
the availability granularity and color please see DateControl#availabilityGrid
and DateControl#availabilityColor.

The background canvas also renders new light-weight grid lines. This is needed
as the availability grid could lead to the creation of many more grid lines
compared to the previous full- and half-hour grid lines. However, these light-
weight grid lines can not be styled via CSS. See the DateControl#gridLineColor
property.

DayEntryView
------------

It is now possible to set a "click count" number for showing the details of an
entry view. In the past the user always had to double click on the entry. Now
a single or a tripple click can also be configured.

*** ENHANCEMENTS

DayViewEditController
---------------------

With the addition of the availability feature we had to revisit the logic for
editing day entry views. The code became too messy and had to be refactored.
When comparing the before and after of this class one will notice that the new
code is much more structured.

Calendar
--------

A new "user object" property was added to the calendar so that a link can be
created between the calendar and its data source or its business object.

*** FIXES

Recurrence entries were not updated correctly in certain circumstances. This
has been fixed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.calendarfx.view.DayEntryView;
import com.calendarfx.view.DayView;
import com.calendarfx.view.EntryViewBase;
import com.calendarfx.view.resources.ResourceCalendarView;
import com.calendarfx.view.ResourceCalendarView;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.calendarfx.view.DayEntryView;
import com.calendarfx.view.DayView;
import com.calendarfx.view.DayViewBase.OverlapResolutionStrategy;
import com.calendarfx.view.resources.ResourceCalendarView;
import com.calendarfx.view.ResourceCalendarView;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import com.calendarfx.view.DayViewBase.AvailabilityEditingEntryBehaviour;
import com.calendarfx.view.DayViewBase.EarlyLateHoursStrategy;
import com.calendarfx.view.DayViewBase.GridType;
import com.calendarfx.view.resources.Resource;
import com.calendarfx.view.resources.ResourcesView;
import com.calendarfx.view.resources.ResourcesView.Type;
import com.calendarfx.model.Resource;
import com.calendarfx.view.ResourcesView;
import com.calendarfx.view.ResourcesView.Type;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Node;
Expand Down
40 changes: 37 additions & 3 deletions CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
* view.getCalendarSources().add(source);
* }
* </pre>
*
* @param <T> the type of the (optional) user object
*/
public class Calendar implements EventTarget {
public class Calendar<T> implements EventTarget {

/**
* Predefined visual styles for calendars. The actual CSS settings for these
Expand Down Expand Up @@ -154,19 +156,31 @@ public Calendar() {
});
}


/**
* Constructs a new calendar with the given name.
*
* @param name the name of the calendar
* @param userObject an optional user object
*/
public Calendar(String name) {
public Calendar(String name, T userObject) {
this();

setName(name);

if (name != null) {
setShortName(!name.isEmpty() ? name.substring(0, 1) : "");
}

setUserObject(userObject);
}

/**
* Constructs a new calendar with the given name.
*
* @param name the name of the calendar
*/
public Calendar(String name) {
this(name, null);
}

@SuppressWarnings({"rawtypes", "unchecked"})
Expand Down Expand Up @@ -877,6 +891,26 @@ public final EventDispatchChain buildEventDispatchChain(EventDispatchChain given
});
}

private final ObjectProperty<T> userObject = new SimpleObjectProperty<>(this, "userObject");

public final T getUserObject() {
return userObject.get();
}

/**
* An (optional) user object that can be used to link this calendar to the source
* of its data or the business object that it represents.
*
* @return a user object
*/
public final ObjectProperty<T> userObjectProperty() {
return userObject;
}

public final void setUserObject(T userObject) {
this.userObject.set(userObject);
}

@Override
public String toString() {
return "Calendar [name=" + getName() + ", style=" + getStyle()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
package com.calendarfx.view.resources;
package com.calendarfx.model;

import com.calendarfx.model.Calendar;
import com.calendarfx.view.DateControl;
import com.calendarfx.view.ResourcesView;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;

/**
* A resource represents a person or a machine. Resources can be edited via
* the {@link ResourcesView}. A typical use case would be the allocation of
* personnel in a hairdresser salon. A resource might be available or not.
* This can be expressed via the {@link #availabilityCalendarProperty()}.
*
* @param <T> the type of the wrapped / referenced business object (person or machine).
*
* @see ResourcesView#getResources()
* @see DateControl#editAvailabilityProperty()
* @see DateControl#availabilityGridProperty()
* @see DateControl#availabilityFillProperty()
*/
public class Resource<T> {

public Resource() {
Expand All @@ -19,6 +33,11 @@ public final T getUserObject() {
return userObject.get();
}

/**
* An (optional) user object.
*
* @return the user object (e.g. the person or the calendar data source).
*/
public final ObjectProperty<T> userObjectProperty() {
return userObject;
}
Expand All @@ -33,6 +52,12 @@ public final Calendar getCalendar() {
return calendar.get();
}

/**
* A resource can be "booked" or "allocated to tasks". Those bookings / allocations are stored
* in this calendar.
*
* @return the resource calendar with the resource's bookings
*/
public final ObjectProperty<Calendar> calendarProperty() {
return calendar;
}
Expand All @@ -47,6 +72,16 @@ public Calendar getAvailabilityCalendar() {
return availabilityCalendar.get();
}

/**
* A resource might be available or not. This can be determined via the "availability"
* calendar.
*
* @return the resource's availability calendar
*
* @see DateControl#editAvailabilityProperty()
* @see DateControl#availabilityGridProperty()
* @see DateControl#availabilityFillProperty()
*/
public ObjectProperty<Calendar> availabilityCalendarProperty() {
return availabilityCalendar;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.calendarfx.view.resources;
package com.calendarfx.view;

import com.calendarfx.model.Marker;
import com.calendarfx.view.DayView;
import com.calendarfx.view.DayViewBase;
import impl.com.calendarfx.view.resources.ResourceCalendarViewSkin;
import impl.com.calendarfx.view.ResourceCalendarViewSkin;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@
* limitations under the License.
*/

package com.calendarfx.view.resources;

import com.calendarfx.view.AllDayView;
import com.calendarfx.view.CalendarHeaderView;
import com.calendarfx.view.DayView;
import com.calendarfx.view.DayViewBase;
import com.calendarfx.view.RequestEvent;
import com.calendarfx.view.TimeScaleView;
import com.calendarfx.view.VirtualGrid;
import com.calendarfx.view.WeekDayHeaderView;
import com.calendarfx.view.WeekView;
import impl.com.calendarfx.view.resources.ResourcesViewSkin;
package com.calendarfx.view;

import com.calendarfx.model.Resource;
import impl.com.calendarfx.view.ResourcesViewSkin;
import javafx.beans.InvalidationListener;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package impl.com.calendarfx.view.resources;
package impl.com.calendarfx.view;

import com.calendarfx.model.Marker;
import com.calendarfx.view.DayView;
import com.calendarfx.view.resources.ResourceCalendarView;
import com.calendarfx.view.ResourceCalendarView;
import com.calendarfx.view.TimeScaleView;
import com.calendarfx.view.VirtualGrid;
import impl.com.calendarfx.view.DayViewBaseSkin;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package impl.com.calendarfx.view.resources;
package impl.com.calendarfx.view;

import com.calendarfx.view.DayViewBase;
import com.calendarfx.view.resources.Resource;
import com.calendarfx.view.resources.ResourcesView;
import com.calendarfx.model.Resource;
import com.calendarfx.view.ResourcesView;
import javafx.scene.control.Skin;

public class ResourcesViewContainer<T extends Resource<?>> extends DayViewBase {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package impl.com.calendarfx.view.resources;
package impl.com.calendarfx.view;

import com.calendarfx.model.CalendarSource;
import com.calendarfx.view.DayView;
import com.calendarfx.view.WeekView;
import com.calendarfx.view.resources.Resource;
import com.calendarfx.view.resources.ResourcesView;
import com.calendarfx.view.resources.ResourcesView.Type;
import impl.com.calendarfx.view.DayViewBaseSkin;
import com.calendarfx.model.Resource;
import com.calendarfx.view.ResourcesView;
import com.calendarfx.view.ResourcesView.Type;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
* limitations under the License.
*/

package impl.com.calendarfx.view.resources;
package impl.com.calendarfx.view;

import com.calendarfx.model.CalendarSource;
import com.calendarfx.view.AllDayView;
import com.calendarfx.view.TimeScaleView;
import com.calendarfx.view.WeekDayHeaderView;
import com.calendarfx.view.resources.Resource;
import com.calendarfx.view.resources.ResourcesView;
import com.calendarfx.view.resources.ResourcesView.Type;
import impl.com.calendarfx.view.DateControlSkin;
import impl.com.calendarfx.view.DayViewScrollPane;
import com.calendarfx.model.Resource;
import com.calendarfx.view.ResourcesView;
import com.calendarfx.view.ResourcesView.Type;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.binding.Bindings;
Expand Down
4 changes: 2 additions & 2 deletions CalendarFXView/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
exports com.calendarfx.view.page;
exports com.calendarfx.view.popover;
exports com.calendarfx.view.print;
exports com.calendarfx.view.resources;

exports impl.com.calendarfx.view;
exports impl.com.calendarfx.view.page;
exports impl.com.calendarfx.view.popover;
exports impl.com.calendarfx.view.print;
exports impl.com.calendarfx.view.resources;
exports impl.com.calendarfx.view.util;

opens com.calendarfx.view;
opens com.calendarfx.view.resources;
opens impl.com.calendarfx.view.resources;
opens com.calendarfx.model;
opens impl.com.calendarfx.view;
}

0 comments on commit 9e2ab55

Please sign in to comment.