Package de.mid.innovator.client
Class InoClientContext
java.lang.Object
de.mid.innovator.client.InoClientContext
The class represents a context that will be created if the JVM is started
by an Innovator client.
The context can be used for data exchange with the client applications. It
contains all kinds of information concerning the selected elements, the actual
repository server, the model and the client program. If the JVM was not started
directly from the model browser, the context also contains an instance of the
presentation context.
The class was designed using the singleton pattern and, therefore, provides the
getInstance() method for finding the instance. The hasContext()
method can be used to check if a program was started from Innovator clients.
if (InoClientContext.hasContext()) {
InoClientContext ctx = InoClientContext.getInstance();
// use data from ctx
rep = ctx.getRepositoryServer();
model = ctx.getModel();
} else {
// no context available
}
- Author:
- borschet
-
Method Summary
Modifier and TypeMethodDescriptionclone()Cloning is not allowed for Inovator Context; this is a singleton object.Gets the client program that started the JVM.static InoClientContextRetrieves the singleton instance of the client context.getModel()Gets the presentation context which should be a diagram or table that is displayed by the client.Gets a synchronized list that can be used to tell the client about elements that have to be shown after the execution of the Java application.Gets the selected items of an Innovator client.Gets the (valid) server context of the client application.static booleanChecks if a client context is available or not.voidsetReplySelection(List<ELElement> replySelection) A synchronized setter to replace the complete list of elements.
-
Method Details
-
hasContext
public static boolean hasContext()Checks if a client context is available or not.- Returns:
- true, if
getInstance()returns a value not equal to null, otherwise false
-
getInstance
Retrieves the singleton instance of the client context.- Returns:
- the singleton instance or null
-
clone
Cloning is not allowed for Inovator Context; this is a singleton object.- Throws:
CloneNotSupportedException
-
getReplySelection
Gets a synchronized list that can be used to tell the client about elements that have to be shown after the execution of the Java application. All kinds of Innovator repository elements can be added or removed during runtime using the standardListmethods.- Returns:
- a list of Innovator elements
-
setReplySelection
A synchronized setter to replace the complete list of elements.- Parameters:
replySelection- a list of elements that should be shown.
-
getSelection
Gets the selected items of an Innovator client.- Returns:
- an unmodifiable list containing (modifiable) instances or null if no elements have been selected.
-
getModel
- Returns:
- the model to which the client is connected, if any.
-
getRepositoryServer
- Returns:
- the repository server to which the client is connected, if any.
-
getSrvContext
Gets the (valid) server context of the client application. The method encapsulates all Innovator clients transparently, regardless of whether they work on a model or not.- Returns:
- an instance of
ModelorRepositoryServerwhich implements the interfaceSrvContext.
-
getPRPresContext
Gets the presentation context which should be a diagram or table that is displayed by the client.- Returns:
- a presentation context
-
getClientProgram
Gets the client program that started the JVM.- Returns:
- a specialization of
InoClientProgramor null if no such information is available.
-