Class InoClientContext


  • public class InoClientContext
    extends java.lang.Object
    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 Detail

      • 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

        public static InoClientContext getInstance()
        Retrieves the singleton instance of the client context.
        Returns:
        the singleton instance or null
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Cloning is not allowed for Inovator Context; this is a singleton object.
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • getReplySelection

        public java.util.List<ELElement> 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 standard List methods.
        Returns:
        a list of Innovator elements
      • setReplySelection

        public void setReplySelection​(java.util.List<ELElement> replySelection)
        A synchronized setter to replace the complete list of elements.
        Parameters:
        replySelection - a list of elements that should be shown.
      • getSelection

        public java.util.List<ELElement> 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

        public ExcellenceModel getModel()
        Returns:
        the model to which the client is connected, if any.
      • getRepositoryServer

        public RepositoryServer getRepositoryServer()
        Returns:
        the repository server to which the client is connected, if any.
      • getSrvContext

        public SrvContext 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 Model or RepositoryServer which implements the interface SrvContext.
      • getPRPresContext

        public PRPresContext getPRPresContext()
        Gets the presentation context which should be a diagram or table that is displayed by the client.
        Returns:
        a presentation context
      • getClientProgram

        public InoClientProgram getClientProgram()
        Gets the client program that started the JVM.
        Returns:
        a specialization of InoClientProgram or null if no such information is available.