Package com.jbstrap.core
Class JavaScriptBuilder
java.lang.Object
com.jbstrap.core.JavaScriptBuilder
- Since:
- 4.0
- Author:
- JBStrap
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringchangeApplicationIcon(String iconFile) static StringchangeContent(String containerId, String newHtmlContent) static StringdeleteCookie(String name) static Stringstatic Stringstatic StringincludeStylesheet(String stylesheetUrl) static Stringstatic StringregisterEvent(Component<?> component, EventType eventType) static Stringstatic Stringstatic Stringstatic Stringstatic StringshowNotification(NotificationType notificationType, String title, String message)
-
Method Details
-
showNotification
public static String showNotification(NotificationType notificationType, String title, String message) - Parameters:
notificationType- The notification type. See theNotificationTypeenum for applicable values.title- The notification title (header text)message- The notification message- Returns:
- The JavaScript necessary to display the notification
- Throws:
NullPointerException- If the notification type isnull
-
changeContent
- Parameters:
containerId- The component ID, of the component that will have it's content changed.newHtmlContent- The new HTML content- Returns:
- The JavaScript that changes the content
-
registerEvent
- Parameters:
component- The component that will have the event registered to.eventType- The event type- Returns:
- The JavaScript responsible event registration
- Throws:
NullPointerException- If the specified component or event type isnull
-
say
- Parameters:
title- The message title (header text)message- The message textlanguage- The language code, determining the button text- Returns:
- The JavaScript responsible for displaying the message
-
error
- Parameters:
title- The message title (header text)message- The message textlanguage- The language code, determining the button text- Returns:
- The JavaScript responsible for displaying the message
-
ask
- Parameters:
title- The message title (header text)text- The message textlanguage- The language code, determining the button textmessageId- The id of the message, that will have the answer from the client.- Returns:
- The generated JavaScript, that displays the question and sends the answer.
-
input
- Parameters:
title- The message title (header text)text- The message textlanguage- The language code, determining the button textmessageId- The id of the message, that will have the answer from the client.- Returns:
- The generated JavaScript, that displays the window, the input field, and sends the inputted text
-
setCookie
- Parameters:
name- The cookie namevalue- The cookie valueexpSec- The cookie expiration, in seconds- Returns:
- The JavaScript, that sets the cookie
- Throws:
NullPointerException- If the specified cookie name isnull
-
deleteCookie
- Parameters:
name- The cookie name- Returns:
- The JavaScript that deletes the cookie.
-
getCookie
- Parameters:
name- The cookie name- Returns:
- The cookie value or empty string, if the cookie doesn't exist in the user's browser
- Throws:
NullPointerException- If the cookie name was specified asnull
-
setTitle
- Parameters:
title- The address bar text- Returns:
- The JavaScript that sets the address bar text
-
setURL
- Parameters:
baseURL- The application's base URLurl- The page URL, that will be added to the base URL- Returns:
- The JavaScript that sets the URL
- Throws:
NullPointerException- If the base url is specified asnull
-
includeStylesheet
- Parameters:
stylesheetUrl- The style sheet's relative URL- Returns:
- The JavaScript that adds the stlye sheet
- Throws:
NullPointerException- If the stylesheet URL isnull
-
changeApplicationIcon
- Parameters:
iconFile- The icon's relative URL- Returns:
- The JavaScript that changes the application icon
- Throws:
NullPointerException- IF the Icon URL isnull
-