public class VCalendar extends com.google.gwt.user.client.ui.Composite implements VHasDropHandler
Modifier and Type | Class and Description |
---|---|
static interface |
VCalendar.BackwardListener
Listener interface for listening to backward events
|
static interface |
VCalendar.DateClickListener
Listener interface for listening to event click events
|
static interface |
VCalendar.EventClickListener
Listener interface for listening to click events
|
static interface |
VCalendar.EventMovedListener
Listener interface for listening to event moved events.
|
static interface |
VCalendar.EventResizeListener
Listener interface for when an event gets resized (its start or end date
changes)
|
static interface |
VCalendar.ForwardListener
Listener interface for listening to forward events
|
static interface |
VCalendar.MouseEventListener
Listener interface for listening to mouse events.
|
static interface |
VCalendar.RangeSelectListener
Listener interface for listening to selection events
|
static interface |
VCalendar.ScrollListener
Listener interface for listening to scroll events.
|
static interface |
VCalendar.WeekClickListener
Listener interface for listening to week number click events
|
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_FIRSTDAYOFWEEK |
static String |
ATTR_FIRSTHOUROFDAY |
static String |
ATTR_LASTDAYOFWEEK |
static String |
ATTR_LASTHOUROFDAY |
protected com.google.gwt.i18n.client.DateTimeFormat |
dateformat_date |
protected com.google.gwt.i18n.client.DateTimeFormat |
dateformat_datetime |
protected com.google.gwt.i18n.client.DateTimeFormat |
time12format_date |
protected com.google.gwt.i18n.client.DateTimeFormat |
time24format_date |
Constructor and Description |
---|
VCalendar()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areDatesEqualToSecond(Date date1,
Date date2)
Are the dates equal (uses second resolution)
|
static int[] |
distributeSize(int totalSize,
int numberOfCells,
int sizeModifier)
Calculates correct size for all cells (size / amount of cells ) and
distributes any overflow over all the cells.
|
VCalendar.BackwardListener |
getBackwardListener()
Set the listener which listens to backward events from the calendar
|
VCalendar.DateClickListener |
getDateClickListener()
Gets the listener for listening to event clicks
|
com.google.gwt.i18n.client.DateTimeFormat |
getDateFormat()
Get the date format used to format dates only (excludes time)
|
com.google.gwt.i18n.client.DateTimeFormat |
getDateTimeFormat()
Get the date and time format to format the dates (includes both date and
time)
|
String[] |
getDayNames()
Get the names of the week days
|
CalendarDropHandler |
getDropHandler() |
VCalendar.EventClickListener |
getEventClickListener()
Get the listener that listens to the user clicking on the events
|
static Comparator<CalendarEvent> |
getEventComparator()
Returns a comparator which can compare calendar events.
|
VCalendar.EventMovedListener |
getEventMovedListener()
Get the listener that listens to when event is dragged to a new location
|
VCalendar.EventResizeListener |
getEventResizeListener()
Get the listener that listens to when an events time limits are being
adjusted
|
int |
getFirstDayNumber()
Get the number when a week starts
|
int |
getFirstHourOfTheDay()
Get the number when a week starts
|
VCalendar.ForwardListener |
getForwardListener()
Get the listener which listens to forward events from the calendar
|
int |
getLastDayNumber()
Get the number when a week ends
|
int |
getLastHourOfTheDay()
Get the number when a week ends
|
MonthGrid |
getMonthGrid()
Get the month grid component
|
String[] |
getMonthNames()
Get the month names
|
VCalendar.MouseEventListener |
getMouseEventListener()
Get the listener that listen to mouse events
|
VCalendar.RangeSelectListener |
getRangeSelectListener()
Get the listener that listens to the user highlighting a region in the
calendar
|
VCalendar.ScrollListener |
getScrollListener()
Get the listener that listens to when the calendar widget is scrolled
|
com.google.gwt.i18n.client.DateTimeFormat |
getTimeFormat()
Get the time format used to format time only (excludes date)
|
VCalendar.WeekClickListener |
getWeekClickListener()
Get the listener that listens to user clicking on the week numbers
|
WeekGrid |
getWeekGrid()
Get he week grid component
|
boolean |
is24HFormat()
Is the 24h time format used
|
boolean |
isBackwardNavigationEnabled() |
boolean |
isDisabled()
Is the component disabled
|
boolean |
isDisabledOrReadOnly()
Is the calendar either disabled or readonly
|
boolean |
isEventCaptionAsHtml()
Checks whether event captions are rendered as HTML
|
boolean |
isEventMoveAllowed()
Is moving an event allowed
|
boolean |
isEventResizeAllowed()
Is resizing an event allowed
|
boolean |
isForwardNavigationEnabled() |
static boolean |
isMidnight(Date date)
Is the date at midnight
|
boolean |
isRangeMoveAllowed()
Is moving a range allowed
|
boolean |
isRangeSelectAllowed()
Is selecting a range allowed?
|
boolean |
isReadOnly()
Is the component read-only
|
static boolean |
isZeroLengthMidnightEvent(CalendarEvent event)
Is the calendar event zero seconds long and is occurring at midnight
|
protected void |
recalculateHeights()
Recalculates the heights of the sub-components in the calendar
|
protected void |
recalculateWidths()
Recalculates the widths of the sub-components in the calendar
|
void |
removeMonthEvent(CalendarEvent target,
boolean repaintImmediately)
Remove a month event from the view
|
void |
set24HFormat(boolean format)
Should the 24h time format be used
|
void |
setBackwardNavigationEnabled(boolean enabled) |
void |
setDayNames(String[] names)
Set the names of the week days
|
void |
setDisabled(boolean disabled)
Is the component disabled
|
void |
setDropHandler(CalendarDropHandler dropHandler)
Set the drop handler
|
void |
setEventCaptionAsHtml(boolean eventCaptionAsHtml)
Sets whether the event captions are rendered as HTML.
|
void |
setEventMoveAllowed(boolean eventMoveAllowed)
Is moving an event allowed
|
void |
setEventResizeAllowed(boolean eventResizeAllowed)
Is resizing an event allowed
|
void |
setFirstDayNumber(int dayNumber)
Set the number when a week starts
|
void |
setFirstHourOfTheDay(int hour)
Set the number when a week starts
|
void |
setForwardNavigationEnabled(boolean enabled) |
void |
setLastDayNumber(int dayNumber)
Set the number when a week ends
|
void |
setLastHourOfTheDay(int hour)
Set the number when a week ends
|
void |
setListener(VCalendar.BackwardListener listener)
Set the listener which listens to backward events from the calendar
|
void |
setListener(VCalendar.DateClickListener listener)
Sets the listener for listening to event clicks
|
void |
setListener(VCalendar.EventClickListener listener)
Set the listener that listens to the user clicking on the events
|
void |
setListener(VCalendar.EventMovedListener eventMovedListener)
Set the listener that listens to when event is dragged to a new location
|
void |
setListener(VCalendar.EventResizeListener eventResizeListener)
Set the listener that listens to when an events time limits are being
adjusted
|
void |
setListener(VCalendar.ForwardListener listener)
Set the listener which listens to forward events from the calendar
|
void |
setListener(VCalendar.MouseEventListener mouseEventListener)
Set the listener that listen to mouse events
|
void |
setListener(VCalendar.RangeSelectListener listener)
Set the listener that listens to the user highlighting a region in the
calendar
|
void |
setListener(VCalendar.ScrollListener scrollListener)
Set the listener that listens to when the calendar widget is scrolled
|
void |
setListener(VCalendar.WeekClickListener listener)
Set the listener that listens to user clicking on the week numbers
|
void |
setMonthNames(String[] names)
Set the names of the months
|
void |
setRangeMoveAllowed(boolean rangeMoveAllowed)
Is moving a range allowed
|
void |
setRangeSelectAllowed(boolean rangeSelectAllowed)
Set selecting a range allowed
|
void |
setReadOnly(boolean readOnly)
Is the component read-only
|
void |
setSizeForChildren(int newWidth,
int newHeight) |
CalendarEvent[] |
sortEventsByDuration(Collection<CalendarEvent> events)
Sort the event by how long they are
|
void |
updateEventsToMonthGrid(Collection<CalendarEvent> events,
boolean drawImmediately)
Adds events to the month grid
|
void |
updateEventToMonthGrid(CalendarEvent changedEvent)
Updates an event in the month grid
|
void |
updateMonthGrid(int daysCount,
List<CalendarDay> days,
Date today)
Updates the events in the Month view
|
void |
updateMonthView(int firstDayOfWeek,
Date today,
int daysInMonth,
Collection<CalendarEvent> events,
List<CalendarDay> days)
Re-renders the whole month view
|
void |
updateWeekGrid(int daysCount,
List<CalendarDay> days,
Date today,
String[] realDayNames)
Re-render the week grid
|
void |
updateWeekView(int scroll,
Date today,
int daysInMonth,
int firstDayOfWeek,
Collection<CalendarEvent> events,
List<CalendarDay> days)
Re-renders the whole week view
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
public static final String ATTR_FIRSTDAYOFWEEK
public static final String ATTR_LASTDAYOFWEEK
public static final String ATTR_FIRSTHOUROFDAY
public static final String ATTR_LASTHOUROFDAY
protected final com.google.gwt.i18n.client.DateTimeFormat dateformat_datetime
protected final com.google.gwt.i18n.client.DateTimeFormat dateformat_date
protected final com.google.gwt.i18n.client.DateTimeFormat time12format_date
protected final com.google.gwt.i18n.client.DateTimeFormat time24format_date
public void updateEventsToMonthGrid(Collection<CalendarEvent> events, boolean drawImmediately)
events
- The events to adddrawImmediately
- Should the grid be rendered immediately. (currently not in
use)public void removeMonthEvent(CalendarEvent target, boolean repaintImmediately)
target
- The event to removerepaintImmediately
- Should we repaint after the event was removed?public void updateEventToMonthGrid(CalendarEvent changedEvent)
changedEvent
- The event that has changedpublic CalendarEvent[] sortEventsByDuration(Collection<CalendarEvent> events)
events
- The events to sortpublic void updateWeekGrid(int daysCount, List<CalendarDay> days, Date today, String[] realDayNames)
daysCount
- The amount of days to include in the weekdays
- The daystoday
- Todays daterealDayNames
- The names of the datespublic void updateMonthGrid(int daysCount, List<CalendarDay> days, Date today)
daysCount
- How many days there aredaysUidl
- today
- Todays datepublic void setSizeForChildren(int newWidth, int newHeight)
protected void recalculateHeights()
protected void recalculateWidths()
public com.google.gwt.i18n.client.DateTimeFormat getDateFormat()
public com.google.gwt.i18n.client.DateTimeFormat getTimeFormat()
public com.google.gwt.i18n.client.DateTimeFormat getDateTimeFormat()
public boolean isDisabledOrReadOnly()
public boolean isDisabled()
public void setDisabled(boolean disabled)
disabled
- True if disabledpublic boolean isReadOnly()
public void setReadOnly(boolean readOnly)
readOnly
- True if component is readonlypublic MonthGrid getMonthGrid()
public WeekGrid getWeekGrid()
public static int[] distributeSize(int totalSize, int numberOfCells, int sizeModifier)
totalSize
- the total amount of size reserved for all cellsnumberOfCells
- the number of cellssizeModifier
- a modifier which is applied to all cells before distributing
the overflowpublic static Comparator<CalendarEvent> getEventComparator()
public static boolean isMidnight(Date date)
date
- The date to checkpublic static boolean areDatesEqualToSecond(Date date1, Date date2)
date1
- The first the to comparedate2
- The second date to comparepublic static boolean isZeroLengthMidnightEvent(CalendarEvent event)
event
- The event to checkpublic void set24HFormat(boolean format)
format
- True if the 24h format should be used else the 12h format is
usedpublic boolean is24HFormat()
public void setDayNames(String[] names)
names
- The names of the days (Monday, Thursday,...)public String[] getDayNames()
public void setMonthNames(String[] names)
names
- The names of the months (January, February,...)public String[] getMonthNames()
public void setFirstDayNumber(int dayNumber)
dayNumber
- The number of the daypublic int getFirstDayNumber()
public void setLastDayNumber(int dayNumber)
dayNumber
- The number of the daypublic int getLastDayNumber()
public void setFirstHourOfTheDay(int hour)
dayNumber
- The number of the daypublic int getFirstHourOfTheDay()
public void setLastHourOfTheDay(int hour)
dayNumber
- The number of the daypublic int getLastHourOfTheDay()
public void updateWeekView(int scroll, Date today, int daysInMonth, int firstDayOfWeek, Collection<CalendarEvent> events, List<CalendarDay> days)
scroll
- The amount of pixels to scroll the week viewtoday
- Todays datedaysInMonth
- How many days are there in the monthfirstDayOfWeek
- The first day of the weekevents
- The events to renderpublic void updateMonthView(int firstDayOfWeek, Date today, int daysInMonth, Collection<CalendarEvent> events, List<CalendarDay> days)
firstDayOfWeek
- The first day of the weektoday
- Todays datedaysInMonth
- Amount of days in the monthevents
- The events to renderdays
- The day informationpublic void setListener(VCalendar.DateClickListener listener)
listener
- The listener to usepublic VCalendar.DateClickListener getDateClickListener()
public void setListener(VCalendar.ForwardListener listener)
listener
- The listener to usepublic VCalendar.ForwardListener getForwardListener()
public void setListener(VCalendar.BackwardListener listener)
listener
- The listener to usepublic VCalendar.BackwardListener getBackwardListener()
public void setListener(VCalendar.WeekClickListener listener)
listener
- The listener to usepublic VCalendar.WeekClickListener getWeekClickListener()
public void setListener(VCalendar.RangeSelectListener listener)
listener
- The listener to usepublic VCalendar.RangeSelectListener getRangeSelectListener()
public VCalendar.EventClickListener getEventClickListener()
public void setListener(VCalendar.EventClickListener listener)
listener
- The listener to usepublic VCalendar.EventMovedListener getEventMovedListener()
public void setListener(VCalendar.EventMovedListener eventMovedListener)
eventMovedListener
- The listener to usepublic VCalendar.ScrollListener getScrollListener()
public void setListener(VCalendar.ScrollListener scrollListener)
scrollListener
- The listener to usepublic VCalendar.EventResizeListener getEventResizeListener()
public void setListener(VCalendar.EventResizeListener eventResizeListener)
eventResizeListener
- The listener to usepublic VCalendar.MouseEventListener getMouseEventListener()
public void setListener(VCalendar.MouseEventListener mouseEventListener)
mouseEventListener
- The listener to usepublic boolean isRangeSelectAllowed()
public void setRangeSelectAllowed(boolean rangeSelectAllowed)
rangeSelectAllowed
- Should selecting a range be allowedpublic boolean isRangeMoveAllowed()
public void setRangeMoveAllowed(boolean rangeMoveAllowed)
rangeMoveAllowed
- Is it allowedpublic boolean isEventResizeAllowed()
public void setEventResizeAllowed(boolean eventResizeAllowed)
eventResizeAllowed
- True if allowed false if notpublic boolean isEventMoveAllowed()
public void setEventMoveAllowed(boolean eventMoveAllowed)
eventMoveAllowed
- True if moving is allowed, false if notpublic boolean isBackwardNavigationEnabled()
public void setBackwardNavigationEnabled(boolean enabled)
public boolean isForwardNavigationEnabled()
public void setForwardNavigationEnabled(boolean enabled)
public CalendarDropHandler getDropHandler()
getDropHandler
in interface VHasDropHandler
public void setDropHandler(CalendarDropHandler dropHandler)
dropHandler
- The drophandler to usepublic void setEventCaptionAsHtml(boolean eventCaptionAsHtml)
If set to true, the captions are rendered in the browser as HTML and the developer is responsible for ensuring no harmful HTML is used. If set to false, the caption is rendered in the browser as plain text.
The default is false, i.e. to render that caption as plain text.
captionAsHtml
- true if the captions are rendered as HTML, false if rendered
as plain textpublic boolean isEventCaptionAsHtml()
The default is false, i.e. to render that caption as plain text.
Copyright © 2019 Vaadin Ltd. All rights reserved.