public class SC
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTOID |
static java.lang.String |
AUTOIDCLASS |
static java.lang.String |
MODULE |
static java.lang.String |
REF |
Constructor and Description |
---|
SC() |
Modifier and Type | Method and Description |
---|---|
static void |
ask(java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "Yes" and "No" buttons.
|
static void |
ask(java.lang.String title,
java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "Yes" and "No" buttons.
|
static void |
ask(java.lang.String title,
java.lang.String message,
BooleanCallback callback,
Dialog dialogProperties)
Show a modal dialog with a message, icon, and "Yes" and "No" buttons.
|
static void |
askforValue(java.lang.String title,
java.lang.String message,
java.lang.String defaultValue,
ValueCallback callback,
Dialog dialogProperties)
Show a modal dialog with a text entry box, asking the user to enter a value.
|
static void |
askforValue(java.lang.String title,
java.lang.String message,
ValueCallback callback)
Show a modal dialog with a text entry box, asking the user to enter a value.
|
static void |
askforValue(java.lang.String message,
ValueCallback callback)
Show a modal dialog with a text entry box, asking the user to enter a value.
|
static void |
clearLogPriority(java.lang.String category)
Clear the priority for a log category.
|
static void |
clearPrompt()
Clear the modal prompt being shown to the user.
|
static void |
confirm(java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "OK" and "Cancel" buttons.
|
static void |
confirm(java.lang.String title,
java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "OK" and "Cancel" buttons.
|
static void |
confirm(java.lang.String title,
java.lang.String message,
BooleanCallback callback,
Dialog dialogProperties)
Show a modal dialog with a message, icon, and "OK" and "Cancel" buttons.
|
static void |
debugger()
Launch the browser's JavaScript debugger.
|
static void |
disableFirebug()
Disable firebug.
|
static void |
dismissCurrentDialog()
If a dialog triggered via
say(String) , ask(String, BooleanCallback) ,
warn(String) , confirm(String, BooleanCallback) or askforValue(String, ValueCallback)
is currently visible, it will be dismissed. |
static java.lang.String |
echo(com.google.gwt.core.client.JavaScriptObject object)
Returns the passed in JavaScript object as a string
|
static java.lang.String |
echoAll(com.google.gwt.core.client.JavaScriptObject object)
Returns the passed in JavaScript object as a string (including serializing members
one level deep for javascript arrays and nested objects)
|
static java.lang.String |
echoLeaf(java.lang.Object value)
Return a very short (generally less than 40 characters) string representation of any object,
suitable for viewing by a developer for debugging purposes.
|
static java.lang.String |
generateID()
Internal method - do not call from Application code.
|
static java.lang.String |
generateID(java.lang.String className)
Internal method - do not call from Application code.
|
static java.lang.String |
getAUTOIDClass(java.lang.String className)
Internal method - do not call from Application code.
|
static java.lang.String |
getHome()
Get the root directory for Isomorphic-supplied SmartClient files - the directory
containing the modules/ and system/ subdirectories extracted when the SmartGWT project is
built.
|
static java.lang.String |
getJSStackTrace()
Returns the current stack trace, from a JavaScript perspective.
|
static java.lang.String |
getLicenseType()
Internal method - do not call from Application code.
|
static java.lang.String |
getSCClassName(com.google.gwt.core.client.JavaScriptObject jsObj)
Gets the name of this underlying SmartClient class as a string.
|
static java.lang.String |
getScParityStableVersionNumber()
Internal method - do not call from Application code.
|
static java.lang.String |
getScVersion()
Internal method - do not call from Application code.
|
static java.lang.String |
getScVersionNumber()
Internal method - do not call from Application code.
|
static java.lang.String |
getSgwtParityStableVersionNumber()
Internal method - do not call from Application code.
|
static java.lang.String |
getSgwtVersion()
Internal method - do not call from Application code.
|
static java.lang.String |
getSgwtVersionNumber()
Internal method - do not call from Application code.
|
static boolean |
hasAnalytics()
Returns true if the optional Analytics module has been loaded.
|
static boolean |
hasCharts()
Returns true if the optional Charts module has been loaded.
|
static boolean |
hasDashboardAndTools()
Returns true if the optional Dashboard & Tools module is available.
|
static boolean |
hasDrawing()
Returns true if the optional Drawing module has been loaded.
|
static boolean |
hasFirebug()
Returns
true if Firebug is enabled. |
static boolean |
hasPluginBridges()
Returns true if the optional PluginBridges module has been loaded.
|
static boolean |
hasRealtimeMessaging()
Returns true if the optional RealtimeMessaging module has been loaded.
|
static boolean |
hasTour()
Returns true if the optional Tour module has been loaded.
|
static boolean |
hasWorkflow()
Returns true if the optional Workflow module has been loaded.
|
static boolean |
isIE()
Internal method - do not call from Application code.
|
static boolean |
isMethodSupported(java.lang.String className,
java.lang.String methodName)
Returns true if the method is supported by the class, meaning that it is not null
and was not replaced by
markUnsupportedMethods(String, String, String[]) . |
static boolean |
isStable()
Internal method - do not call from Application code.
|
static boolean |
keepGlobals()
Internal method - do not call from Application code.
|
static void |
logDebug(java.lang.String message)
Log a debugging.
|
static void |
logDebug(java.lang.String message,
java.lang.String category)
Log a debugging
|
static void |
logEcho(Canvas canvas)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEcho(Canvas canvas,
java.lang.String message)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEcho(com.google.gwt.core.client.JavaScriptObject value)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEcho(com.google.gwt.core.client.JavaScriptObject value,
java.lang.String message)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEchoAll(Canvas canvas)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEchoAll(Canvas canvas,
java.lang.String message)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEchoAll(com.google.gwt.core.client.JavaScriptObject value)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logEchoAll(com.google.gwt.core.client.JavaScriptObject value,
java.lang.String message)
Logs the echoed object as a warning, prefixed with an optional message.
|
static void |
logInfo(java.lang.String message)
Log an informative message.
|
static void |
logInfo(java.lang.String message,
java.lang.String category)
Log an informative message.
|
static boolean |
logIsDebugEnabled(java.lang.String category)
Check whether a message logged at "debug" priority would be visible in the log.
|
static boolean |
logIsInfoEnabled(java.lang.String category)
Check whether a message logged at "info" priority would be visible in the log.
|
static void |
logWarn(java.lang.String message)
Log a warning.
|
static void |
logWarn(java.lang.String message,
java.lang.String category)
Log a warning.
|
static void |
markUnsupportedMethods(java.lang.String className,
java.lang.String messageTemplate,
java.lang.String[] methodNames)
Replaces each of the methods named in methodNames with a new implementation that
simply logs a warning the first time the method is called, and nothing else.
|
static MessageID |
notify(java.lang.String contents) |
static MessageID |
notify(java.lang.String contents,
NotifyAction... actions) |
static MessageID |
notify(java.lang.String contents,
NotifyAction[] actions,
java.lang.String notifyType)
Displays a new message that's automatically dismissed after a configurable amount of
time, as an alternative to
#confirm,modal notification dialogs that can lower end
user productivity. |
static void |
openDataSourceConsole()
Opens the DataSource admin console in a separate window.
|
static void |
openDataSourceGenerator()
Opens the DataSource Generator Wizard in a separate window.
|
static void |
openVisualBuilder()
Deprecated.
The Visual Builder tool has been superceded by Reify
|
static void |
releaseID(java.lang.String className,
java.lang.String id)
Internal method - do not call from Application code.
|
static void |
say(java.lang.String message)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
say(java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
say(java.lang.String title,
java.lang.String message)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
say(java.lang.String title,
java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
setEnableJSDebugger(boolean useDebugger)
Setting this to true will result in the IE / Firebug / Safari debugger being invoked when a JavaScript error is encountered.
|
static void |
setLogPriority(java.lang.String category,
LogPriority priority)
Set the priority for a log category.
|
static void |
setScreenReaderMode(boolean newState)
Enables full screen reader mode.
|
static void |
showConsole()
Open the SmartClient Developer Console.
|
static void |
showPrompt(java.lang.String message)
Show a modal prompt to the user.
|
static void |
showPrompt(java.lang.String title,
java.lang.String message)
Show a modal prompt to the user.
|
static void |
showPrompt(java.lang.String title,
java.lang.String message,
Dialog dialogProperties)
Show a modal prompt to the user.
|
static void |
traceLogMessage(java.lang.String messagePattern)
Causes a stack trace to be logged any time a message containing the provided pattern is
logged.
|
static void |
traceLogMessage(java.lang.String messagePattern,
java.lang.String prefix)
Causes a stack trace to be logged any time a message containing the provided pattern is
logged.
|
static void |
warn(java.lang.String message)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
warn(java.lang.String message,
BooleanCallback callback)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
warn(java.lang.String title,
java.lang.String message)
Show a modal dialog with a message, icon, and "OK" button.
|
static void |
warn(java.lang.String title,
java.lang.String message,
BooleanCallback callback,
Dialog dialogProperties)
Show a modal dialog with a message, icon, and "OK" button.
|
public static final java.lang.String REF
public static final java.lang.String MODULE
public static final java.lang.String AUTOID
public static final java.lang.String AUTOIDCLASS
public static java.lang.String getLicenseType()
public static java.lang.String getAUTOIDClass(java.lang.String className)
public static java.lang.String generateID()
public static java.lang.String generateID(java.lang.String className)
public static void releaseID(java.lang.String className, java.lang.String id)
public static boolean keepGlobals()
public static java.lang.String getHome()
window.isomorphicDir
before loading the SmartClient library files.isomorphicDir
URL
public static void debugger()
Debugging
for how to approach debugging a SmartGWT Application.public static void showConsole()
Debugging
for how to approach debugging a SmartGWT Application.public static void openDataSourceConsole()
Requires Smart GWT Pro or better.
public static void openVisualBuilder()
Requires Smart GWT Pro or better.
public static void openDataSourceGenerator()
Requires Smart GWT Enterprise or Eval.
public static java.lang.String getSCClassName(com.google.gwt.core.client.JavaScriptObject jsObj)
jsObj
- the smartclient objectpublic static boolean hasFirebug()
true
if Firebug is enabled.true
if Firebug is enabled; false
otherwise.public static boolean isIE()
public static void disableFirebug()
public static void say(java.lang.String message)
sayIcon
.message
- the messagepublic static void setLogPriority(java.lang.String category, LogPriority priority)
category
- the name of the category to set the priority forpriority
- the LogPriority to set for the passed categorypublic static void clearLogPriority(java.lang.String category)
category
- the name of the category to clear the log priority ofpublic static void say(java.lang.String title, java.lang.String message)
sayIcon
.title
- the title of the message boxmessage
- the messagepublic static void say(java.lang.String message, BooleanCallback callback)
sayIcon
.
The callback will receive boolean true for an OK button click, or null if the Dialog is dismissed via the close button.
message
- the messagecallback
- the callback to fire when the user dismisses the dialog.public static void say(java.lang.String title, java.lang.String message, BooleanCallback callback)
sayIcon
.
The callback will receive boolean true for an OK button click, or null if the Dialog is dismissed via the close button.
title
- the title of the message boxmessage
- the messagecallback
- the callback to fire when the user dismisses the dialog.public static void ask(java.lang.String message, BooleanCallback callback)
askIcon
.
The callback will receive boolean true for a Yes button click, boolean false for a No button click, or null if the Dialog is dismissed via the close button.
message
- the messagecallback
- the callback to fire when the user dismisses the dialog.public static void ask(java.lang.String title, java.lang.String message, BooleanCallback callback)
askIcon
.
The callback will receive boolean true for a Yes button click, boolean false for a No button click, or null if the Dialog is dismissed via the close button.
title
- the title of the message boxmessage
- the messagecallback
- the callback to fire when the user dismisses the dialog.public static void ask(java.lang.String title, java.lang.String message, BooleanCallback callback, Dialog dialogProperties)
askIcon
.
The callback will receive boolean true for a Yes button click, boolean false for a No button click, or null if the Dialog is dismissed via the close button.
title
- the title of the message boxmessage
- the messagecallback
- the callback to fire when the user dismisses the dialog.public static void askforValue(java.lang.String message, ValueCallback callback)
As with other convenience methods that show Dialogs, such as #warn(String, String, BooleanCallback)
, the dialog is shown
and the function immediately returns. When the user responds, the provided callback is called.
If the user clicks OK, the value typed in is passed to the callback (including the empty string ("") if nothing was entered. If the user clicks cancel, the value passed to the callback is null.
A default value for the text field can be passed via properties.defaultValue
Keyboard focus is automatically placed in the text entry field, and hitting the enter key is the equivalent of pressing OK.
message
- message to displaycallback
- Callback to fire when the user clicks a button to dismiss the dialog. This has the single parameter 'value',
indicating the user entry, or null if cancel was pressed or the window closedpublic static void askforValue(java.lang.String title, java.lang.String message, ValueCallback callback)
As with other convenience methods that show Dialogs, such as #warn(String, String, BooleanCallback)
, the dialog is shown
and the function immediately returns. When the user responds, the provided callback is called.
If the user clicks OK, the value typed in is passed to the callback (including the empty string ("") if nothing was entered. If the user clicks cancel, the value passed to the callback is null.
Keyboard focus is automatically placed in the text entry field, and hitting the enter key is the equivalent of pressing OK.
title
- the title of the dialogmessage
- message to displaycallback
- Callback to fire when the user clicks a button to dismiss the dialog. This has the single parameter 'value',
indicating the user entry, or null if cancel was pressed or the window closedpublic static void askforValue(java.lang.String title, java.lang.String message, java.lang.String defaultValue, ValueCallback callback, Dialog dialogProperties)
As with other convenience methods that show Dialogs, such as #warn(String, String, BooleanCallback)
, the dialog is shown
and the function immediately returns. When the user responds, the provided callback is called.
If the user clicks OK, the value typed in is passed to the callback (including the empty string ("") if nothing was entered. If the user clicks cancel, the value passed to the callback is null.
Keyboard focus is automatically placed in the text entry field, and hitting the enter key is the equivalent of pressing OK.
title
- the title of the dialogmessage
- message to displaydefaultValue
- the default value of the text fieldcallback
- Callback to fire when the user clicks a button to dismiss the dialog. This has the single parameter 'value',
indicating the user entry, or null if cancel was pressed or the window closeddialogProperties
- additional properties of the Dialogpublic static void dismissCurrentDialog()
say(String)
, ask(String, BooleanCallback)
,
warn(String)
, confirm(String, BooleanCallback)
or askforValue(String, ValueCallback)
is currently visible, it will be dismissed. The callback passed to the relevant method will never fire.
Note this is a rarely used API with very few valid use cases. As an example, perhaps some kind of
periodic (non-user triggered) event would cause an entire area of the UI to be removed (such as a tab)
and the system wants to ensure that no modal dialogs are currently showing from that part of the UI.
In this case, while dismissCurrentDialog
could be used to ensure the part of the UI being
removed didn't leave behind a modal dialog.
To clear a modal prompt shown by showPrompt(String)
, use clearPrompt()
instead.
public static void showPrompt(java.lang.String message)
Note: if this prompt is to be shown to the user during some slow logic, we advise calling this method, then
using DeferredCommand
to kick off the slow logic in a separate thread. This ensures that
the prompt is showing before the lengthy execution begins.
message
- message to displayclearPrompt()
public static void showPrompt(java.lang.String title, java.lang.String message, Dialog dialogProperties)
Note: if this prompt is to be shown to the user during some slow logic, we advise calling this method, then
using DeferredCommand
to kick off the slow logic in a separate thread. This ensures that
the prompt is showing before the lengthy execution begins.
title
- the title of the dialogmessage
- message to displaydialogProperties
- additional properties for the DialogclearPrompt()
public static void showPrompt(java.lang.String title, java.lang.String message)
Note: if this prompt is to be shown to the user during some slow logic, we advise calling this method, then
using DeferredCommand
to kick off the slow logic in a separate thread. This ensures that
the prompt is showing before the lengthy execution begins.
title
- the title of the dialogmessage
- message to displayclearPrompt()
public static void clearPrompt()
public static void confirm(java.lang.String message, BooleanCallback callback)
confirmIcon
.
The callback will receive boolean true for an OK button click, or null for a Cancel click or if the Dialog is dismissed via the close button.
message
- message to displaycallback
- Callback to fire when the user clicks a button to dismiss the dialog.public static void confirm(java.lang.String title, java.lang.String message, BooleanCallback callback)
confirmIcon
.
The callback will receive boolean true for an OK button click, or null for a Cancel click or if the Dialog is dismissed via the close button.
title
- the title of the dialogmessage
- message to displaycallback
- Callback to fire when the user clicks a button to dismiss the dialog.public static void confirm(java.lang.String title, java.lang.String message, BooleanCallback callback, Dialog dialogProperties)
confirmIcon
.
The callback will receive boolean true for an OK button click, or null for a Cancel click or if the Dialog is dismissed via the close button.
title
- the title of the dialogmessage
- message to displaycallback
- Callback to fire when the user clicks a button to dismiss the dialog.dialogProperties
- additional properties for the Dialogpublic static void warn(java.lang.String message)
warnIcon
.message
- the messagepublic static void warn(java.lang.String title, java.lang.String message)
warnIcon
.
title
- the title of the dialogmessage
- the messagepublic static void warn(java.lang.String message, BooleanCallback callback)
warnIcon
.
The callback will receive boolean true for an OK button click, or null if the Dialog is dismissed via the close button.
message
- the messagecallback
- Optional Callback to fire when the user dismisses the dialog.public static void warn(java.lang.String title, java.lang.String message, BooleanCallback callback, Dialog dialogProperties)
warnIcon
.
The callback will receive boolean true for an OK button click, or null if the Dialog is dismissed via the close button.
title
- the title of the dialogmessage
- the messagecallback
- Optional Callback to fire when the user dismisses the dialog.dialogProperties
- additional properties for the Dialogpublic static void logWarn(java.lang.String message)
message
- the message to logpublic static void logWarn(java.lang.String message, java.lang.String category)
message
- the message to logcategory
- category to log in, defaults to "Log"public static void logInfo(java.lang.String message)
message
- the message to logpublic static void logInfo(java.lang.String message, java.lang.String category)
message
- the message to logcategory
- category to log in, defaults to "Log"public static void logDebug(java.lang.String message)
message
- the message to logpublic static void logDebug(java.lang.String message, java.lang.String category)
message
- the message to logcategory
- category to log in, defaults to "Log"public static void logEcho(com.google.gwt.core.client.JavaScriptObject value)
value
- object to echopublic static void logEcho(com.google.gwt.core.client.JavaScriptObject value, java.lang.String message)
value
- object to echomessage
- the message to logpublic static void logEcho(Canvas canvas)
canvas
- canvas to echopublic static void logEcho(Canvas canvas, java.lang.String message)
canvas
- canvas to echomessage
- the message to logpublic static void logEchoAll(com.google.gwt.core.client.JavaScriptObject value)
value
- object to echopublic static void logEchoAll(com.google.gwt.core.client.JavaScriptObject value, java.lang.String message)
value
- object to echomessage
- the message to logpublic static void logEchoAll(Canvas canvas)
canvas
- canvas to echopublic static boolean logIsInfoEnabled(java.lang.String category)
category
- category to check; defaults to "Log"public static java.lang.String echoLeaf(java.lang.Object value)
value
- object to echopublic static boolean logIsDebugEnabled(java.lang.String category)
category
- category to check; defaults to "Log"public static MessageID notify(java.lang.String contents)
notify(java.lang.String)
public static MessageID notify(java.lang.String contents, NotifyAction... actions)
notify(java.lang.String)
public static MessageID notify(java.lang.String contents, NotifyAction[] actions, java.lang.String notifyType)
#confirm,modal notification
dialogs that can lower end
user productivity.
This method is simply a shorthand way to call
Notify.addMessage()
. For
further study, see the Notify
class
overview, and the class methods
Notify.dismissMessage()
.
Notify.configureMessages()
.
contents
- message to be displayed.
See HTMLString
actions
- actions (if any) for this messagenotifyType
- category of message; default "message".
See NotifyType
public static java.lang.String getJSStackTrace()
configured for debugging
.
In Classic DevMode, this API will provide very limited information - stack frames corresponding to Java code will likely be displayed as anonymous functions, and many or most such frames will be missing. For DevMode, it's preferable to use GWT-supported Java APIs to capture the stack, such as for example:
Throwable t = new Throwable(); String stack = ""; for (StackTraceElement element : t.getStackTrace()) { stack += element + "\n"; } SC.logDebug("Current location: " + stack);Grabbing Java
Debugging
public static void setEnableJSDebugger(boolean useDebugger)
useDebugger
- default is falsepublic static void logEchoAll(Canvas canvas, java.lang.String message)
canvas
- canvas to echomessage
- the message to logpublic static java.lang.String echo(com.google.gwt.core.client.JavaScriptObject object)
object
- public static java.lang.String echoAll(com.google.gwt.core.client.JavaScriptObject object)
object
- public static boolean hasAnalytics()
public static boolean hasCharts()
public static boolean hasTour()
public static boolean hasWorkflow()
public static boolean hasDrawing()
public static boolean hasPluginBridges()
public static boolean hasRealtimeMessaging()
public static boolean hasDashboardAndTools()
public static void setScreenReaderMode(boolean newState)
Accessibility
.new
- state for screen reader mode (true for enabled, false for disabled)public static boolean isMethodSupported(java.lang.String className, java.lang.String methodName)
markUnsupportedMethods(String, String, String[])
.className
- className to checkmethodName
- methodName to checkpublic static void markUnsupportedMethods(java.lang.String className, java.lang.String messageTemplate, java.lang.String[] methodNames)
The messageTemplate parameter is a template for the warning message logged when the unsupported method is first called. The following variables in the template are substituted as follows:
Variable | Substitution |
---|---|
$class |
The +link{getClassName(),class name}. |
$method |
The name of the method. |
If you want the literal string of a substitution variable to appear in the warning message, you can escape it by prefixing with a dollar sign. For example, to include "$class" in the warning message, use "$$class" in the template.
className
- className containing methods to markmessageTemplate
- template for the warning message logged when first called.
If null, the default template string "$class does not support
the $method() method." is used.methodNames
- the method names to mark as unsupported.public static void traceLogMessage(java.lang.String messagePattern)
The passed messagePattern
is interpreted as a JavaScript regular expression.
messagePattern
- public static void traceLogMessage(java.lang.String messagePattern, java.lang.String prefix)
The passed messagePattern
is interpreted as a JavaScript regular expression.
messagePattern
- prefix
- value to prefix the messagepublic static java.lang.String getScVersion()
public static java.lang.String getScVersionNumber()
public static java.lang.String getSgwtVersion()
public static java.lang.String getSgwtVersionNumber()
public static java.lang.String getScParityStableVersionNumber()
public static java.lang.String getSgwtParityStableVersionNumber()
public static boolean isStable()