Here are the examples of the java api com.calendarfx.model.Calendar taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
67 Examples
19
Source : YearMonthViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected void calendarChanged(Calendar calendar) {
updateUsageColors("changes in calendar " + calendar.getName());
}
19
Source : YearMonthViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public boolean isCalendarVisible(Calendar calendar) {
return getSkinnable().isCalendarVisible(calendar);
}
19
Source : MonthViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected void calendarChanged(Calendar calendar) {
updateEntries("changes in calendar " + calendar.getName());
}
19
Source : MonthSheetViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected void calendarChanged(Calendar calendar) {
updateEntries("calendar changed");
}
19
Source : DayViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected void calendarChanged(Calendar calendar) {
if (!getSkinnable().isSuspendUpdates()) {
loadData("changes in calendar " + calendar.getName());
}
}
19
Source : DateControlSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void calendarListChanged(Change<? extends Calendar> change) {
C dateControl = getSkinnable();
while (change.next()) {
if (change.wasAdded()) {
for (Calendar calendar : change.getAddedSubList()) {
calendar.addEventHandler(calendarListener);
dateControl.getCalendarVisibilityProperty(calendar).addListener(calendarVisibilityChanged);
}
} else if (change.wasRemoved()) {
for (Calendar calendar : change.getRemoved()) {
calendar.removeEventHandler(calendarListener);
dateControl.getCalendarVisibilityProperty(calendar).removeListener(calendarVisibilityChanged);
}
}
}
}
19
Source : DateControlSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
protected void calendarChanged(Calendar calendar) {
}
19
Source : AgendaViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void listenToCalendars() {
for (Calendar c : getSkinnable().getCalendars()) {
getSkinnable().getCalendarVisibilityProperty(c).addListener(weakCalendarVisibilityChanged);
}
}
19
Source : AgendaViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected void calendarChanged(Calendar calendar) {
updateList("calendar changed");
}
19
Source : SourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
public final BooleanProperty getCalendarVisibilityProperty(Calendar calendar) {
return calendarVisibilityMap.computeIfAbsent(calendar, cal -> new SimpleBooleanProperty(SourceView.this, "visible", true));
}
19
Source : SourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
public final void setCalendarVisibility(Calendar calendar, boolean visible) {
BooleanProperty prop = getCalendarVisibilityProperty(calendar);
prop.set(visible);
}
19
Source : EntryHeaderView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
/**
* Returns the currently selected calendar.
*
* @return the selected calendar
*/
public final Calendar getCalendar() {
Calendar calendar = calendarSelector.getCalendar();
if (calendar == null) {
calendar = entry.getCalendar();
}
return calendar;
}
19
Source : CalendarSelector.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
/**
* Sets the value of {@link #calendarProperty()}.
*
* @param calendar the selected calendar
*/
public final void setCalendar(Calendar calendar) {
calendarProperty().set(calendar);
}
19
Source : HelloSourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void addWorkCalendar() {
Calendar calendar = new Calendar("Work Calendar " + calendarCounter++);
calendar.setStyle(Style.getStyle(calendarCounter));
workCalendarSource.getCalendars().add(calendar);
}
19
Source : HelloSourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void addFamilyCalendar() {
Calendar calendar = new Calendar("Family Calendar " + calendarCounter++);
calendar.setStyle(Style.getStyle(calendarCounter));
familyCalendarSource.getCalendars().add(calendar);
}
19
Source : GoogleSyncManager.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public void onChanged(Change<? extends Calendar> c) {
while (c.next()) {
for (Calendar calendar : c.getRemoved()) {
calendar.removeEventHandler(this);
}
for (Calendar calendar : c.getAddedSubList()) {
calendar.addEventHandler(this);
}
}
}
18
Source : DayViewEditController.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void mouseDragged(MouseEvent evt) {
if (!evt.getButton().equals(MouseButton.PRIMARY) || dayEntryView == null || dragMode == null || !dragging) {
return;
}
Calendar calendar = entry.getCalendar();
if (calendar.isReadOnly()) {
return;
}
if (dayView.getDraggedEntry() == null || dayEntryView.getParent() == null) {
// we might see "mouse dragged" events close before "mouse pressed". in this case, our drag/dro handling
// has not been fully initialized yet.
return;
}
switch(dragMode) {
case START_TIME:
switch(handle) {
case TOP:
case BOTTOM:
changeStartTime(evt);
break;
case CENTER:
break;
}
break;
case END_TIME:
switch(handle) {
case TOP:
case BOTTOM:
changeEndTime(evt);
break;
case CENTER:
break;
}
break;
case START_AND_END_TIME:
changeStartAndEndTime(evt);
break;
}
}
18
Source : CalendarSelectorSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void updateButton() {
Calendar calendar = getSkinnable().getCalendar();
if (calendar != null) {
buttonIcon.getStyleClreplaced().setAll(calendar.getStyle() + "-icon");
} else {
buttonIcon.getStyleClreplaced().clear();
}
}
18
Source : SourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
public final boolean isCalendarVisible(Calendar calendar) {
BooleanProperty prop = getCalendarVisibilityProperty(calendar);
return prop.get();
}
18
Source : SourceGridView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
public final BooleanProperty getCalendarVisibilityProperty(Calendar calendar) {
return calendarVisibilityMap.computeIfAbsent(calendar, cal -> new SimpleBooleanProperty(SourceGridView.this, "visible", true));
}
18
Source : CalendarHeaderView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
public final BooleanProperty getCalendarVisibilityProperty(Calendar calendar) {
return calendarVisibilityMap.computeIfAbsent(calendar, cal -> new SimpleBooleanProperty(CalendarHeaderView.this, "visible", true));
}
18
Source : GoogleCalendarSearchTextManager.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public void onChanged(Change<? extends Calendar> c) {
while (c.next()) {
for (Calendar calendar : c.getRemoved()) {
if (calendar instanceof GoogleCalendar) {
((GoogleCalendar) calendar).setSearchTextProvider(null);
}
}
for (Calendar calendar : c.getAddedSubList()) {
if (calendar instanceof GoogleCalendar) {
((GoogleCalendar) calendar).setSearchTextProvider(this);
}
}
}
}
18
Source : GoogleAccount.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
/**
* Gets all the google calendars hold by this source.
*
* @return The list of google calendars, always a new list.
*/
public List<GoogleCalendar> getGoogleCalendars() {
List<GoogleCalendar> googleCalendars = new ArrayList<>();
for (Calendar calendar : getCalendars()) {
if (!(calendar instanceof GoogleCalendar)) {
continue;
}
googleCalendars.add((GoogleCalendar) calendar);
}
return googleCalendars;
}
17
Source : DayViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void addEntryView(Entry<?> entry) {
if (entry.isRecurring()) {
Calendar calendar = entry.getCalendar();
LocalDate date = getSkinnable().getDate();
final Map<LocalDate, List<Entry<?>>> entries = calendar.findEntries(date, date, getZoneId());
List<Entry<?>> entriesOnDate = entries.get(date);
if (entriesOnDate != null && !entriesOnDate.isEmpty()) {
doAddEntryView(entriesOnDate.get(0));
}
} else {
doAddEntryView(entry);
}
}
17
Source : DayViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void layoutSwimlane(DayView dayView, double contentX, double contentY, double contentWidth, double contentHeight) {
List<Calendar> visibleCalendars = dayView.getCalendars().filtered(c -> getSkinnable().isCalendarVisible(c));
double x = contentX;
double w = contentWidth / (visibleCalendars.size());
for (Calendar calendar : visibleCalendars) {
List<DayEntryView> entryViews = getChildren().stream().filter(node -> node instanceof DayEntryView).map(node -> (DayEntryView) node).filter(view -> {
Calendar cal;
Entry<?> entry = view.getEntry();
if (entry instanceof DraggedEntry) {
DraggedEntry draggedEntry = (DraggedEntry) view.getEntry();
cal = draggedEntry.getOriginalCalendar();
} else {
cal = entry.getCalendar();
}
return cal != null && cal.equals(calendar);
}).collect(Collectors.toList());
layoutEntryViews(entryViews, dayView, x, contentY, w, contentHeight);
x += w;
}
}
17
Source : DayViewEditController.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void initDragModeAndHandle(MouseEvent evt) {
dragMode = null;
handle = null;
if (!(evt.getTarget() instanceof EntryViewBase)) {
return;
}
dayEntryView = (DayEntryView) evt.getTarget();
entry = dayEntryView.getEntry();
Calendar calendar = entry.getCalendar();
if (calendar.isReadOnly()) {
return;
}
double y = evt.getY() - dayEntryView.getBoundsInParent().getMinY();
LOGGER.finer("y-coordinate inside entry view: " + y);
if (y > dayEntryView.getHeight() - 5) {
if (dayEntryView.getHeightLayoutStrategy().equals(HeightLayoutStrategy.USE_START_AND_END_TIME) && dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_END))) {
dragMode = DraggedEntry.DragMode.END_TIME;
handle = Handle.BOTTOM;
}
} else if (y < 5) {
if (dayEntryView.getHeightLayoutStrategy().equals(HeightLayoutStrategy.USE_START_AND_END_TIME) && dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_START))) {
dragMode = DraggedEntry.DragMode.START_TIME;
handle = Handle.TOP;
}
} else {
if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.MOVE))) {
dragMode = DraggedEntry.DragMode.START_AND_END_TIME;
handle = Handle.CENTER;
}
}
}
17
Source : DayViewEditController.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void mouseReleased(MouseEvent evt) {
if (!evt.getButton().equals(MouseButton.PRIMARY) || dayEntryView == null || dragMode == null || !dragging) {
return;
}
dragging = false;
Calendar calendar = entry.getCalendar();
if (calendar.isReadOnly()) {
return;
}
dayEntryView.getProperties().put("dragged", false);
dayEntryView.getProperties().put("dragged-start", false);
dayEntryView.getProperties().put("dragged-end", false);
/*
* We might run in the sampler application. Then the entry view will not
* be inside a date control.
*/
DraggedEntry draggedEntry = dayView.getDraggedEntry();
if (draggedEntry != null) {
entry.setInterval(draggedEntry.getInterval());
dayView.setDraggedEntry(null);
}
}
17
Source : DataLoader.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
public void loadEntries(Map<LocalDate, List<Entry<?>>> result) {
long time = System.currentTimeMillis();
LocalDate startDate = provider.getLoadStartDate();
LocalDate endDate = provider.getLoadEndDate();
ZoneId zoneId = provider.getZoneId();
for (CalendarSource source : provider.getCalendarSources()) {
for (Calendar calendar : source.getCalendars().stream().filter(c -> provider.isCalendarVisible(c)).collect(Collectors.toList())) {
try {
Map<LocalDate, List<Entry<?>>> entries = calendar.findEntries(startDate, endDate, zoneId);
for (LocalDate date : entries.keySet()) {
List<Entry<?>> list = result.computeIfAbsent(date, it -> new ArrayList<>());
List<Entry<?>> dateEntries = entries.get(date);
if (dateEntries != null) {
for (Entry<?> entry : dateEntries) {
if (entry == null) {
if (LoggingDomain.MODEL.isLoggable(Level.SEVERE)) {
LoggingDomain.MODEL.severe("the calendar " + calendar.getName() + " (source " + source.getName() + ") returned a NULL entry");
}
} else {
list.add(entry);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
for (List<Entry<?>> entries : result.values()) {
Collections.sort(entries);
}
LoggingDomain.PERFORMANCE.fine("data load time: " + (System.currentTimeMillis() - time) + ", view = " + provider.getClreplaced().getSimpleName());
provider.getControl().fireEvent(new LoadEvent(LoadEvent.LOAD, provider.getLoaderName(), provider.getCalendarSources(), startDate, endDate, zoneId));
}
17
Source : CalendarViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void print() {
if (printView == null) {
printView = getSkinnable().getPrintView();
printView.dateProperty().bind(getSkinnable().dateProperty());
}
printView.setToday(getSkinnable().getToday());
printView.getPreviewPane().getPrintablePage().setPageStartDate(getSkinnable().getDate());
printView.setWeekFields(getSkinnable().getWeekFields());
printView.getCalendarSources().setAll(getSkinnable().getCalendarSources());
printView.setLayout(getSkinnable().getSelectedPage().getLayout());
printView.setViewType(getSkinnable().getSelectedPage().getPrintViewType());
printView.loadDropDownValues(getSkinnable().getDate());
printView.show(getSkinnable().getScene().getWindow());
Platform.runLater(() -> {
SourceView printSource = printView.getSettingsView().getSourceView();
for (Calendar calendar : printSource.getCalendarVisibilityMap().keySet()) {
printSource.getCalendarVisibilityProperty(calendar).removeListener(printEntriesVisibilityListener);
printSource.getCalendarVisibilityProperty(calendar).addListener(printEntriesVisibilityListener);
}
});
}
17
Source : AllDayViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void addEntryView(Entry<?> entry) {
if (entry.isRecurring()) {
Calendar calendar = entry.getCalendar();
final Map<LocalDate, List<Entry<?>>> entries = calendar.findEntries(getLoadStartDate(), getLoadEndDate(), getZoneId());
for (LocalDate date : entries.keySet()) {
List<Entry<?>> entriesOnDate = entries.get(date);
if (entriesOnDate != null) {
entriesOnDate.forEach(this::doAddEntryView);
}
}
} else {
doAddEntryView(entry);
}
}
17
Source : SourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void createContextMenu() {
MenuItem disableAll = new MenuItem();
disableAll.setText(Messages.getString("SourceView.DISABLE_ALL"));
disableAll.setOnAction(evt -> {
for (CalendarSource source : getCalendarSources()) {
for (Calendar calendar : source.getCalendars()) {
setCalendarVisibility(calendar, false);
}
}
});
MenuItem enableAll = new MenuItem();
enableAll.setText(Messages.getString("SourceView.ENABLE_ALL"));
enableAll.setOnAction(evt -> {
for (CalendarSource source : getCalendarSources()) {
for (Calendar calendar : source.getCalendars()) {
setCalendarVisibility(calendar, true);
}
}
});
ContextMenu contextMenu = new ContextMenu();
contextMenu.gereplacedems().addAll(disableAll, enableAll);
setContextMenu(contextMenu);
}
17
Source : DraggedEntry.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
/**
* Dragged entry is used internally only to represent the calendar entry that is
* currently being dragged. The entry wraps the original entry and stores some
* additional information about the ongoing drag.
*/
public final clreplaced DraggedEntry extends Entry<Object> {
/**
* An enum used for defining which drag operation is currently in progress.
*/
public enum DragMode {
/**
* The user is changing the start time of an entry.
*/
START_TIME,
/**
* The user is changing the end time of an entry.
*/
END_TIME,
/**
* The user is dragging the entire entry, hence changing start and end
* time at the same time.
*/
START_AND_END_TIME
}
private Duration offsetDuration;
private Entry<?> originalEntry;
private Calendar originalCalendar;
private DragMode dragMode;
/**
* Constructs a new dragged entry
*
* @param entry
* the original entry being dragged
* @param dragMode
* the drag mode (start time, end time, or both)
*/
public DraggedEntry(Entry<?> entry, DragMode dragMode) {
this.originalEntry = requireNonNull(entry);
this.originalCalendar = requireNonNull(entry.getCalendar());
this.dragMode = dragMode;
setreplacedle(entry.getreplacedle());
setUserObject(entry.getUserObject());
setFullDay(entry.isFullDay());
setInterval(entry.getInterval());
getStyleClreplaced().add("dragged-entry");
}
/**
* Returns the current drag mode (start time, end time, or both).
*
* @return the drag mode
*/
public DragMode getDragMode() {
return dragMode;
}
/**
* Sets the current drag mode (start time, end time, or both).
*
* @param dragMode
* the drag mode
*/
public void setDragMode(DragMode dragMode) {
requireNonNull(dragMode);
this.dragMode = dragMode;
}
/**
* Returns the original entry that the user wants to edit.
*
* @return the original calendar entry
*/
public Entry<?> getOriginalEntry() {
return originalEntry;
}
/**
* Returns the original calendar where the entry is located that is being
* dragged.
*
* @return the calendar where the entry originated from
*/
public Calendar getOriginalCalendar() {
return originalCalendar;
}
/**
* Sets the duration between the mouse press location and the start time of
* the entry.
*
* @param duration
* the offset duration
*/
public void setOffsetDuration(Duration duration) {
this.offsetDuration = duration;
}
/**
* Returns the duration between the mouse press location and the start time
* of the entry.
*
* @return the offset duration
*/
public Duration getOffsetDuration() {
return offsetDuration;
}
}
16
Source : DayEntryViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
/**
* This methods updates the styles of the node according to the entry
* settings.
*/
protected void updateStyles() {
DayEntryView view = getSkinnable();
Entry<?> entry = getEntry();
Calendar calendar = entry.getCalendar();
if (entry instanceof DraggedEntry) {
calendar = ((DraggedEntry) entry).getOriginalCalendar();
}
// when the entry gets removed from its calendar then the calendar can
// be null
if (calendar == null) {
return;
}
view.getStyleClreplaced().setAll("default-style-entry", calendar.getStyle() + "-entry");
if (entry.isRecurrence()) {
view.getStyleClreplaced().add("recurrence");
}
view.getStyleClreplaced().addAll(entry.getStyleClreplaced());
startTimeLabel.getStyleClreplaced().setAll("start-time-label", "default-style-entry-time-label", calendar.getStyle() + "-entry-time-label");
replacedleLabel.getStyleClreplaced().setAll("replacedle-label", "default-style-entry-replacedle-label", calendar.getStyle() + "-entry-replacedle-label");
}
16
Source : EntryViewBase.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
/**
* Convenience method to determine whether the entry belongs to a calendar
* that is read-only.
*
* @return true if the entry can not be edited by the user
*/
public final boolean isReadOnly() {
Entry<?> entry = getEntry();
Calendar calendar = entry.getCalendar();
if (calendar != null) {
return calendar.isReadOnly();
}
return false;
}
16
Source : EntryViewBase.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void bindVisibility() {
Entry<?> entry = getEntry();
if (entry != null) {
Calendar calendar = entry.getCalendar();
if (calendar != null) {
visibleProperty().bind(Bindings.and(getDateControl().getCalendarVisibilityProperty(calendar), Bindings.not(hiddenProperty())));
}
}
}
16
Source : CreateDeleteHandler.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void deleteEntries(KeyEvent evt) {
switch(evt.getCode()) {
case DELETE:
case BACK_SPACE:
for (Entry<?> entry : dateControl.getSelections()) {
if (!dateControl.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dateControl, entry, DateControl.EditOperation.DELETE))) {
continue;
}
if (entry.isRecurrence()) {
entry = entry.getRecurrenceSourceEntry();
}
if (!dateControl.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dateControl, entry, DateControl.EditOperation.DELETE))) {
continue;
}
Calendar calendar = entry.getCalendar();
if (calendar != null && !calendar.isReadOnly()) {
entry.removeFromCalendar();
}
}
dateControl.clearSelection();
break;
case F5:
dateControl.refreshData();
default:
break;
}
}
16
Source : GoogleCalendarDataManager.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public void onChanged(Change<? extends Calendar> c) {
List<GoogleCalendar> removed = new ArrayList<>();
while (c.next()) {
for (Calendar calendar : c.getRemoved()) {
if (calendar instanceof GoogleCalendar) {
removed.add((GoogleCalendar) calendar);
}
}
for (Calendar calendar : c.getAddedSubList()) {
if (calendar instanceof GoogleCalendar) {
removed.remove(calendar);
}
}
}
for (GoogleCalendar calendar : removed) {
removeCalendarData(calendar);
}
}
15
Source : HelloSourceView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected Node createControl() {
sourceView = new SourceView();
Calendar meetings = new Calendar("Meetings");
Calendar training = new Calendar("Training");
Calendar customers = new Calendar("Customers");
Calendar holidays = new Calendar("Holidays");
meetings.setStyle(Style.STYLE2);
training.setStyle(Style.STYLE3);
customers.setStyle(Style.STYLE4);
holidays.setStyle(Style.STYLE5);
workCalendarSource = new CalendarSource("Work");
workCalendarSource.getCalendars().addAll(meetings, training, customers, holidays);
Calendar birthdays = new Calendar("Birthdays");
Calendar katja = new Calendar("Katja");
Calendar dirk = new Calendar("Dirk");
Calendar philip = new Calendar("Philip");
Calendar jule = new Calendar("Jule");
Calendar armin = new Calendar("Armin");
familyCalendarSource = new CalendarSource("Family");
familyCalendarSource.getCalendars().addAll(birthdays, katja, dirk, philip, jule, armin);
sourceView.getCalendarSources().addAll(workCalendarSource, familyCalendarSource);
return sourceView;
}
14
Source : SourceViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void updateView() {
vbox.getChildren().clear();
for (CalendarSource source : getSkinnable().getCalendarSources()) {
source.getCalendars().removeListener(updater);
source.getCalendars().addListener(updater);
VBox box = new VBox(8);
box.getStyleClreplaced().add("single-calendar-group");
for (Calendar calendar : source.getCalendars()) {
CheckBox checkBox = new CheckBox();
checkBox.textProperty().bind(calendar.nameProperty());
checkBox.getStyleClreplaced().addAll("default-style-visibility-checkbox", calendar.getStyle() + "-visibility-checkbox");
Bindings.bindBidirectional(checkBox.selectedProperty(), getSkinnable().getCalendarVisibilityProperty(calendar));
box.getChildren().add(checkBox);
}
if (getSkinnable().getCalendarSources().size() == 1) {
vbox.getChildren().add(box);
} else {
replacedledPane replacedledPane = new replacedledPane();
replacedledPane.textProperty().bind(source.nameProperty());
replacedledPane.setContent(box);
vbox.getChildren().add(replacedledPane);
}
}
}
14
Source : AllDayViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected void entryIntervalChanged(CalendarEvent evt) {
Entry<?> entry = evt.getEntry();
/*
* We only care about full day entries in this view.
*/
if (!entry.isFullDay()) {
return;
}
removeEntryView(entry);
if (isRelevant(entry)) {
if (entry.isRecurring()) {
Calendar calendar = entry.getCalendar();
final Map<LocalDate, List<Entry<?>>> entriesMap = calendar.findEntries(getLoadStartDate(), getLoadEndDate(), getZoneId());
List<Entry<?>> entries = entriesMap.get(getSkinnable().getDate());
if (entries != null) {
for (Entry<?> e : entries) {
if (e.getId().equals(entry.getId())) {
addEntryView(e);
/*
* We only support recurrence for temporal units larger than days, so there can only
* be one entry.
*/
break;
}
}
}
} else {
addEntryView(entry);
}
}
}
14
Source : HelloWeekView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public Node getPanel(Stage stage) {
Calendar dirk = new Calendar("Dirk");
Calendar katja = new Calendar("Katja");
Calendar philip = new Calendar("Philip");
Calendar jule = new Calendar("Jule");
Calendar armin = new Calendar("Armin");
dirk.setStyle(Style.STYLE1);
katja.setStyle(Style.STYLE2);
philip.setStyle(Style.STYLE3);
jule.setStyle(Style.STYLE4);
armin.setStyle(Style.STYLE5);
CalendarSource calendarSource = new CalendarSource();
calendarSource.getCalendars().add(dirk);
calendarSource.getCalendars().add(katja);
calendarSource.getCalendars().add(philip);
calendarSource.getCalendars().add(jule);
calendarSource.getCalendars().add(armin);
weekView.getCalendarSources().setAll(calendarSource);
DayViewScrollPane scroll = new DayViewScrollPane(weekView, new ScrollBar());
scroll.setStyle("-fx-background-color: white;");
return scroll;
}
14
Source : HelloSourceGridView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected Node createControl() {
sourceView = new SourceGridView();
Calendar meetings = new Calendar("Meetings");
Calendar training = new Calendar("Training");
Calendar customers = new Calendar("Customers");
Calendar holidays = new Calendar("Holidays");
meetings.setStyle(Style.STYLE2);
training.setStyle(Style.STYLE3);
customers.setStyle(Style.STYLE4);
holidays.setStyle(Style.STYLE5);
CalendarSource workCalendarSource = new CalendarSource("Work");
workCalendarSource.getCalendars().addAll(meetings, training, customers, holidays);
Calendar birthdays = new Calendar("Birthdays");
Calendar katja = new Calendar("Katja");
Calendar dirk = new Calendar("Dirk");
Calendar philip = new Calendar("Philip");
Calendar jule = new Calendar("Jule");
Calendar armin = new Calendar("Armin");
CalendarSource familyCalendarSource = new CalendarSource("Family");
familyCalendarSource.getCalendars().addAll(birthdays, katja, dirk, philip, jule, armin);
sourceView.getCalendarSources().addAll(workCalendarSource, familyCalendarSource);
return sourceView;
}
14
Source : HelloSourceGridView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public Node getControlPanel() {
Node controlPanel = super.getControlPanel();
VBox vBox = new VBox();
vBox.setSpacing(5);
vBox.getChildren().add(controlPanel);
for (CalendarSource calendarSource : sourceView.getCalendarSources()) {
for (Calendar calendar : calendarSource.getCalendars()) {
CheckBox checkBox = new CheckBox(calendar.getName());
checkBox.selectedProperty().bindBidirectional(sourceView.getCalendarVisibilityProperty(calendar));
vBox.getChildren().add(checkBox);
}
}
return vBox;
}
14
Source : HelloGoogleEntryPopOverContentPane.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public void start(Stage primaryStage) throws Exception {
Calendar calendar = new Calendar();
calendar.setName("Google Calendar");
calendar.setStyle(Calendar.Style.STYLE2);
GoogleEntry entry = new GoogleEntry();
entry.setreplacedle("Google Entry");
entry.setCalendar(calendar);
entry.setLocation("Bogota");
ObservableList<Calendar> allCalendars = FXCollections.observableArrayList(calendar);
GoogleEntryPopOverContentPane pane = new GoogleEntryPopOverContentPane(entry, allCalendars);
primaryStage.setreplacedle("Google Calendar");
Scene scene = new Scene(pane, 400, 600);
scene.getStylesheets().add(CalendarView.clreplaced.getResource("calendar.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.sizeToScene();
primaryStage.centerOnScreen();
primaryStage.show();
}
13
Source : WeatherApp.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
public void start(Stage primaryStage) throws Exception {
Calendar zurich = new Calendar("Zurich");
CalendarSource calendarSource = new CalendarSource("Weather");
calendarSource.getCalendars().addAll(zurich);
MonthSheetView sheetView = new MonthSheetView();
sheetView.setPadding(new Insets(20));
sheetView.setCellFactory(param -> new WeatherCell(param.getView(), param.getDate()));
sheetView.getCalendarSources().setAll(calendarSource);
sheetView.setContextMenu(null);
Scene scene = new Scene(sheetView);
primaryStage.setreplacedle("Weather Calendar");
primaryStage.setScene(scene);
primaryStage.setWidth(1300);
primaryStage.setHeight(1000);
primaryStage.centerOnScreen();
primaryStage.show();
}
13
Source : SourceGridViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
private void build() {
List<Node> children = new ArrayList<>();
VBox row = null;
int count = 0;
final SourceGridView view = getSkinnable();
for (CalendarSource source : view.getCalendarSources()) {
for (Calendar calendar : source.getCalendars()) {
view.getCalendarVisibilityProperty(calendar).removeListener(buildWeakListener);
view.getCalendarVisibilityProperty(calendar).addListener(buildWeakListener);
if (!view.isCalendarVisible(calendar)) {
continue;
}
if (count == 0) {
row = new VBox();
row.getStyleClreplaced().add("column");
children.add(row);
}
row.getChildren().add(new CalendarItem(calendar));
count++;
if (count == view.getMaximumRowsPerColumn()) {
count = 0;
}
}
}
container.getChildren().setAll(children);
}
13
Source : AllDayEntryViewSkin.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
protected void updateView() {
final AllDayEntryView view = getSkinnable();
Entry<?> entry = view.getEntry();
Calendar calendar = entry.getCalendar();
if (calendar == null) {
return;
}
view.getStyleClreplaced().setAll("default-style-entry-small", calendar.getStyle() + "-entry-small", "default-style-entry-small-full-day", calendar.getStyle() + "-entry-small-full-day");
// replacedle style
replacedleLabel.getStyleClreplaced().setAll("default-style-entry-small-replacedle-label", calendar.getStyle() + "-entry-small-replacedle-label", "default-style-entry-small-replacedle-label-full-day", calendar.getStyle() + "-entry-small-replacedle-label-full-day");
replacedleLabel.setText(entry.getreplacedle());
view.getStyleClreplaced().add("default-style-entry-small-only");
view.getStyleClreplaced().addAll(entry.getStyleClreplaced());
}
13
Source : HelloCalendarHeaderView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected Node createControl() {
CalendarHeaderView calendarHeaderView = new CalendarHeaderView();
calendarHeaderView.setNumberOfDays(5);
calendarHeaderView.setMaxHeight(30);
Calendar dirk = new Calendar("Dirk");
Calendar katja = new Calendar("Katja");
Calendar philip = new Calendar("Philip");
Calendar jule = new Calendar("Jule");
Calendar armin = new Calendar("Armin");
dirk.setStyle(Style.STYLE1);
katja.setStyle(Style.STYLE1);
philip.setStyle(Style.STYLE2);
jule.setStyle(Style.STYLE1);
armin.setStyle(Style.STYLE3);
calendarHeaderView.getCalendars().add(dirk);
calendarHeaderView.getCalendars().add(katja);
calendarHeaderView.getCalendars().add(philip);
calendarHeaderView.getCalendars().add(jule);
calendarHeaderView.getCalendars().add(armin);
return calendarHeaderView;
}
13
Source : HelloPrintView.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected Node createControl() {
Calendar meetings = new Calendar("Meetings");
Calendar training = new Calendar("Training");
Calendar customers = new Calendar("Customers");
Calendar holidays = new Calendar("Holidays");
meetings.setStyle(Style.STYLE2);
training.setStyle(Style.STYLE3);
customers.setStyle(Style.STYLE4);
holidays.setStyle(Style.STYLE5);
CalendarSource workCalendarSource = new CalendarSource("Work");
workCalendarSource.getCalendars().addAll(meetings, training, customers, holidays);
Calendar birthdays = new Calendar("Birthdays");
Calendar katja = new Calendar("Katja");
Calendar dirk = new Calendar("Dirk");
Calendar philip = new Calendar("Philip");
CalendarSource familyCalendarSource = new CalendarSource("Family");
familyCalendarSource.getCalendars().addAll(birthdays, katja, dirk, philip);
Entry<String> meetings1 = new Entry<>("Meetings 1");
meetings1.setCalendar(meetings);
PrintView printView = new PrintView();
printView.setPrefWidth(1200);
printView.setPrefHeight(950);
printView.getCalendarSources().addAll(workCalendarSource, familyCalendarSource);
return printView;
}
13
Source : HelloDayPage.java
with Apache License 2.0
from dlsc-software-consulting-gmbh
with Apache License 2.0
from dlsc-software-consulting-gmbh
@Override
protected DateControl createControl() {
CalendarSource calendarSource = new CalendarSource("My Calendars");
final Calendar calendar = new Calendar("Calendar");
calendar.setShortName("C");
calendar.setStyle(Style.STYLE2);
calendarSource.getCalendars().add(calendar);
dayPage = new DayPage();
dayPage.getCalendarSources().add(calendarSource);
return dayPage;
}
See More Examples