public interface BBjCalendarWidget
BBjCalendarWidget
is a BBj Interface that serves as a plug-in to the
FullCalendar JavaScript-based calendar control.
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
THROW
n Error Codes:
500
: The calendar is not ready for interaction. Setting a callback for the
CalendarAPI.ON_CALENDAR_READY
event
will result in your application getting a CalendarReadyEvent
event signaling that the calendar is ready for interaction.510
: Invalid theme specified. The specified theme file does not exist.
See the getThemes()
method for more
information on installing and getting valid theme names.512
: Invalid parameter. The parameter provided to a method is null() or invalid. The error message may indicate which method call failed.514
: Invalid configuration. The specified object has not been configured correctly or is missing required properties.530
: Invalid date or time specified. The specified date or time string is not valid or cannot be parsed.700
: Missing file. The specified file does not exist. This may occur when the library attempts to read in an HTML, CSS, JavaScript, or theme file.Modifier and Type | Method and Description |
---|---|
void | addEntries(JsonArray entries!) Adds several JsonObject entries in a JsonArray to the calendar at once for improved performance.
Note: Adding multiple entries to the calendar via this method will not trigger the
|
void | addEntries(BBjVector entries!) Adds several entries of type
Note: Adding multiple entries to the calendar via this method will not trigger the
|
void | addEntry(JsonObject entry!) Adds an entry to the calendar given a JsonObject representation of the calendar entry.
Note: Adding entries to the calendar via this method will trigger the
|
void | addEntry(CalendarEntry entry!) Adds an entry to the calendar given a
Note: Adding entries to the calendar via this method will trigger the
|
void | addEntrySource(CalendarEntrySource entrySource!) Adds entries to the calendar from a |
boolean | addStyle(BBjString style!) Adds the provided CSS style name to the widget. |
void | clearCallback(BBjNumber event!) Removes the callback given the callback number. |
void | clearStyles() Clears all the CSS styles from the widget. |
void | consoleLog(BBjString msg!) Logs the provided string to the browser's console for debugging purposes regardless of whether the EnableDebug option has been set. If you provide a simple string, like " then you'll see an entry in the console that looks like " Note: If you provide a static string with single quotes, then you can print out JavaScript objects if they're not enclosed in the single quotes. For example, calling the method with the string " (note the single quotes) results in the following message being printed in the console: " In other words, if you supply single quotes then the entire parameter is applied to the |
static BBjVector | convertEntriesArrayToBBjVector(JsonArray entries!) A utility method that converts a JSON array of calendar entries, such as what's received from the JavaScript code, into a BBjVector filled with CalendarEntry objects. |
static BBjVector | convertEntriesArrayToBBjVector(BBjString entries!) A utility method that converts a stringified JSON array of calendar entries, such as what's received
from the JavaScript code, into a BBjVector filled with |
static JsonArray | convertEntriesBBjVectorToJsonArray(BBjVector entries!) A utility method that converts a BBjVector filled with |
void | debugLog(BBjString msg!) Logs a debug string to the browser's console for debugging purposes if the EnableDebug option has been set. This method is used
internally by the BBjCalendarWidget and may also be used in your applications. To always log information to the console
regardless of whether the EnableDebug option has been set, use the If you provide a simple string, like " then you'll see an entry in the console that looks like " Note: If you provide a static string with single quotes, then you can print out JavaScript objects if they're not enclosed in the single quotes. For example, calling the method with the string " (note the single quotes) results in the following message being printed in the console: " In other words, if you supply single quotes then the entire parameter is applied to the |
Object | executeScript(BBjString script!) Executes the provided JavaScript via the BBjJavaScriptExecutor class which results in a debounced execution, which
is useful when you don't need the return value from the script and the script can be batched with other scripts. If you
need the return value from the script, then you need to call the
Note: The executor handles JSNI automatically so you don't have to check for BUI and adjust the window and document JavaScript objects. If the BBjHtmlView is not ready yet then the script will be queued. After the BBjHtmlView control is ready then the executor will execute it on the client. |
Object | executeScriptImmediately(BBjString script!) Executes the provided JavaScript immediately via the BBjJavaScriptExecutor class without debouncing, which is necessary when you need the return value from the script. Note: The executor handles JSNI automatically so you don't have to check for BUI and adjust the window and document JavaScript objects. If the BBjHtmlView is not ready then this method will throw an error 500. Setting a callback for the
|
BBjColor | getBackColor() Returns the background color of the calendar's containing window. |
static JsonArray | getBBjVectorAsJsonArray(BBjVector vector!) A utility method that returns a JSON array version of the supplied BBjVector. |
int | getControlType() Returns the unique control type for the |
BBjString | getDate() Returns the calendar's currently selected date. |
BBjString | getDateAsISOString() Returns the calendar's currently selected date in ISO format. |
BBjNumber | getEnableDebug() Returns whether the |
BBjVector | getEntries() Returns all of the calendar's entries as a BBjVector of |
JsonArray | getEntriesAsJsonArray() Returns all of the calendar's entries as a JsonArray of JsonObject events. |
BBjVector | getEntriesWithTag(BBjString tag!) Returns all of the calendar's entries as a BBjVector of |
BBjVector | getEntriesWithTags(BBjVector tags!) Returns all of the calendar's entries as a BBjVector of |
BBjVector | getEntrySourceIds() Returns a BBjVector filled with IDs for all the |
BBjString | getEventDescription(BBjNumber eventNumber!) A utility method that returns a descriptive string given an event number based on the |
BBjNumber | getHeight() Returns the widget's height. |
BBjVector | getHiddenTags() Returns a BBjVector filled with optional custom tags that were previously set with the setHiddenTags() method and determine which calendar entries should be hidden. When dealing with entry tags, there are three sets to be aware of:
Note: If the Note: You will typically affect the calendar's entry visibility by calling either the setVisibleTags() or setHiddenTags() methods, but not both. |
BBjHtmlView | getHtmlView() Returns the underlying BBjHtmlView control that contains the JavaScript FullCalendar. |
BBjImage | getImage() Returns a BBjImage screenshot of the |
BBjNumber | getIsReady() Returns a BBjNumber acting as a boolean that indicates whether the widget is ready to be interacted with (1) or not (0). |
static BBjVector | getJsonArrayAsBBjVector(JsonArray array!) A utility method that returns a BBjVector version of the supplied JSON array. |
static BBjString | getJsonObjectAsFormattedString(JsonObject json!) A utility method that returns a formatted, or pretty-printed version of the supplied JSON object sorted alphabetically by key. |
BBjNumber | getLocalTimeZoneOffsetFromUtc() Returns the difference between the client's local time and UTC in minutes. For example, if your time zone is UTC+10, then -600 will be returned because UTC is 600 minutes behind the local time zone. Another way to view it is that the return value is the number of minutes that should be added to the local time in order to find UTC. Note that daylight savings time prevents this value from being a constant. |
String | getName() Returns the widget's name as previously-set via the |
CalendarOptions | getOptions() Returns the calendar's current options in an instance of the |
JsonObject | getOptionsAsJsonObject() Returns the calendar's options as a JsonObject. |
BBjString | getStyle(BBjString property!) Returns the value of the specified CSS property. |
BBjVector | getStyles() Returns the widget's name as previously-set via the |
static BBjVector | getThemes() Returns all of the calendar's available themes as an alphabetized list in a BBjVector filled with the theme names.
After determining which themes are available, you can call the
Note that the installed themes are located in the BBjCalendarWidget's |
Object | getUserData() Returns the custom object that was previously associated with the widget by calling the |
BBjString | getUuid() Returns a unique auto-generated ID for the calendar instance that may be used to distinguish between instances of the class. |
BBjString | getValidDateString(BBjString dateString!) Returns a date string formatted as YYYY-MM-DD if the provided date string can be parsed into a valid date, or null() if the date string is invalid.
Note: An ISO 8601 formatted date/time string (
Additionally, since the method uses JavaScript when parsing dates, the success is dependant on the browser's JavaScript implementation. For example, at the time of
this writing, Chrome can parse ambiguous dates like |
BBjString | getValidDateTimeString(BBjString dateTimeString!) Returns an ISO 8601 formatted date/time string if the provided date/time string can be parsed into a valid date, or null() if it can't be parsed.
Note: An ISO 8601 formatted date/time string (
Additionally, since the method uses JavaScript when parsing dates, the success is dependant on the browser's JavaScript implementation. For example, at the time of
this writing, Chrome can parse ambiguous dates like |
BBjString | getValidTimeString(BBjString timeString!) Returns a time string formatted as HH:MM:SS using 24-hour format if the provided time string can be parsed into a valid time, or null() if the time string is invalid.
Note: An ISO 8601 formatted date/time string (
Additionally, since the method uses JavaScript when parsing dates, the success is dependant on the browser's JavaScript implementation. For example, at the time of
this writing, Chrome can parse ambiguous dates like |
BBjString | getViewType() Returns the calendar's view type which will be one of the following constants:
|
BBjVector | getVisibleTags() Returns a BBjVector filled with optional custom tags that were previously set with the setVisibleTags() method and determine which calendar entries should be displayed. When dealing with entry tags, there are three sets to be aware of:
Note: If the Note: You will typically affect the calendar's entry visibility by calling either the setVisibleTags() or setHiddenTags() methods, but not both. |
BBjNumber | getWidth() Returns the widget's width. |
BBjNumber | getX() Returns the widget's X coordinate, or horizontal position. |
BBjNumber | getY() Returns the widget's Y coordinate, or vertical position. |
void | injectCss(BBjString css!) Injects the provided CSS string into the
This method provides a simple way to add custom CSS that affects the calendar. For more advanced use cases, see the
|
void | injectCss(BBjString css!, BBjString location!, BBjString description!, BBjNumber removePrevious!) Injects the provided CSS string into the |
void | injectCssFile(BBjString cssPath!) Injects the CSS contained in the specified file into the |
void | injectScript(BBjString script!) Injects the provided JavaScript string at the top-level window. |
void | injectScriptFile(BBjString scriptPath!) Injects the JavaScript contained in the specified script file into the top-level window. This is a convenience method that reads in the contents of the provided JavaScript file and injects it into the HtmlView control that contains the calendar. |
void | injectUrl(BBjString url!) Injects the specified JavaScript URL into the HTML DOM, making it available for subsequent use by client-side JavaScript. |
boolean | isEnabled() Returns whether the widget is enabled or disabled. |
boolean | isVisible() Returns whether the widget is visible or hidden. |
void | navigateDate(BBjString date!) Navigates the calendar programmatically to the specified date. To ensure the calendar navigates to the correct date, the provided
date should be in the ISO 8601 format. However, this method attempts to parse ambiguous dates and is often able to construct
a date in the format
If the provided string is ambiguous, there are no guarantees that the method will be able to resolve the date/time string correctly.
The success of this method depends on the format of the supplied date/time string and the client's browser. For example, a date of
Additionally, since the method uses JavaScript when parsing dates and time, the success is dependant on the browser's JavaScript implementation.
For example, at the time of this writing, Chrome can parse ambiguous dates like
The date string should ideally be in the |
void | navigateNext() Navigates the calendar programmatically one step forward (by a month or week for example), and is the same as the user clicking on the 'next' toolbar button. The amount of time moved depends on the current view type. |
void | navigateNextYear() Navigates the calendar programmatically forward one year, and is the same as the user clicking on the 'nextYear' toolbar button. |
void | navigatePrev() Navigates the calendar programmatically one step back (by a month or week for example), and is the same as the user clicking on the 'prev' toolbar button. The amount of time moved depends on the current view type. |
void | navigatePrevYear() Navigates the calendar programmatically back one year, and is the same as the user clicking on the 'prevYear' toolbar button. |
void | navigateTime(BBjString time!) Navigates the calendar programmatically to the specified time. To ensure the calendar navigates to the correct time, the provided
time should be in the ISO 8601 format or
If the provided string is ambiguous, there are no guarantees that the method will be able to resolve the date/time string correctly.
The success of this method depends on the format of the supplied date/time string and the client's browser. For example, a date of
Additionally, since the method uses JavaScript when parsing dates and time, the success is dependant on the browser's JavaScript implementation.
For example, at the time of this writing, Chrome can parse ambiguous dates like The time string should ideally be in one of the following formats.
|
void | navigateToday() Navigates the calendar programmatically to the current date, and is the same as the user clicking on the 'today' toolbar button. |
static BBjNumber | ON_CALENDAR_DATE_CLICK() A constant value that's used with the
Note that
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_DATES_SET() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_DROP() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRIES_SET() A constant value that's used with the
When responding to this event, the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_ADD() A constant value that's used with the Note: If you set a callback for this event, then add several events to the calendar, your callback routine may be flooded.
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_CHANGE() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_CLICK() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_DRAG_START() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_DRAG_STOP() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_DROP() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_LEAVE() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_MOUSE_ENTER() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_MOUSE_LEAVE() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_RECEIVE() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_REMOVE() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_ENTRY_RESIZE() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_RESIZE_START() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_RESIZE_STOP() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_SOURCE_FAILURE() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_ENTRY_SOURCE_SUCCESS() A constant value that's used with the |
static BBjNumber | ON_CALENDAR_READY() A constant value that's used with the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_SELECT() A constant value that's used with the
Note: You must configure the calendar to enable user selections via the
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_UNSELECT() A constant value that's used with the
Note: You must configure the calendar to enable user selections via the A selection might be cleared for a number of reasons:
The
Setting a callback for this event type will result in your application getting a |
static BBjNumber | ON_CALENDAR_VIEW_CHANGE() A constant value that's used with the
Note: This only fires when the type of view changes, not when the user changes the view from one subtype to another. For example,
the event will be triggered when the user switches from the
|
void | onNativeEvent(BBjNativeJavaScriptEvent ev!) An internal event handler for native JavaScript events from the BBjHtmlView control that converts a JavaScript calendar event to a BBj callback event. |
void | redraw(BBjNumber shouldCreate!) Initially draws or redraws the widget whenever it needs to be rendered.
Your application code won't ever have to call this method under normal conditions. It's typically only used internally
to redraw the calendar after the the |
void | refetchAllEntries() Causes the calendar to refetch entries from all sources and rerender. If you've previously added events to the calendar from a remote source, such as a web service or Google Calendar, then the calendar will requery those sources for an updated entry set. If the entries on the backend have changed, such as some entries have been added and others deleted, then those changes will be reflected on the calendar after calling this method. |
void | refetchAllEntrySources() Refetches all |
void | refetchEntrySource(BBjString id!) Refetches the |
BBjNumber | removeAllEntries() Removes all the entries in the calendar.
Note: Removing entries from the calendar via this method will trigger the
|
BBjNumber | removeAllEntrySources() Removes all |
BBjNumber | removeEntries(BBjVector entries!) Removes all the entries contained in the BBjVector from the calendar.
Note: Removing entries from the calendar via this method will trigger the
|
BBjNumber | removeEntry(CalendarEntry entry!) Removes an entry from the calendar. |
BBjNumber | removeEntryById(BBjString id!) Removes an entry from the calendar given its optional unique ID which must have previously been set. |
void | removeEntrySource(BBjString id!) Removes a |
boolean | removeStyle(BBjString style!) Removes the provided CSS style name from the widget. |
void | render() Renders the calendar inside the HtmlView and applies the current calendar options.
This composes the calendar configuration and sends it to the client for a full rerendering. This is the
difference between the You can call this method to force the calendar to be updated after you modify its setup configuration, as in:
Note: You don't have to call the |
void | saveAsPngImage(BBjString path!) Saves a BBjImage screenshot of the |
void | setBackColor(BBjColor backColor!) Sets the background color of the calendar's containing window. |
void | setCallback(BBjNumber event!, BBjString callback!) Registers a callback in a procedural program for the provided event type. These are the valid callback event type options:
Note: Callbacks associated with dragging/dropping calendar entries between two different calendars has not yet been implemented. |
void | setCallback(BBjNumber event!, CustomObject instance!, BBjString method!) Registers a callback in an object-oriented program for the provided event type. These are the valid callback event type options:
Note: Callbacks associated with dragging/dropping calendar entries between two different calendars has not yet been implemented. |
void | setEnabled(boolean enabled!) Sets whether the widget should be enabled. |
void | setEnableDebug(BBjNumber enableDebug) Sets whether the
When this is set to true (1), the
|
void | setHiddenTags(BBjString tags!) Sets one or more optional, custom tags that determine which calendar
entries should be hidden. The
This is similar to the |
void | setHiddenTags(BBjVector tags!) Sets one or more optional, custom tags that determine which calendar
entries should be hidden. The |
void | setLocation(BBjNumber x!, BBjNumber y!) Sets the location of the calendar widget given the provided X and Y coordinates. |
void | setName(BBjString name!) Sets the widget's name, which can later be retrieved via the |
void | setOptions(CalendarOptions options!) Sets the calendar's options given an instance of the
Note: After setting the calendar's options inline (see example #1 below), you will need to call the calendar's There are a couple of ways to set options for the calendar:
|
void | setPadding(BBjNumber padding!) Sets the padding, or spacing around the calendar control, to the same number of pixels for all four sides. Using the default index.html template, the calendar is contained within the DIV that has the class 'BBjCalendarWidgetContainer'. This method modifies the CSS for the container DIV by setting its padding to the provided padding size in pixels. |
void | setPadding(BBjNumber paddingTop!, BBjNumber paddingRight!, BBjNumber paddingBottom!, BBjNumber paddingLeft!) Sets the padding, or spacing around the calendar control, to the specified number of pixels for the top, right, bottom, and left sides. Using the default index.html template, the calendar is contained within the DIV that has the class 'BBjCalendarWidgetContainer'. This method modifies the CSS for the container DIV by setting its padding to the provided padding size in pixels. |
void | setSize(BBjNumber width!, BBjNumber height!) Sets the size of the calendar widget given the provided width and height. |
void | setStyle(BBjString property!, BBjString style!) Sets a CSS property on the widget. |
void | setTheme(BBjString theme!) Sets the calendar's theme to one of the installed Boostrap themes, which modifies the calendar's fonts and color scheme.
To determine which themes are available, you can call the
Note that the installed themes are located in the BBjCalendarWidget's |
void | setUserData(Object userData!) Sets a custom, arbitrary object to be associated with the widget which can be retrieved later via the |
void | setViewType(BBjString viewType!) Sets the calendar's view type.
Note: Calling this method causes the calendar to change its view, which then results in a
The provided view type should be one of the following constants:
|
void | setVisible(boolean visible!) Sets whether the widget should be visible or hidden. |
void | setVisibleTags(BBjString tags!) Sets one or more optional, custom tags that determine which calendar
entries should be displayed. The
This is similar to the |
void | setVisibleTags(BBjVector tags!) Sets one or more optional, custom tags that determine which calendar
entries should be displayed. The |
void | suppressBuiDebouncing(BBjNumber suppress!) Supresses JavaScript debouncing for BUI. Setting this to "0" may help to improve the communication performance between BBj and the calendar in the BBjHtmlViewControl when running in BUI. |
void | suppressDebouncing(BBjNumber suppress!) Supressesss JavaScript debouncing for both GUI and BUI. |
void | suppressGuiDebouncing(BBjNumber suppress!) Supresses JavaScript debouncing when running in GUI. Setting this to "0" may help to improve the communication performance between BBj and the calendar in the BBjHtmlViewControl when running in GUI. |
void | updateEntries(JsonArray entries!) Updates several JsonObject entries in a JsonArray to the calendar at once for improved performance.
This method iterates through the |
void | updateEntries(BBjVector entries!) Updates several entries of type
This method iterates through the |
void | updateEntry(CalendarEntry entry!) Updates an entry in the calendar.
This method uses the |
void | updateSize() Forces the calendar to resize itself based on the available space in the container DIV. Using the default index.html template, the calendar is contained within the DIV that has the class 'BBjCalendarWidgetContainer'. Whenever you modify the container DIV in such a way that it affects the calendar's size, such as dynamically changing its margin CSS, you may want to call this method afterwards to cause the calendar to adjust to the new container size. Note: If you call one of the setPadding() methods then this will be executed automatically after the padding has been added to the container DIV, so this method isn't likely to be needed very often. |
public void addEntries(JsonArray entries!)
Adds several JsonObject entries in a JsonArray to the calendar at once for improved performance.
Note: Adding multiple entries to the calendar via this method will not trigger the
CalendarAPI.ON_CALENDAR_ENTRY_ADD()
event.
JsonArray
entries! A JsonArray filled with JSON objects to be added to the calendar.public void addEntries(BBjVector entries!)
Adds several entries of type CalendarEntry
to the calendar at once for improved performance.
Note: Adding multiple entries to the calendar via this method will not trigger the
CalendarAPI.ON_CALENDAR_ENTRY_ADD()
event.
BBjVector
entries! A BBjVector filled with CalendarEntry
objects to be added to the calendar.public void addEntry(JsonObject entry!)
Adds an entry to the calendar given a JsonObject representation of the calendar entry.
Note: Adding entries to the calendar via this method will trigger the
CalendarAPI.ON_CALENDAR_ENTRY_ADD()
event.
JsonObject
entry! The entry to be added to the calendar.public void addEntry(CalendarEntry entry!)
Adds an entry to the calendar given a CalendarEntry
object.
Note: Adding entries to the calendar via this method will trigger the
CalendarAPI.ON_CALENDAR_ENTRY_ADD()
event.
CalendarEntry
entry! The CalendarEntry
to be added to the calendar.public void addEntrySource(CalendarEntrySource entrySource!)
Adds entries to the calendar from a CalendarEntrySource
.
CalendarEntrySource
entrySource! A previously-defined CalendarEntrySource
.public boolean addStyle(BBjString style!)
Adds the provided CSS style name to the widget.
BBjString
style! The CSS style name to add to the widget.public void clearCallback(BBjNumber event!)
Removes the callback given the callback number.
BBjNumber
event! The event number which is one of the CalendarAPI.ON_CALENDAR_*
constants.public void clearStyles()
Clears all the CSS styles from the widget.
public void consoleLog(BBjString msg!)
Logs the provided string to the browser's console for debugging purposes regardless of whether the EnableDebug option has been set.
If you provide a simple string, like
"Got Here!
"
then you'll see an entry in the console that looks like
"BBjCalendarWidget Debug: Got Here!
"
Note: If you provide a static string with single quotes, then you can print out JavaScript objects if they're not enclosed in the single quotes. For example, calling the method with the string
"'Calendar View: ', window.calendar.view.type
"
(note the single quotes) results in the following message being printed in the console:
"BBjCalendarWidget Debug: Calendar View: timeGridWeek
".
In other words, if you supply single quotes then the entire parameter is applied to the console.log()
JavaScript function without any modifications.
BBj 21.12
public static BBjVector convertEntriesArrayToBBjVector(JsonArray entries!)
A utility method that converts a JSON array of calendar entries, such as what's received from the JavaScript code, into a BBjVector filled with CalendarEntry objects.
JsonArray
entries! A JsonArray of calendar entries.CalendarEntry
objects.public static BBjVector convertEntriesArrayToBBjVector(BBjString entries!)
A utility method that converts a stringified JSON array of calendar entries, such as what's received
from the JavaScript code, into a BBjVector filled with CalendarEntry
objects.
BBjString
entries! A stringified JSON array of calendar entries.CalendarEntry
objects.public static JsonArray convertEntriesBBjVectorToJsonArray(BBjVector entries!)
A utility method that converts a BBjVector filled with CalendarEntry
object to a JSON array of calendar entries.
BBjVector
entries! A BBjVector filled with CalendarEntry
objects.public void debugLog(BBjString msg!)
Logs a debug string to the browser's console for debugging purposes if the EnableDebug option has been set. This method is used
internally by the BBjCalendarWidget and may also be used in your applications. To always log information to the console
regardless of whether the EnableDebug option has been set, use the consoleLog()
method instead.
If you provide a simple string, like
"Got Here!
"
then you'll see an entry in the console that looks like
"BBjCalendarWidget Debug: Got Here!
"
Note: If you provide a static string with single quotes, then you can print out JavaScript objects if they're not enclosed in the single quotes. For example, calling the method with the string
"'Calendar View: ', window.calendar.view.type
"
(note the single quotes) results in the following message being printed in the console:
"BBjCalendarWidget Debug: Calendar View: timeGridWeek
".
In other words, if you supply single quotes then the entire parameter is applied to the console.log()
JavaScript function without any modifications.
public Object executeScript(BBjString script!)
Executes the provided JavaScript via the BBjJavaScriptExecutor class which results in a debounced execution, which
is useful when you don't need the return value from the script and the script can be batched with other scripts. If you
need the return value from the script, then you need to call the
executeScriptImmediately()
method instead.
Note: The executor handles JSNI automatically so you don't have to check for BUI and adjust the window and document JavaScript objects.
If the BBjHtmlView is not ready yet then the script will be queued. After the BBjHtmlView control is ready then the executor will execute it on the client.
BBjString
script$ The JavaScript code to execute.public Object executeScriptImmediately(BBjString script!)
Executes the provided JavaScript immediately via the BBjJavaScriptExecutor class without debouncing, which is necessary when you need the return value from the script.
Note: The executor handles JSNI automatically so you don't have to check for BUI and adjust the window and document JavaScript objects.
If the BBjHtmlView is not ready then this method will throw an error 500. Setting a callback for the
CalendarAPI.ON_CALENDAR_READY
will result in your application getting a CalendarReadyEvent
event signaling that the calendar is ready for interaction.
BBjString
script$ The JavaScript code to execute.public BBjColor getBackColor()
Returns the background color of the calendar's containing window.
public static JsonArray getBBjVectorAsJsonArray(BBjVector vector!)
A utility method that returns a JSON array version of the supplied BBjVector.
BBjVector
vector! The BBjVector to be converted to a JSON array.public int getControlType()
Returns the unique control type for the BBjCalendarWidget
, which is 65050.
public BBjString getDate()
Returns the calendar's currently selected date.
public BBjString getDateAsISOString()
Returns the calendar's currently selected date in ISO format.
Date and Time Formats for information on ISO 8601 date/time formats.
public BBjNumber getEnableDebug()
Returns whether the BBjCalendarWidget
should run in debug mode (1) or not (0).
BBjCalendarWidget
is running in debug mode.public BBjVector getEntries()
Returns all of the calendar's entries as a BBjVector of CalendarEntry
objects.
CalendarEntry
objects for all the events in the calendar. BBjVector
public JsonArray getEntriesAsJsonArray()
Returns all of the calendar's entries as a JsonArray of JsonObject events.
public BBjVector getEntriesWithTag(BBjString tag!)
Returns all of the calendar's entries as a BBjVector of CalendarEntry
objects.
CalendarEntry
objects for all the events in the calendar. BBjVector
public BBjVector getEntriesWithTags(BBjVector tags!)
Returns all of the calendar's entries as a BBjVector of CalendarEntry
objects.
CalendarEntry
objects for all the events in the calendar. BBjVector
public BBjVector getEntrySourceIds()
Returns a BBjVector filled with IDs for all the CalendarEntrySource
objects that have previously been added to the calendar via the addEntrySource()
method.
CalendarEntrySource
object IDs that have previously been added to the calendar, or null() if none have been added.public BBjString getEventDescription(BBjNumber eventNumber!)
A utility method that returns a descriptive string given an event number based on the CalendarAPI.ON_CALENDAR_*
callback constants.
BBjNumber
eventNumber! The event number that is one of the CalendarAPI.ON_CALENDAR_*
callback constants.public BBjNumber getHeight()
Returns the widget's height.
public BBjVector getHiddenTags()
Returns a BBjVector filled with optional custom tags that were previously set with the setHiddenTags() method and determine which calendar entries should be hidden.
When dealing with entry tags, there are three sets to be aware of:
CalendarEntry
custom class offers setTags() methods that give you the opportunity to add custom tags to any entry.BBjCalendarWidget::setVisibleTags()
methods allow you to set which entries will be visible in the calendar, as any entries that share a tag with the visible tag set will be displayed normally.BBjCalendarWidget::setHiddenTags()
methods allow you to set which entries will be hidden in the calendar, as any entries that share a tag with the hidden tag set will be be hidden from view.
Note: If the BBjCalendarWidget
's set of visible tags is empty then all calendar entries will be visible.
If the BBjCalendarWidget
's set of hidden tags is empty then all calendar entries will be visible.
Note: You will typically affect the calendar's entry visibility by calling either the setVisibleTags() or setHiddenTags() methods, but not both.
BBjCalendarWidget::setVisibleTags()
methods. BBjVector
public BBjHtmlView getHtmlView()
Returns the underlying BBjHtmlView control that contains the JavaScript FullCalendar.
BBjHtmlView for more information on the BBjHtmlView control.
public BBjImage getImage()
Returns a BBjImage screenshot of the BBjCalendarWidget
.
BBjImage
public BBjNumber getIsReady()
Returns a BBjNumber acting as a boolean that indicates whether the widget is ready to be interacted with (1) or not (0).
public static BBjVector getJsonArrayAsBBjVector(JsonArray array!)
A utility method that returns a BBjVector version of the supplied JSON array.
JsonArray
array! The JSON array to be converted to a BBjVector.public static BBjString getJsonObjectAsFormattedString(JsonObject json!)
A utility method that returns a formatted, or pretty-printed version of the supplied JSON object sorted alphabetically by key.
JsonObject
json! The JSON object to be formatted.public BBjNumber getLocalTimeZoneOffsetFromUtc()
Returns the difference between the client's local time and UTC in minutes. For example, if your time zone is UTC+10, then -600 will be returned because UTC is 600 minutes behind the local time zone. Another way to view it is that the return value is the number of minutes that should be added to the local time in order to find UTC. Note that daylight savings time prevents this value from being a constant.
BBj 22.00
public String getName()
Returns the widget's name as previously-set via the setName()
method.
public CalendarOptions getOptions()
Returns the calendar's current options in an instance of the CalendarOptions
class.
public JsonObject getOptionsAsJsonObject()
Returns the calendar's options as a JsonObject.
JsonObject for information about an object in JSON format.
public BBjString getStyle(BBjString property!)
Returns the value of the specified CSS property.
BBjString
property! The CSS property name to get the value of.public BBjVector getStyles()
Returns the widget's name as previously-set via the setName()
method.
public static BBjVector getThemes()
Returns all of the calendar's available themes as an alphabetized list in a BBjVector filled with the theme names.
After determining which themes are available, you can call the setTheme()
method specifying any of the theme names in the return vector to change the calendar's theme.
Note that the installed themes are located in the BBjCalendarWidget's lib/bootstrap/themes/
directory. The installed themes
are free Bootstrap themes from https://bootswatch.com/
, although free
Bootstrap themes are available from many other sites such as
https://startbootstrap.com/themes
.
If you would like to add more themes, create a subdirectory under the calendar's themes directory and copy the bootstrap.css
and
bootstrap.min.css
files in the newly-created subdirectory. The calendar will attempt to find and use the
bootstrap.min.css
first due to its reduced size.
public Object getUserData()
Returns the custom object that was previously associated with the widget by calling the setUserData()
method.
public BBjString getUuid()
Returns a unique auto-generated ID for the calendar instance that may be used to distinguish between instances of the class.
public BBjString getValidDateString(BBjString dateString!)
Returns a date string formatted as YYYY-MM-DD if the provided date string can be parsed into a valid date, or null() if the date string is invalid.
Note: An ISO 8601 formatted date/time string (YYYY-MM-DDTHH:mm:ss.sssZ
) is never ambiguous, but this method exists to attempt to parse an ambiguous
date/time string into an ISO 8601 formatted date/time string. If the provided string is ambiguous, there are no guarantees that the method will be able to
resolve the date/time string correctly. The success of this method depends on the format of the supplied date/time string and the client's browser. For example,
a date of "1-2-3"
is very ambiguous and while the method may be able to return a valid date string, it may not be the particular date that you had in mind.
That's because there is no good way to know which number corresponds to the year, month, and day. However, a string like "Jan 1, 2000"
is far less
ambiguous and will likely be parsed correctly in to "2000-01-01"
.
Additionally, since the method uses JavaScript when parsing dates, the success is dependant on the browser's JavaScript implementation. For example, at the time of
this writing, Chrome can parse ambiguous dates like "May 2020"
and "May 15"
. However, Firefox returns an "Invalid Date" for those values.
BBjString
dateString! A string that contains a date representation. If you provide a ISO formatted date, such as 2022-12-25, then BBj 22.00
public BBjString getValidDateTimeString(BBjString dateTimeString!)
Returns an ISO 8601 formatted date/time string if the provided date/time string can be parsed into a valid date, or null() if it can't be parsed.
Note: An ISO 8601 formatted date/time string (YYYY-MM-DDTHH:mm:ss.sssZ
) is never ambiguous, but this method exists to attempt to parse an ambiguous
date/time string into an ISO 8601 formatted date/time string. If the provided string is ambiguous, there are no guarantees that the method will be able to
resolve the date/time string correctly. The success of this method depends on the format of the supplied date/time string and the client's browser. For example,
a date of "1-2-3"
is very ambiguous and while the method may be able to return a valid date string, it may not be the particular date that you had in mind.
That's because there is no good way to know which number corresponds to the year, month, and day. However, a string like "Jan 1, 2000"
is far less
ambiguous and will likely be parsed correctly in to "2000-01-01"
.
Additionally, since the method uses JavaScript when parsing dates, the success is dependant on the browser's JavaScript implementation. For example, at the time of
this writing, Chrome can parse ambiguous dates like "May 2020"
and "May 15"
. However, Firefox returns an "Invalid Date" for those values.
BBjString
dateTimeString! A string that contains a date/time representation. BBj 22.00
public BBjString getValidTimeString(BBjString timeString!)
Returns a time string formatted as HH:MM:SS using 24-hour format if the provided time string can be parsed into a valid time, or null() if the time string is invalid.
Note: An ISO 8601 formatted date/time string (YYYY-MM-DDTHH:mm:ss.sssZ
) is never ambiguous, but this method exists to attempt to parse an ambiguous
date/time string into an ISO 8601 formatted date/time string. If the provided string is ambiguous, there are no guarantees that the method will be able to
resolve the date/time string correctly. The success of this method depends on the format of the supplied date/time string and the client's browser. For example,
a date of "1-2-3"
is very ambiguous and while the method may be able to return a valid date string, it may not be the particular date that you had in mind.
That's because there is no good way to know which number corresponds to the year, month, and day. However, a string like "Jan 1, 2000"
is far less
ambiguous and will likely be parsed correctly in to "2000-01-01"
.
Additionally, since the method uses JavaScript when parsing dates, the success is dependant on the browser's JavaScript implementation. For example, at the time of
this writing, Chrome can parse ambiguous dates like "May 2020"
and "May 15"
. However, Firefox returns an "Invalid Date" for those values.
BBjString
timeString! A string that contains a time representation. BBj 22.00
public BBjString getViewType()
Returns the calendar's view type which will be one of the following constants:
CalendarAPI.CALENDAR_VIEW_DAY_GRID_WEEK()
.CalendarAPI.CALENDAR_VIEW_DAY_GRID_MONTH()
.CalendarAPI.CALENDAR_VIEW_TIME_GRID_DAY()
.CalendarAPI.CALENDAR_VIEW_TIME_GRID_WEEK()
.CalendarAPI.CALENDAR_VIEW_LIST_DAY()
.CalendarAPI.CALENDAR_VIEW_LIST_WEEK()
.CalendarAPI.CALENDAR_VIEW_LIST_MONTH()
.CalendarAPI.CALENDAR_VIEW_LIST_YEAR()
.CalendarAPI.CALENDAR_VIEW_DAY_GRID_WEEK()
.public BBjVector getVisibleTags()
Returns a BBjVector filled with optional custom tags that were previously set with the setVisibleTags() method and determine which calendar entries should be displayed.
When dealing with entry tags, there are three sets to be aware of:
CalendarEntry
custom class offers setTags() methods that give you the opportunity to add custom tags to any entry.BBjCalendarWidget::setVisibleTags()
methods allow you to set which entries will be visible in the calendar, as any entries that share a tag with the visible tag set will be displayed normally.BBjCalendarWidget::setHiddenTags()
methods allow you to set which entries will be hidden in the calendar, as any entries that share a tag with the hidden tag set will be be hidden from view.
Note: If the BBjCalendarWidget
's set of visible tags is empty then all calendar entries will be visible.
If the BBjCalendarWidget
's set of hidden tags is empty then all calendar entries will be visible.
Note: You will typically affect the calendar's entry visibility by calling either the setVisibleTags() or setHiddenTags() methods, but not both.
BBjCalendarWidget::setVisibleTags()
methods. BBjVector
public BBjNumber getWidth()
Returns the widget's width.
public BBjNumber getX()
Returns the widget's X coordinate, or horizontal position.
public BBjNumber getY()
Returns the widget's Y coordinate, or vertical position.
public void injectCss(BBjString css!)
Injects the provided CSS string into the <head>
element of the HTML document in the BBjHtmlView that contains the calendar.
This method provides a simple way to add custom CSS that affects the calendar. For more advanced use cases, see the
injectCss()
method that takes several
parameters to provide greater control over the injection.
BBjString
css! The CSS to inject into the BBjHtmlView's DOM.public void injectCss(BBjString css!, BBjString location!, BBjString description!, BBjNumber removePrevious!)
Injects the provided CSS string into the head
or body
of the HTML DOM (as specified by the location! parameter)
in the BBjHtmlView that contains the calendar, as well as providing the ability to tag the CSS and replace it in subsequent calls.
BBjString
css! The CSS to inject into the BBjHtmlView's DOM.BBjString
location! The target for injection which can be 'head' or 'body'. If it's an empty string, it will default to 'body'.BBjString
description! The description of the CSS, which is used to replace it in subsequent calls.BBjNumber
removePrevious! A BBjNumber acting as a boolean that determines whether the CSS should replace existing CSS with the same description.public void injectCssFile(BBjString cssPath!)
Injects the CSS contained in the specified file into the <head>
element of the HTML document in the BBjHtmlView that contains the calendar.
This is a convenience method that reads in the contents of the provided CSS file and injects it into the HtmlView control that contains the calendar.
BBjString
cssPath! A string representing the full path and filename of the file that contains the CSS to be injected.public void injectScript(BBjString script!)
Injects the provided JavaScript string at the top-level window.
BBjString
script! The JavaScript to inject into the BBjHtmlView. BBjHtmlView::injectScript.
public void injectScriptFile(BBjString scriptPath!)
Injects the JavaScript contained in the specified script file into the top-level window. This is a convenience method that reads in the contents of the provided JavaScript file and injects it into the HtmlView control that contains the calendar.
BBjString
scriptPath! A string representing the full path and filename of the file that contains the JavaScript to be injected. BBjHtmlView::injectScript.
public void injectUrl(BBjString url!)
Injects the specified JavaScript URL into the HTML DOM, making it available for subsequent use by client-side JavaScript.
BBjString
url! The URL string containing JavaScript to be injected into the HTML DOM.public boolean isEnabled()
Returns whether the widget is enabled or disabled.
public boolean isVisible()
Returns whether the widget is visible or hidden.
public void navigateDate(BBjString date!)
Navigates the calendar programmatically to the specified date. To ensure the calendar navigates to the correct date, the provided
date should be in the ISO 8601 format. However, this method attempts to parse ambiguous dates and is often able to construct
a date in the format "YYYY-MM-DD"
given a date string in another format.
If the provided string is ambiguous, there are no guarantees that the method will be able to resolve the date/time string correctly.
The success of this method depends on the format of the supplied date/time string and the client's browser. For example, a date of
"1-2-3"
is very ambiguous and while the method may be able to return a valid date string, it may not be the particular
date that you had in mind. That's because there is no good way to know which number corresponds to the year, month, and day. However,
a string like "Jan 1, 2000"
is far less ambiguous and will likely be parsed correctly in to "2000-01-01"
.
Additionally, since the method uses JavaScript when parsing dates and time, the success is dependant on the browser's JavaScript implementation.
For example, at the time of this writing, Chrome can parse ambiguous dates like "May 2020"
and "May 15"
.
However, Firefox returns an "Invalid Date" for those values.
The date string should ideally be in the "YYYY-MM-DD"
format at a minimum, but the parser should be able to interpret various formats.
BBjString
date! The date string that will be parsed and then passed to the FullCalendar's gotoDate() method. Date and Time Formats for information on ISO 8601 date/time formats.
Calendar::gotoDate for information on the FullCalendar's gotoDate() method.
public void navigateNext()
Navigates the calendar programmatically one step forward (by a month or week for example), and is the same as the user clicking on the 'next' toolbar button. The amount of time moved depends on the current view type.
public void navigateNextYear()
Navigates the calendar programmatically forward one year, and is the same as the user clicking on the 'nextYear' toolbar button.
public void navigatePrev()
Navigates the calendar programmatically one step back (by a month or week for example), and is the same as the user clicking on the 'prev' toolbar button. The amount of time moved depends on the current view type.
public void navigatePrevYear()
Navigates the calendar programmatically back one year, and is the same as the user clicking on the 'prevYear' toolbar button.
public void navigateTime(BBjString time!)
Navigates the calendar programmatically to the specified time. To ensure the calendar navigates to the correct time, the provided
time should be in the ISO 8601 format or "hh:mm"
format at a minimum.. However, this method attempts to parse ambiguous
times and is often able to construct a time in the format "hh:mm:ss"
given a time string in another format.
If the provided string is ambiguous, there are no guarantees that the method will be able to resolve the date/time string correctly.
The success of this method depends on the format of the supplied date/time string and the client's browser. For example, a date of
"1-2-3"
is very ambiguous and while the method may be able to return a valid date string, it may not be the particular
date that you had in mind. That's because there is no good way to know which number corresponds to the year, month, and day. However,
a string like "Jan 1, 2000"
is far less ambiguous and will likely be parsed correctly in to "2000-01-01"
.
Additionally, since the method uses JavaScript when parsing dates and time, the success is dependant on the browser's JavaScript implementation.
For example, at the time of this writing, Chrome can parse ambiguous dates like "May 2020"
and "May 15"
.
However, Firefox returns an "Invalid Date" for those values.
The time string should ideally be in one of the following formats.
BBjString
time! The time string that will be parsed and then passed to the FullCalendar's scrollToTime() method. Date and Time Formats for information on ISO 8601 date/time formats.
Calendar::scrollToTime for information on the FullCalendar's scrollToTime() method.
BBj 22.00
public void navigateToday()
Navigates the calendar programmatically to the current date, and is the same as the user clicking on the 'today' toolbar button.
public static BBjNumber ON_CALENDAR_DATE_CLICK()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has clicked on a date or time.
Note that ON_CALENDAR_DATE_CLICK
event is not fired when the user clicks a day heading in a list view.
Setting a callback for this event type will result in your application getting a CalendarDateClickEvent
object.
public static BBjNumber ON_CALENDAR_DATES_SET()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the calendar's date range has changed in any way.
Setting a callback for this event type will result in your application getting a CalendarDatesSetEvent
object.
public static BBjNumber ON_CALENDAR_DROP()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user dropped an external draggable element or an event from another calendar onto this calendar.
public static BBjNumber ON_CALENDAR_ENTRIES_SET()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the calendar's entry data has changed in any way.
If you set a callback for this event, then add several entries to the calendar, your callback routine may be flooded because the event will fire for every entry that you add.
When responding to this event, the BBjSysGui::getLastEvent()
call
will return a CalendarEntriesSetEvent
object.
You can call the CalendarEntriesSetEvent::getEntries()
method to return a BBjVector of
CalendarEntry
objects that corresponds to all the known entries in the calendar at that instant in time.
Setting a callback for this event type will result in your application getting a CalendarEntriesSetEvent
object.
BBjVector.
public static BBjNumber ON_CALENDAR_ENTRY_ADD()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that an event has been added to the calendar.
Note: If you set a callback for this event, then add several events to the calendar, your callback routine may be flooded.
Setting a callback for this event type will result in your application getting a CalendarEntryAddEvent
object.
public static BBjNumber ON_CALENDAR_ENTRY_CHANGE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the calendar's event data has changed in any way.
Setting a callback for this event type will result in your application getting a CalendarEntryChangeEvent
object.
public static BBjNumber ON_CALENDAR_ENTRY_CLICK()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has clicked on a calendar's event.
Setting a callback for this event type will result in your application getting a CalendarEntryClickEvent
object.
public static BBjNumber ON_CALENDAR_ENTRY_DRAG_START()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has started dragging an event.
public static BBjNumber ON_CALENDAR_ENTRY_DRAG_STOP()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has stopped dragging an event.
public static BBjNumber ON_CALENDAR_ENTRY_DROP()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has dropped the event to a different day/time.
public static BBjNumber ON_CALENDAR_ENTRY_LEAVE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user is about to drop one of the calendar events on to another calendar.
public static BBjNumber ON_CALENDAR_ENTRY_MOUSE_ENTER()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user moved the mouse into the bounds of a calendar event.
Setting a callback for this event type will result in your application getting a CalendarEntryMouseEnterEvent
object.
public static BBjNumber ON_CALENDAR_ENTRY_MOUSE_LEAVE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user moved the mouse out of the bounds of a calendar event.
Setting a callback for this event type will result in your application getting a CalendarEntryMouseLeaveEvent
object.
public static BBjNumber ON_CALENDAR_ENTRY_RECEIVE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the calendar has received an external draggable element with event data from another source or another calendar.
public static BBjNumber ON_CALENDAR_ENTRY_REMOVE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that an entry has been removed from the calendar.
If you set a callback for this event, then remove several entries from the calendar, your callback routine may be flooded because
the event will fire for every entry that was removed.
Setting a callback for this event type will result in your application getting a CalendarEntryRemoveEvent
object.
public static BBjNumber ON_CALENDAR_ENTRY_RESIZE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has stopped resizing an event and the event has a different duration.
public static BBjNumber ON_CALENDAR_ENTRY_RESIZE_START()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has started resizing an event.
public static BBjNumber ON_CALENDAR_ENTRY_RESIZE_STOP()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has stopped resizing an event.
public static BBjNumber ON_CALENDAR_ENTRY_SOURCE_FAILURE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that fetching a CalendarEntrySource
failed.
public static BBjNumber ON_CALENDAR_ENTRY_SOURCE_SUCCESS()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that fetching a CalendarEntrySource
succeeded.
public static BBjNumber ON_CALENDAR_READY()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the BBjCalendarWidget
is ready.
Setting a callback for this event type will result in your application getting a CalendarReadyEvent
object.
public static BBjNumber ON_CALENDAR_SELECT()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user selected a date or time.
Note: You must configure the calendar to enable user selections via the CalendarOptions:setEnableSelectable()
method
if you intend to set a callback for the BBjCalendarWidget:ON_CALENDAR_SELECT
or BBjCalendarWidget:ON_CALENDAR_UNSELECT
events.
Setting a callback for this event type will result in your application getting a CalendarSelectEvent
object.
public static BBjNumber ON_CALENDAR_UNSELECT()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user unselected a date or time.
Note: You must configure the calendar to enable user selections via the CalendarOptions:setEnableSelectable()
method
if you intend to set a callback for the BBjCalendarWidget:ON_CALENDAR_SELECT
or BBjCalendarWidget:ON_CALENDAR_UNSELECT
events.
A selection might be cleared for a number of reasons:
The CalendarOptions::setEnableUnselectAuto()
impacts what causes the BBjCalendarWidget.ON_CALENDAR_UNSELECT
event to be fired.
If automatic unselection is enabled, then the unselection event will typically be fired after the user releases their selection mouse button.
Setting a callback for this event type will result in your application getting a CalendarUnselectEvent
.
public static BBjNumber ON_CALENDAR_VIEW_CHANGE()
A constant value that's used with the BBjCalendarWidget::setCallback()
method that signals that the user has changed the view type of the BBjCalendarWidget
.
Note: This only fires when the type of view changes, not when the user changes the view from one subtype to another. For example,
the event will be triggered when the user switches from the
CalendarAPI.CALENDAR_VIEW_DAY_GRID_MONTH()
to the
CalendarAPI.CALENDAR_VIEW_LIST_MONTH()
view. But it won't be triggerd when the user changes from
CalendarAPI.CALENDAR_VIEW_DAY_GRID_MONTH()
to
CalendarAPI.CALENDAR_VIEW_DAY_GRID_WEEK()
since both views are
the same type (dayGrid) and just the subtype (week vs. month) changes.
public void onNativeEvent(BBjNativeJavaScriptEvent ev!)
An internal event handler for native JavaScript events from the BBjHtmlView control that converts a JavaScript calendar event to a BBj callback event.
BBjNativeJavaScriptEvent
ev! The Javascript event from the client.public void redraw(BBjNumber shouldCreate!)
Initially draws or redraws the widget whenever it needs to be rendered.
Your application code won't ever have to call this method under normal conditions. It's typically only used internally
to redraw the calendar after the the setSize()
method has been called. However, if you may want to call
the render()
method if you modified the calendar's options inline (as opposed to using the setOptions()
method.
BBjNumber
shouldCreate! A BBjNumber acting as a boolean that indicates if the control should be (re)created (1) or just redrawn (0). render()
public void refetchAllEntries()
Causes the calendar to refetch entries from all sources and rerender.
If you've previously added events to the calendar from a remote source, such as a web service or Google Calendar, then the calendar will requery those sources for an updated entry set. If the entries on the backend have changed, such as some entries have been added and others deleted, then those changes will be reflected on the calendar after calling this method.
public void refetchAllEntrySources()
Refetches all CalendarEntrySource
objects in the calendar, causing them to retrieve their entries again.
public void refetchEntrySource(BBjString id!)
Refetches the CalendarEntrySource
object in the calendar given its unique ID, causing it to retrieve its entries again.
BBjString
id! A BBjString filled with the unique ID for the CalendarEntrySource to remove.
public BBjNumber removeAllEntries()
Removes all the entries in the calendar.
Note: Removing entries from the calendar via this method will trigger the
CalendarAPI.ON_CALENDAR_ENTRY_REMOVE()
event for each entry that was removed.
public BBjNumber removeAllEntrySources()
Removes all CalendarEntrySource
objects from the calendar.
public BBjNumber removeEntries(BBjVector entries!)
Removes all the entries contained in the BBjVector from the calendar.
Note: Removing entries from the calendar via this method will trigger the
CalendarAPI.ON_CALENDAR_ENTRY_REMOVE()
event for each entry that was removed.
BBjVector
entries! A BBjVector filled with the CalendarEntry
objects to remove from the the calendar.public BBjNumber removeEntry(CalendarEntry entry!)
Removes an entry from the calendar.
CalendarEntry
entry! The CalendarEntry
to remove from the calendar.public BBjNumber removeEntryById(BBjString id!)
Removes an entry from the calendar given its optional unique ID which must have previously been set.
BBjString
id! A BBjString containing the entry's unique ID.public void removeEntrySource(BBjString id!)
Removes a CalendarEntrySource
and its entries from the calendar given its unique ID.
BBjString
id! A BBjString filled with the unique ID for the CalendarEntrySource to remove.
public boolean removeStyle(BBjString style!)
Removes the provided CSS style name from the widget.
BBjString
style! The CSS style name to remove from the widget.public void render()
Renders the calendar inside the HtmlView and applies the current calendar options.
This composes the calendar configuration and sends it to the client for a full rerendering. This is the
difference between the render()
and the redraw()
method - the redraw()
method
only instructs the calendar to repaint itself; it doesn't change or apply any configuration options.
You can call this method to force the calendar to be updated after you modify its setup configuration, as in:
rem Get and then set the desired options inline dynamically, calling the render() method afterwards to force the calendar to update with the new configuration: myCal!.getOptions().setEnableEntryDurationEditable(1) myCal!.getOptions().setEnableEntryResizableFromStart(1) myCal!.getOptions().setEnableEntryStartEditable(1) myCal!.getOptions().setEnableSlotEntryOverlap(0) myCal!.render()
Note: You don't have to call the render()
method if you update the calendar's configuration via the setOptions()
method.
public void saveAsPngImage(BBjString path!)
Saves a BBjImage screenshot of the BBjCalendarWidget
to the specified file path.
BBjString
path! A string representing the full path and filename for the saved screenshot of the calendar.public void setBackColor(BBjColor backColor!)
Sets the background color of the calendar's containing window.
BBjColor
backColor! A BBjColor that defines the containing window's background color.public void setCallback(BBjNumber event!, BBjString callback!)
Registers a callback in a procedural program for the provided event type.
These are the valid callback event type options:
CalendarAPI.ON_CALENDAR_READY
- the calendar is ready for interactionCalendarAPI.ON_CALENDAR_VIEW_CHANGE
- the calendar's view has changedCalendarAPI.ON_CALENDAR_ENTRIES_SET
- entries have been changed or initialized in any wayCalendarAPI.ON_CALENDAR_ENTRY_CLICK
- the user clicked on an entryCalendarAPI.ON_CALENDAR_ENTRY_ADD
- an entry was added to the calendarCalendarAPI.ON_CALENDAR_ENTRY_CHANGE
- the entry has been modifiedCalendarAPI.ON_CALENDAR_ENTRY_REMOVE
- the entry has been removed from the calendarCalendarAPI.ON_CALENDAR_ENTRY_MOUSE_ENTER
- the user moved the mouse on an entryCalendarAPI.ON_CALENDAR_ENTRY_MOUSE_LEAVE
- the user moved the mouse off an entryCalendarAPI.ON_CALENDAR_ENTRY_DRAG_START
- the user began dragging an entire entryCalendarAPI.ON_CALENDAR_ENTRY_DRAG_STOP
- the user stopped dragging the entryCalendarAPI.ON_CALENDAR_ENTRY_DROP
- the user has completed dragging and dropping the entire entryCalendarAPI.ON_CALENDAR_ENTRY_RESIZE_START
- the user began to resize the entry to change its durationCalendarAPI.ON_CALENDAR_ENTRY_RESIZE_STOP
- the user stopped resizing the entryCalendarAPI.ON_CALENDAR_ENTRY_RESIZE
- the user completed resizing the entry resulting in a changed durationCalendarAPI.ON_CALENDAR_ENTRY_RECEIVE
- Not Yet Implemented, deals with dragging and dropping entries from an external sourceCalendarAPI.ON_CALENDAR_ENTRY_LEAVE
- Not Yet Implemented, deals with dragging and dropping entries from an external sourceCalendarAPI.ON_CALENDAR_DROP
- Not Yet Implemented, deals with dragging and dropping entries from an external sourceCalendarAPI.ON_CALENDAR_DATES_SET
- the calendar's range has been initially set or changed in some wayCalendarAPI.ON_CALENDAR_DATE_CLICK
- the user clicked on a date or time in the calendarCalendarAPI.ON_CALENDAR_SELECT
- the user selected a date or time in the calendar (not an entry)CalendarAPI.ON_CALENDAR_UNSELECT
- the date/time selection has been clearedCalendarAPI.ON_CALENDAR_ENTRY_SOURCE_SUCCESS
- fetching a CalendarEntrySource has succededCalendarAPI.ON_CALENDAR_ENTRY_SOURCE_FAILURE
- fetching a CalendarEntrySource has failedNote: Callbacks associated with dragging/dropping calendar entries between two different calendars has not yet been implemented.
BBjNumber
event! The event number which is one of the CalendarAPI.ON_CALENDAR_*
constants.BBjString
callback! The program's callback subroutine label.public void setCallback(BBjNumber event!, CustomObject instance!, BBjString method!)
Registers a callback in an object-oriented program for the provided event type.
These are the valid callback event type options:
CalendarAPI.ON_CALENDAR_READY
- the calendar is ready for interactionCalendarAPI.ON_CALENDAR_VIEW_CHANGE
- the calendar's view has changedCalendarAPI.ON_CALENDAR_ENTRIES_SET
- entries have been changed or initialized in any wayCalendarAPI.ON_CALENDAR_ENTRY_CLICK
- the user clicked on an entryCalendarAPI.ON_CALENDAR_ENTRY_ADD
- an entry was added to the calendarCalendarAPI.ON_CALENDAR_ENTRY_CHANGE
- the entry has been modifiedCalendarAPI.ON_CALENDAR_ENTRY_REMOVE
- the entry has been removed from the calendarCalendarAPI.ON_CALENDAR_ENTRY_MOUSE_ENTER
- the user moved the mouse on an entryCalendarAPI.ON_CALENDAR_ENTRY_MOUSE_LEAVE
- the user moved the mouse off an entryCalendarAPI.ON_CALENDAR_ENTRY_DRAG_START
- the user began dragging an entire entryCalendarAPI.ON_CALENDAR_ENTRY_DRAG_STOP
- the user stopped dragging the entryCalendarAPI.ON_CALENDAR_ENTRY_DROP
- the user has completed dragging and dropping the entire entryCalendarAPI.ON_CALENDAR_ENTRY_RESIZE_START
- the user began to resize the entry to change its durationCalendarAPI.ON_CALENDAR_ENTRY_RESIZE_STOP
- the user stopped resizing the entryCalendarAPI.ON_CALENDAR_ENTRY_RESIZE
- the user completed resizing the entry resulting in a changed durationCalendarAPI.ON_CALENDAR_ENTRY_RECEIVE
- Not Yet Implemented, deals with dragging and dropping entries from an external sourceCalendarAPI.ON_CALENDAR_ENTRY_LEAVE
- Not Yet Implemented, deals with dragging and dropping entries from an external sourceCalendarAPI.ON_CALENDAR_DROP
- Not Yet Implemented, deals with dragging and dropping entries from an external sourceCalendarAPI.ON_CALENDAR_DATES_SET
- the calendar's range has been initially set or changed in some wayCalendarAPI.ON_CALENDAR_DATE_CLICK
- the user clicked on a date or time in the calendarCalendarAPI.ON_CALENDAR_SELECT
- the user selected a date or time in the calendar (not an entry)CalendarAPI.ON_CALENDAR_UNSELECT
- the date/time selection has been clearedCalendarAPI.ON_CALENDAR_ENTRY_SOURCE_SUCCESS
- fetching a CalendarEntrySource has succededCalendarAPI.ON_CALENDAR_ENTRY_SOURCE_FAILURE
- fetching a CalendarEntrySource has failedNote: Callbacks associated with dragging/dropping calendar entries between two different calendars has not yet been implemented.
BBjNumber
event! The event number which is one of the CalendarAPI.ON_CALENDAR_*
constants.CustomObject
instance! The program's custom class instance, usually #this!BBjString
method! The program's custom class's method name.public void setEnabled(boolean enabled!)
Sets whether the widget should be enabled.
boolean
enabled! A boolean that indicates whether the widget should be enabled (1) or not (0).public void setEnableDebug(BBjNumber enableDebug)
Sets whether the BBjCalendarWidget
should run in debug mode (1) or not (0), where the default is 0.
When this is set to true (1), the BBjCalendarWidget
will:
!CHROMIUM_SWITCHES
global string entry is properly set before instantiating the BBjCalendarWidget
, as in: chromium_switches$ = stbl("!CHROMIUM_SWITCHES", "--remote-debugging-port=9223")
BBjNumber
enableDebug A BBjNumber acting as a boolean that determines whether the BBjCalendarWidget
should run in debug mode (1) or not (0).public void setHiddenTags(BBjString tags!)
Sets one or more optional, custom tags that determine which calendar
entries should be hidden. The CalendarEntry
custom class offers
setTags() methods that give you the opportunity to add custom tags to any entry. After
adding tags to one or more entries, you can call methods on the calendar to show or
hide entries based on their tags by calling the BBjCalendarWidget::setVisibleTags()
and
BBjCalendarWidget::setHiddenTags()
methods.
This is similar to the setHiddenTags()
method that takes a BBjVector except that it takes a comma-delimted string of tags for succinctness.
BBjString
A comma-delimted string of tags such as "work, programming, personal".public void setHiddenTags(BBjVector tags!)
Sets one or more optional, custom tags that determine which calendar
entries should be hidden. The CalendarEntry
custom class offers
setTags() methods that give you the opportunity to add custom tags to any entry. After
adding tags to one or more entries, you can call methods on the calendar to show or
hide entries based on their tags by calling the BBjCalendarWidget::setVisibleTags()
and
BBjCalendarWidget::setHiddenTags()
methods.
BBjVector
A vector filled with tags such as "work", "programming", "meeting", etc.public void setLocation(BBjNumber x!, BBjNumber y!)
Sets the location of the calendar widget given the provided X and Y coordinates.
BBjNumber
x! The widget's X coordinate.BBjNumber
y! The widget's Y coordinate.public void setName(BBjString name!)
Sets the widget's name, which can later be retrieved via the getName()
method.
This value is propagated to the CSS class attribute of the HTML element representing the control in BUI.
BBjString
name! The widget's name.public void setOptions(CalendarOptions options!)
Sets the calendar's options given an instance of the CalendarOptions
class.
Note: After setting the calendar's options inline (see example #1 below), you will need to call the calendar's render()
method to apply the changes to the calendar in order for them to take effect.
There are a couple of ways to set options for the calendar:
rem Get and then set the desired options inline dynamically, calling the render() method afterwards to force the calendar to update with the new configuration: myCal!.getOptions().setEnableEntryDurationEditable(1) myCal!.getOptions().setEnableEntryResizableFromStart(1) myCal!.getOptions().setEnableEntryStartEditable(1) myCal!.getOptions().setEnableSlotEntryOverlap(0) myCal!.render()
rem Get the calendar's options object, then call the desired set methods, then apply the updated options to the calendar: opts! = myCal!.getOptions() opts!.setEnableEntryDurationEditable(1) opts!.setEnableEntryResizableFromStart(1) opts!.setEnableEntryStartEditable(1) opts!.setEnableSlotEntryOverlap(0) myCal!.setOptions(opts!)
CalendarOptions
options! An instance of the CalendarOptions
class that has been configured with the desired settings.public void setPadding(BBjNumber padding!)
Sets the padding, or spacing around the calendar control, to the same number of pixels for all four sides.
Using the default index.html template, the calendar is contained within the DIV that has the class 'BBjCalendarWidgetContainer'. This method modifies the CSS for the container DIV by setting its padding to the provided padding size in pixels.
BBjNumber
padding! The numeric value of the desired padding in pixels, e.g. '5' for a 5-pixel padding on all sides.public void setPadding(BBjNumber paddingTop!, BBjNumber paddingRight!, BBjNumber paddingBottom!, BBjNumber paddingLeft!)
Sets the padding, or spacing around the calendar control, to the specified number of pixels for the top, right, bottom, and left sides.
Using the default index.html template, the calendar is contained within the DIV that has the class 'BBjCalendarWidgetContainer'. This method modifies the CSS for the container DIV by setting its padding to the provided padding size in pixels.
BBjNumber
paddingTop! The numeric value of the desired top padding in pixels, e.g. '5' for a 5-pixel padding on the top of the container.BBjNumber
paddingRight! The numeric value of the desired right padding in pixels, e.g. '5' for a 5-pixel padding on the right side of the container.BBjNumber
paddingBottom! The numeric value of the desired bottom padding in pixels, e.g. '5' for a 5-pixel padding on the bottom of the container.BBjNumber
paddingLeft! The numeric value of the desired left in pixels, e.g. '5' for a 5-pixel padding on the left side of the container.public void setSize(BBjNumber width!, BBjNumber height!)
Sets the size of the calendar widget given the provided width and height.
BBjNumber
width! The widget's width.BBjNumber
height! The widget's height.public void setStyle(BBjString property!, BBjString style!)
Sets a CSS property on the widget.
BBjString
property! The CSS property name to set.BBjString
style! The CSS value to be assigned to the provided CSS property.public void setTheme(BBjString theme!)
Sets the calendar's theme to one of the installed Boostrap themes, which modifies the calendar's fonts and color scheme.
To determine which themes are available, you can call the getThemes()
method which returns a BBjVector filled with the installed theme names.
Note that the installed themes are located in the BBjCalendarWidget's lib/bootstrap/themes/
directory. The installed themes
are free Bootstrap themes from https://bootswatch.com/
, although free
Bootstrap themes are available from many other sites such as
https://startbootstrap.com/themes
.
If you would like to add more themes, create a subdirectory under the calendar's themes directory and copy the bootstrap.css
and
bootstrap.min.css
files in the newly-created subdirectory. The calendar will attempt to find and use the
bootstrap.min.css
first due to its reduced size.
BBjString
theme!public void setUserData(Object userData!)
Sets a custom, arbitrary object to be associated with the widget which can be retrieved later via the getUserData()
method.
Object
userData! The object to associate with the widget.public void setViewType(BBjString viewType!)
Sets the calendar's view type.
Note: Calling this method causes the calendar to change its view, which then results in a
CalendarAPI.ON_CALENDAR_VIEW_CHANGE
event.
The provided view type should be one of the following constants:
CalendarAPI.CALENDAR_VIEW_DAY_GRID_WEEK()
.CalendarAPI.CALENDAR_VIEW_DAY_GRID_MONTH()
.CalendarAPI.CALENDAR_VIEW_TIME_GRID_DAY()
.CalendarAPI.CALENDAR_VIEW_TIME_GRID_WEEK()
.CalendarAPI.CALENDAR_VIEW_LIST_DAY()
.CalendarAPI.CALENDAR_VIEW_LIST_WEEK()
.CalendarAPI.CALENDAR_VIEW_LIST_MONTH()
.CalendarAPI.CALENDAR_VIEW_LIST_YEAR()
.BBjString
viewType! The desired calendar view type, such as CalendarAPI.CALENDAR_VIEW_TIME_GRID_WEEK()
.public void setVisible(boolean visible!)
Sets whether the widget should be visible or hidden.
boolean
visible! A boolean that indicates whether the widget should be visible (1) or not (0).public void setVisibleTags(BBjString tags!)
Sets one or more optional, custom tags that determine which calendar
entries should be displayed. The CalendarEntry
custom class offers
setTags() methods that give you the opportunity to add custom tags to any entry. After
adding tags to one or more entries, you can call methods on the calendar to show or
hide entries based on their tags by calling the BBjCalendarWidget::setVisibleTags()
and
BBjCalendarWidget::setHiddenTags()
methods.
This is similar to the setVisibleTags()
method that takes a BBjVector except that it takes a comma-delimted string of tags for succinctness.
BBjString
tags! A comma-delimted string of tags such as "work, programming".public void setVisibleTags(BBjVector tags!)
Sets one or more optional, custom tags that determine which calendar
entries should be displayed. The CalendarEntry
custom class offers
setTags() methods that give you the opportunity to add custom tags to any entry. After
adding tags to one or more entries, you can call methods on the calendar to show or
hide entries based on their tags by calling the BBjCalendarWidget::setVisibleTags()
and
BBjCalendarWidget::setHiddenTags()
methods.
BBjVector
A vector filled with tags such as "work", "programming", "meeting", etc.public void suppressBuiDebouncing(BBjNumber suppress!)
Supresses JavaScript debouncing for BUI.
Setting this to "0" may help to improve the communication performance between BBj and the calendar in the BBjHtmlViewControl when running in BUI.
BBjNumber
suppress! A BBjNumber acting as a boolean that determines whether the BBjJavaScriptExecutor should disable debouncing or not where 1=suppressDebouncing and 0=doNotSuppressDebouncing (default). #suppressDebouncing().
#suppressGuiDebouncing().
public void suppressDebouncing(BBjNumber suppress!)
Supressesss JavaScript debouncing for both GUI and BUI.
BBjNumber
suppress! A BBjNumber acting as a boolean that determines whether the BBjJavaScriptExecutor should disable debouncing or not where 1=suppressDebouncing and 0=doNotSuppressDebouncing (default). #suppressBuiDebouncing().
#suppressGuiDebouncing().
public void suppressGuiDebouncing(BBjNumber suppress!)
Supresses JavaScript debouncing when running in GUI.
Setting this to "0" may help to improve the communication performance between BBj and the calendar in the BBjHtmlViewControl when running in GUI.
BBjNumber
suppress! A BBjNumber acting as a boolean that determines whether the BBjJavaScriptExecutor should disable debouncing or not where 1=suppressDebouncing and 0=doNotSuppressDebouncing (default). #suppressDebouncing().
#suppressBuiDebouncing().
public void updateEntries(JsonArray entries!)
Updates several JsonObject entries in a JsonArray to the calendar at once for improved performance.
This method iterates through the CalendarEntry
objects and calls the same code as the updateEntry()
method does. Therefore, it
uses the CalendarEntry
's ID (if set) or UUID (if the ID isn't set) to find the entry in the calendar. If found, it removes the
old version of the entry from the calendar, then adds the new version of the entry to the calendar. Because of that, if you've registered for the
CalendarAPI.ON_CALENDAR_ENTRY_ADD
or
CalendarAPI.ON_CALENDAR_ENTRY_REMOVE
events then your callback
code will executed once for each entry in the array as a result of calling this method.
JsonArray
entries! A JsonArray filled with JSON objects to be added to the calendar. BBj 21.12
public void updateEntries(BBjVector entries!)
Updates several entries of type CalendarEntry
to the calendar at once for improved performance.
This method iterates through the CalendarEntry
objects and calls the same code as the updateEntry()
method does. Therefore, it
uses the CalendarEntry
's ID (if set) or UUID (if the ID isn't set) to find the entry in the calendar. If found, it removes the
old version of the entry from the calendar, then adds the new version of the entry to the calendar. Because of that, if you've registered for the
CalendarAPI.ON_CALENDAR_ENTRY_ADD
or
CalendarAPI.ON_CALENDAR_ENTRY_REMOVE
events then your callback
code will executed once for each CalendarEntry
in the BBjVector as a result of calling this method.
BBjVector
entries! A BBjVector filled with CalendarEntry
objects to be updated in the calendar. BBj 21.12
public void updateEntry(CalendarEntry entry!)
Updates an entry in the calendar.
This method uses the CalendarEntry
's ID (if set) or UUID (if the ID isn't set) to find the entry in the calendar. If found, it removes the
old version of the entry from the calendar, then adds the new version of the entry to the calendar. Because of that, if you've registered for the
CalendarAPI.ON_CALENDAR_ENTRY_ADD
or
CalendarAPI.ON_CALENDAR_ENTRY_REMOVE
events then your callback
code will executed as a result of calling this method.
CalendarEntry
entry! The updated CalendarEntry
object BBj 21.12
public void updateSize()
Forces the calendar to resize itself based on the available space in the container DIV.
Using the default index.html template, the calendar is contained within the DIV that has the class 'BBjCalendarWidgetContainer'. Whenever you modify the container DIV in such a way that it affects the calendar's size, such as dynamically changing its margin CSS, you may want to call this method afterwards to cause the calendar to adjust to the new container size.
Note: If you call one of the setPadding() methods then this will be executed automatically after the padding has been added to the container DIV, so this method isn't likely to be needed very often.