public class ChuiWebDriver extends AbstractChuiDriver implements EmbeddedWebServer, ScreenWebDriver
| Modifier and Type | Class and Description |
|---|---|
private class |
ChuiWebDriver.VT100WebEmulator
Web-specific implementation of the VT100 emulator child process.
|
private class |
ChuiWebDriver.VT100WebRenderer
Swing-specific implementation of the VT100 emulator renderer.
|
ScreenDriver.UriPathAnchor| Modifier and Type | Field and Description |
|---|---|
private BootstrapConfig |
config
Configuration.
|
private java.util.Set<java.lang.String> |
langCache
Language Ids cache
|
private LocalStorageAccessor |
localStorageAccessor
Accessor for localStorage
|
private static CentralLogger |
LOG
Logger.
|
private static java.lang.String |
MAIN_TARGET
Main page root target.
|
static java.lang.String |
NAME
Driver name.
|
private ChuiWebSimulator |
simulator
ChUI simulator.
|
private StorageMessagingWebSocket |
websock
Web-Socket which provides protocol for communication with the browser.
|
private EmbeddedWebServerImpl |
websrv
Delgated implementation for the embedded web server.
|
private static java.lang.String |
WELCOME_PAGE
Welcome page.
|
BEEP_FILE_PATH, direct, factory| Constructor and Description |
|---|
ChuiWebDriver(BootstrapConfig config)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beep()
Emit a sound beep on the terminal.
|
void |
clear()
Clear screen.
|
void |
clientReady()
Notify the driver that the client is ready.
|
boolean |
findAnyIdInChannel(java.lang.String channelName,
java.util.List<java.lang.String> channelIds)
Searches for the specified channel instances and returns
true if any found,
false otherwise. |
BrowserDetails |
getBrowserDetails()
Returns the browser details for web drivers.
|
ChildProcessFactory |
getChildProcessFactory()
Get driver-specific child process factory.
|
KeyValueStorage |
getLocalStorageAccessor(java.lang.String storageId,
java.lang.String fwdUser)
Returns accessor for localStorage for web drivers.
|
java.lang.String |
getName()
Get the driver name.
|
java.lang.String |
getServerURI()
Get the embedded web server's URI.
|
private java.lang.String |
getWelcomePageUrl(java.lang.String pageContext,
java.lang.String pageFile)
Build the name of the main page as a resource locator string.
|
void |
init()
Initialize driver.
|
boolean |
isWeb()
All web-based drivers return
true. |
boolean |
pingBroadcastChannel(java.lang.String channelName,
java.lang.String targetChannelId)
Returns if the target broadcast channel responds with pong.
|
boolean |
pingOnWebSocket()
Check if the WebSocket connection is alive.
|
KeyCode |
readKey()
Read single keystroke from keyboard.
|
void |
registerBroadcastChannel(java.lang.String channelName,
java.lang.String channelId)
Opens a broadcast channel in the client's front-end.
|
void |
resetMode()
Reset current screen mode.
|
void |
resume()
Resume normal driver operation.
|
OsPassChangeInput |
retryPassChangeOnError(java.lang.String osUserName,
java.lang.String errMsg)
Shows an error message in the OS pass change process.
|
void |
setCurrentLanguage(java.lang.String language)
Set new current session language for the client.
|
boolean |
setCursorStatus(boolean on)
Set cursor status (ON/OFF).
|
OsPassChangeInput |
showChangePasswordDialog(java.lang.String osUserName,
boolean isModal)
Shows a dialog to allow the change of the OS account password.
|
void |
showSuccessfulPassChange()
Shows that the OS pass has been changed successfully on the front-end and hide the dialog.
|
void |
shutdown()
Perform driver shutdown.
|
void |
shutdownServer()
Shutdown the embedded web server.
|
java.lang.String |
startupServer(ServerKeyStore keyStore,
BootstrapConfig config,
java.lang.String host,
int port)
Startup the embedded server using the server's key store to build the web server SSL
context.
|
void |
suspend()
Suspend all screen I/O operations.
|
void |
waitInitialization()
Wait for the page to notify that it has fully initialized its JS code.
|
captureMouseEvents, convertToOptions, createOutputManager, handleMouseEvent, updateClientMetricsgetFactory, getHostByName, getHostName, getPrimitives, getWindowSystem, inBackgroundMode, inBatchMode, isChui, playBeep, setBackgroundMode, setBatchMode, setTerminalType, terminalTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddHandler, removeHandlerchooseFiles, deregisterWidget, isEmbeddedClient, lockMousePointer, openMimeResource, openMimeResource, propagate, resume, setControl, suspend, widgetStateChangedpublic static final java.lang.String NAME
private static final CentralLogger LOG
private static final java.lang.String MAIN_TARGET
private static final java.lang.String WELCOME_PAGE
private BootstrapConfig config
private ChuiWebSimulator simulator
private EmbeddedWebServerImpl websrv
private java.util.Set<java.lang.String> langCache
private LocalStorageAccessor localStorageAccessor
private StorageMessagingWebSocket websock
public ChuiWebDriver(BootstrapConfig config)
config - The BootstrapConfig configuration.public java.lang.String getName()
getName in interface ScreenDriver<ChuiOutputManager>public void init()
init in interface ScreenDriver<ChuiOutputManager>init in class AbstractDriver<BasePrimitives,ChuiOutputManager>public KeyValueStorage getLocalStorageAccessor(java.lang.String storageId, java.lang.String fwdUser)
getLocalStorageAccessor in interface ScreenWebDriverstorageId - Unique id for the storage.fwdUser - The FWD user name.KeyValueStorage instance.public BrowserDetails getBrowserDetails()
getBrowserDetails in interface ScreenWebDriverpublic OsPassChangeInput showChangePasswordDialog(java.lang.String osUserName, boolean isModal)
showChangePasswordDialog in interface ScreenWebDriverosUserName - The OS account name.isModal - Flag to indicate if the dialog should be modal (non-dismissible).public void showSuccessfulPassChange()
showSuccessfulPassChange in interface ScreenWebDriverpublic OsPassChangeInput retryPassChangeOnError(java.lang.String osUserName, java.lang.String errMsg)
retryPassChangeOnError in interface ScreenWebDriverosUserName - The OS account name.errMsg - The error message.public void registerBroadcastChannel(java.lang.String channelName,
java.lang.String channelId)
registerBroadcastChannel in interface ScreenWebDriverchannelName - The name of the channel. The same for all instances of the app. Usually package root.channelId - The ID of the channel. Unique for this instance of the app. Usually session ID.public boolean pingBroadcastChannel(java.lang.String channelName,
java.lang.String targetChannelId)
pingBroadcastChannel in interface ScreenWebDriverchannelName - The name of the channel. The same for all instances of the app. Usually package root.targetChannelId - The id of the target channel. Unique for this instance of the app. Usually session ID.true if the target broadcast channel responds with pong,
false otherwise.public boolean findAnyIdInChannel(java.lang.String channelName,
java.util.List<java.lang.String> channelIds)
true if any found,
false otherwise.findAnyIdInChannel in interface ScreenWebDriverchannelName - The broadcast channel name.channelIds - A list of channel ids to check for.true if any of the channel instances found, false otherwise.public boolean pingOnWebSocket()
pingOnWebSocket in interface ScreenWebDrivertrue if the websocket connection is alive, false otherwise.public void beep()
beep in interface ScreenDriver<ChuiOutputManager>public void clear()
This method should clear the screen and perform necessary flushing of the system-specific buffers if necessary. Users of this method assume that actual screen appearance as it is visible to the user is properly changed upon exit from this method.
clear in interface ScreenDriver<ChuiOutputManager>public ChildProcessFactory getChildProcessFactory()
getChildProcessFactory in interface ScreenDriver<ChuiOutputManager>public KeyCode readKey()
readKey in interface ScreenDriver<ChuiOutputManager>null if no keys were pressed since last call.public void resetMode()
Upon exit from this method P2J assumes that screen is in correct state and can be used for interaction with the user.
resetMode in interface ScreenDriver<ChuiOutputManager>public void resume()
resume in interface ScreenDriver<ChuiOutputManager>public void suspend()
suspend in interface ScreenDriver<ChuiOutputManager>public boolean setCursorStatus(boolean on)
throws java.lang.IllegalStateException
The implementation of this method should show/hide actual screen cursor visible to user. Remaining code assumes that actual cursor status visible to user is properly changed upon exit from this method.
setCursorStatus in interface ScreenDriver<ChuiOutputManager>setCursorStatus in class AbstractChuiDriveron - true - show cursor, false - hide cursor.true if operation was successful.java.lang.IllegalStateExceptionpublic void shutdown()
shutdown in interface ScreenDriver<ChuiOutputManager>shutdown in class AbstractDriver<BasePrimitives,ChuiOutputManager>public java.lang.String startupServer(ServerKeyStore keyStore, BootstrapConfig config, java.lang.String host, int port)
There are two page handlers. One is for the root ("/") target and the other is for the index ("/index.html") target. Both load the same page index.html.
When the user is first redirected the URL is https://server:port/ and the
target is "/". The index.html page is loaded for this target.
After redirection and the main page is loaded, the URL in the browser address bar will
become https://server:port/index.html and the corresponding target is now
"/index.html".
When the user reloads the main page within the browser environment the "/index.html" target is sent to the web server and the same main page index.html is loaded.
startupServer in interface EmbeddedWebServerkeyStore - The exported server KeyStore.config - Client configuration.port - An explicit port to start the web server or 0 to let the OS assign one.host - An explicit host to start the web server or null to use the server's
host.public void shutdownServer()
shutdownServer in interface EmbeddedWebServerpublic java.lang.String getServerURI()
getServerURI in interface EmbeddedWebServerpublic void waitInitialization()
waitInitialization in interface EmbeddedWebServerpublic void clientReady()
clientReady in interface ScreenDriver<ChuiOutputManager>public boolean isWeb()
true.isWeb in interface ScreenDriver<ChuiOutputManager>public void setCurrentLanguage(java.lang.String language)
setCurrentLanguage in interface ScreenDriver<ChuiOutputManager>setCurrentLanguage in interface ScreenWebDriverlanguage - The language identifierprivate java.lang.String getWelcomePageUrl(java.lang.String pageContext,
java.lang.String pageFile)
pageContext - Page context root.pageFile - Main page HTML file.