Interface Luwrain
- All Superinterfaces:
HookContainer
,PropertiesBase
org.luwrain.controls
and org.luwrain.popups
always encapsulate an instance of the Luwrain
class,
guaranteeing that they cannot offer more access to the system core than allowed by the provided Luwrain
instance.
The core generates a new instance of this class for each newly launched application or loaded extension.
This mechanism enables the environment to identify which application or extension has initiated a specific request.
Applications receive their associated object through the onLaunch()
method,
while extensions obtain the corresponding instance through the arguments of the methods they override.
It is crucial to keep the provided instance confidential.
It might seem slightly confusing that an extension and the applications launched by it receive different instances of the Luwrain
class.
However, this distinction is necessary to differentiate multiple instances of the same application,
as an extension can be loaded only once.
Different instances of the Luwrain
class may offer varying levels of access.
This design is essential to ensure that extensions are more precise and transparent in their operations.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
static enum
static enum
static enum
static enum
static enum
Nested classes/interfaces inherited from interface org.luwrain.core.HookContainer
HookContainer.Hook, HookContainer.HookResult, HookContainer.HookRunner
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
announcement
(String text, Luwrain.AnnouncementType type, String component, String category, Map<String, String> args) callUiSafely
(Callable callable) void
closeApp()
void
crash
(org.luwrain.app.crash.App app) <T> T
createInstance
(Class<T> c) createTempFile
(String prefix) escapeString
(String style, String text) void
executeBkg
(Runnable runnable) findFetchers
(String url) getActiveAreaText
(Luwrain.AreaTextType type, boolean issueErrorMessage) String[]
getAppDataDir
(String appName) Returns a path to the directory where the application may safely store its auxiliary data.int
getAreaVisibleHeight
(Area area) int
getAreaVisibleWidth
(Area area) int
int
getScriptFilesList
(String componentName) getSpeakableText
(String text, Luwrain.SpeakableTextType type) getUniRefInfo
(String uniRef) org.luwrain.i18n.I18n
i18n()
void
void
<C> C
loadScript
(ScriptSource scriptSource) loadSpeechChannel
(String engineName, String params) void
void
message
(String text, Luwrain.MessageType messageType) void
newJob
(String name, String[] args, String dir, Set<Luwrain.JobFlags> flags, Job.Listener listener) void
onAreaNewBackgroundSound
(Area area) void
onAreaNewContent
(Area area) Notifies the environment that the area gets new content.void
onAreaNewHotPoint
(Area area) Notifies the environment that the area gets new position of the hot point.void
onAreaNewName
(Area area) Notifies the environment that the area gets new name.void
void
void
boolean
boolean
openUniRef
(String uniRef) boolean
openUniRef
(UniRefInfo uniRefInfo) boolean
void
void
/** Plays one of the system sounds.void
boolean
registerExtObj
(ExtensionObject extObj) Registers new extension object.boolean
runCommand
(String command) runLaterSync
(Callable callable) void
runUiSafely
(Runnable runnable) boolean
<C> void
saveConf
(C conf) void
sendBroadcastEvent
(SystemEvent event) void
sendInputEvent
(InputEvent event) void
setActiveArea
(Area area) Sets the new active area of the application.void
setEventResponse
(EventResponse eventResponse) void
showGraphical
(Interaction.GraphicalMode graphicalMode) void
silence()
void
void
void
void
void
speakLetter
(char letter) void
speakLetter
(char letter, int pitch) void
speakLetter
(char letter, int pitch, int rate) staticStr
(org.luwrain.i18n.LangStatic id) suggestContentType
(File file, ContentTypes.ExpectedType expectedType) suggestContentType
(URL url, ContentTypes.ExpectedType expectedType) boolean
unloadDynamicExtension
(String extId) <C> void
updateConf
(Class<C> configClass, ConfigUpdate<C> func) String[]
int
int
boolean
xQuit()
void
xSetSpeechPitch
(int value) void
xSetSpeechRate
(int value) Methods inherited from interface org.luwrain.core.HookContainer
runHooks
Methods inherited from interface org.luwrain.core.PropertiesBase
getFileProperty, getProperty
-
Field Details
-
PATH_SYS_DATA_DIR
- See Also:
-
PATH_SYS_JS_DIR
- See Also:
-
PROP_DIR_DATA
- See Also:
-
PROP_DIR_JS
- See Also:
-
PROP_DIR_USERHOME
- See Also:
-
PROP_DIR_SOUNDS
- See Also:
-
-
Method Details
-
saveConf
<C> void saveConf(C conf) -
loadConf
-
updateConf
-
getDir
-
announceActiveArea
void announceActiveArea() -
callUiSafely
-
closeApp
void closeApp() -
crash
void crash(org.luwrain.app.crash.App app) -
announcement
-
getActiveAreaAttr
-
getActiveAreaText
-
getAllShortcutNames
String[] getAllShortcutNames() -
getAppDataDir
Returns a path to the directory where the application may safely store its auxiliary data. The returned directory, if it it isn'tnull
, always exists and always belongs to the current user. Meaning, different users get different directories for the same application. Application must be identified with some short string. We discourage using application names starting with "luwrain.", because such names are usually used by the applications from LUWRAIN standard distribution.- Parameters:
appName
- A short string for application identification, the same application name will result in the same directory- Returns:
- The application data directory or
null
if the directory cannot be created
-
createTempFile
-
getAreaVisibleHeight
-
getAreaVisibleWidth
-
getClipboard
Clipboard getClipboard() -
xGetLoadedSpeechFactories
String[] xGetLoadedSpeechFactories() -
getMediaResourcePlayers
MediaResourcePlayer[] getMediaResourcePlayers() -
getPlayer
Player getPlayer() -
getPath
-
getString
-
loadScript
- Throws:
ExtensionException
-
getScreenWidth
int getScreenWidth() -
getScreenHeight
int getScreenHeight() -
getUniRefInfo
-
executeBkg
-
i18n
org.luwrain.i18n.I18n i18n() -
launchApp
-
launchApp
-
loadSpeechChannel
- Throws:
SpeechException
-
message
-
message
-
message
-
createInstance
-
findFetchers
-
onAreaNewBackgroundSound
-
onAreaNewHotPoint
Notifies the environment that the area gets new position of the hot point. This method causes updating of the visual position of the hot point on the screen for low vision users. Please keep in mind that this method doesn't produce any speech announcement of the new position and you should do that on your own, depending on the behaviour of your application.- Parameters:
area
- The area which gets new position of the hot point
-
onAreaNewContent
Notifies the environment that the area gets new content. This method causes updating of the visual representation of the area content on the screen for low vision users. Please keep in mind that this method doesn't produce any speech announcement of the changes and you should do that on your own, depending on the behaviour of your application.- Parameters:
area
- The area which gets new content
-
onAreaNewName
Notifies the environment that the area gets new name. This method causes updating of the visual title of the area on the screen for low vision users. Please keep in mind that this method doesn't produce any speech announcement of name changes and you should do that on your own, depending on the behaviour of your application.- Parameters:
area
- The area which gets new name
-
onNewAreaLayout
void onNewAreaLayout() -
openFile
-
openFiles
-
openHelp
-
openUniRef
-
openUniRef
-
openUrl
-
playSound
/** Plays one of the system sounds. This method takes an identifier of the system sound, stops any previous playing, if there was any, and plays. The exact sound is selected depending on user's settings. Please node that sounds playing isn't interfering with speech.- Parameters:
sound
- The identifier of the sound to play
-
playSound
-
popup
-
registerExtObj
Registers new extension object. This operation is allowed for highly privileged interfaces only, what, for example, can be useful for custom startup and shutdown procedures. Custom objects may be of any kind, they are registered as they would be a part of the core.- Parameters:
extObj
- The object to register- Returns:
- True if the object was successfully registered, false otherwise
- Throws:
RuntimeException
- on any attempt to do this operation without enough privileged level
-
runCommand
-
newJob
Job newJob(String name, String[] args, String dir, Set<Luwrain.JobFlags> flags, Job.Listener listener) -
runLaterSync
-
runUiSafely
-
runWorker
-
speak
-
speak
-
speakLetter
void speakLetter(char letter) -
speak
-
speak
-
speakLetter
void speakLetter(char letter, int pitch) -
sendBroadcastEvent
-
sendInputEvent
-
setActiveArea
Sets the new active area of the application. This method asks the environment to choose another visible area as an active area of the application. This operation is applicable only to regular areas, not for popup areas, for which it is pointless. In contrast toonAreaNewHotPoint()
,onAreaNewName()
andonAreaNewContent()
methods, this one produces proper introduction of the area being activated.- Parameters:
area
- The area to choose as an active
-
setEventResponse
-
silence
void silence() -
speakLetter
void speakLetter(char letter, int pitch, int rate) -
staticStr
-
suggestContentType
-
getSpeakableText
-
suggestContentType
-
unloadDynamicExtension
-
xQuit
boolean xQuit() -
xSetSpeechRate
void xSetSpeechRate(int value) -
xGetSpeechRate
int xGetSpeechRate() -
xGetSpeechPitch
int xGetSpeechPitch() -
xSetSpeechPitch
void xSetSpeechPitch(int value) -
showGraphical
-
getScriptFilesList
-
escapeString
-