public final class AppContext
extends java.lang.Object
setApplication(Object)
method. Other parts of the code will call
the method getApplication()
to obtain information about MARK interfaces
implemented by the application.
The AppContext also has methods to register current progress bar so if a process spans across multiple sub-processes every process defines its duration from the range 0 to 100 and also specifies the relative length of every sub-process
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
getApplication()
Obtains back the application object set by a call to
setApplication(Object) . |
static java.lang.Object |
getAppRuntimeProperty(java.lang.String runtimePropertyKey)
Returns the value of a runtime property previously added with a call to
putAppRuntimeProperty(String, Object) . |
static DTSLoadingBarInterface |
getBar()
Access to the registered Loading Bar.
|
static java.lang.String |
getThreadLocalRuntimePropertyKey(java.lang.String propertyKey)
Obtains or creates a property name that is unique for the current thread
and based on the property key passed in in the
propertyKey
parameter. |
static boolean |
isExpress()
Helper method that returns true if the application is the XBRLExpress.
|
static boolean |
isViewer()
Helper method that returns true if the application is the XBRLViewer.
|
static void |
putAppRuntimeProperty(java.lang.String runtimePropertyKey,
java.lang.Object value)
Sets the value of a runtime property than can be used where it is needed in the current application.
|
static void |
setApplication(java.lang.Object app)
When an application starts a call to this method will
register the application instance for future reference.
|
static void |
setBar(DTSLoadingBarInterface bar)
Some long processes uses a progress bar and the process
might be executed in another thread then the Swing AWT
thread.
|
public static void setApplication(java.lang.Object app)
For instance, the code can check if the application satisfies certain interface and then cast the application to that interface and obtain a value
app
- the application instancepublic static java.lang.Object getApplication()
setApplication(Object)
.public static boolean isExpress()
public static boolean isViewer()
public static void setBar(DTSLoadingBarInterface bar)
bar
- the new barpublic static DTSLoadingBarInterface getBar()
public static java.lang.String getThreadLocalRuntimePropertyKey(java.lang.String propertyKey)
propertyKey
parameter.propertyKey
- the property keypublic static java.lang.Object getAppRuntimeProperty(java.lang.String runtimePropertyKey)
putAppRuntimeProperty(String, Object)
. Runtime properties try to alleviate the need
to pass multiple objects in constructors. The idea is to add them to this static application
context and use them by the runtime property key.runtimePropertyKey
- the runtime property keypublic static void putAppRuntimeProperty(java.lang.String runtimePropertyKey, java.lang.Object value)
Remarks, when runtime properties depends on threads, it is necessary to distinguish them using an unique key. It is possible to obtain a key that is different depending on the calling thread by using a call to
Remember to call this method with a proper key and null value when the runtime property is no longer needed to prevent memory leaks.
it is possible to obtain a correspondent unique key for the current thread by calling
getThreadLocalRuntimePropertyKey(String)
to obtain a new key
runtimePropertyKey
- the runtime property keyvalue
- the new value to set to the runtime property. If null, the previous value will be removedCopyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa