Class PropMgr

java.lang.Object
com.iizix.prop.PropMgr

public class PropMgr extends Object
The property manager handles creation of generic properties and contains routines to serialize them to or from a transaction. The NameManager that can be retrieved from this class is used to map property names to integer values, i.e. indexes.

Each client session (just one for the client) and several for the server must instanciate this class once and is used throughout the entire session.

Author:
Christopher Mindus
  • Field Details Link icon

  • Method Details Link icon

    • addRemoteTransactionCompletedListener Link icon

      public boolean addRemoteTransactionCompletedListener(IRemoteTransactionCompletedListener listener)
      Adds a new listeners for completed incoming remote read transactions. The listeners added are called in the order they were added once a ReadTransaction from a remote party has completed its update.

      The listener is typically used to process post-updates of multiple client property updates, rather than triggering on a single property update.

      Calling this method multiple times with the same listener will have no effect (but to return false).

      Parameters:
      listener - The listener to add.
      Returns:
      true if the listener was added, false otherwise.
      Throws:
      NullPointerException - If the listener is null.
    • removeRemoteTransactionCompletedListener Link icon

      public boolean removeRemoteTransactionCompletedListener(IRemoteTransactionCompletedListener listener)
      Removes an existing listener for completed incoming remote read transactions.

      Calling this method multiple times with the same listener will have no effect (but to return false).

      Parameters:
      listener - The listener to remove.
      Returns:
      true if listener is successfully removed, false otherwise.
    • setOwner Link icon

      public void setOwner(IPropMgrOwner owner)
      Sets the owner Object, can only be done once.
      Parameters:
      owner - The owner object.
      Throws:
      IllegalStateException - If called more than once.
      NullPointerException - If owner is null.
    • getOwner Link icon

      public IPropMgrOwner getOwner()
      Gets the owner Object of this Property Manager instance. For e.g. the Designer, it may be the Panel Editor instance.
    • processUpdateTrans Link icon

      public void processUpdateTrans(PropCnr root, ReadTransaction trans)
      Processes the TRANS_UPDATE transaction on a root property container.
      Parameters:
      root - The root property container.
      trans - The create transaction.
    • processRemoveEvent Link icon

      public void processRemoveEvent(ReadTransaction trans)
      Process the TRANS_REMOTE_EVENT transaction.
    • queueRemoteEvent Link icon

      public void queueRemoteEvent(RemoteEvent event)
      Queues a property event during update of the property tree from the remote party until the entire tree has been updated. Once this is done, the method dispatchEvents() is called.
    • hasRemoteEventTrans Link icon

      public boolean hasRemoteEventTrans()
      Gets a Remote Event transaction from queued remote events.
      Returns:
      The transaction to send, or null if no more queued events are present.
    • queueEvent Link icon

      public void queueEvent(GEvent event)
      Queues a property event during update of the property tree from the remote party until the entire tree has been updated. Once this is done, the method dispatchEvents() is called.
      Parameters:
      event - Event to queue.
    • getSendTransaction Link icon

      public SendTransaction getSendTransaction(ITransactionCreator transCreator)
      Gets a transaction for sending. This call is done when a transaction trigger is fired that potentially creates an update to the root. The root property updates the transaction as needed, then all outstanding remote events are appended. Last, the atom table is prepended to the transaction. This method returns null when no update is required.
      Parameters:
      transCreator - The transaction creator instance.
      Returns:
      Transaction to send, or null for none.
    • trace Link icon

      public void trace(GProp<?> originator, String text)
      Traces a line of data.
      Parameters:
      originator - the originating property or null for none.
      text - the text to write to the trace output.
    • hasJavaScriptClient Link icon

      public boolean hasJavaScriptClient()
      Returns if this has a JavaScript client or not.
      Returns:
      true if it's a JavaScript client, false otherwise.
    • isClient Link icon

      public boolean isClient()
      Checks if this is a client or not.
      Returns:
      true if it's the client, false for server or editor.
    • isServer Link icon

      public boolean isServer()
      Checks if this is a server or not.
      Returns:
      true if it's the server, false for client or editor.
    • getType Link icon

      public int getType()
      Get the Property Manager type.
      Returns:
      EDITOR, SERVER or CLIENT.
    • useWebSocketBinaryFrameCompression Link icon

      public boolean useWebSocketBinaryFrameCompression()
      Checks if Binary Frame Compression should be used.
      Returns:
      A Client connection in JavaScript returns false by default, unless it supports compression, others return true.
    • enableWebSocketBinaryFrameCompression Link icon

      public void enableWebSocketBinaryFrameCompression()
      Enabled binary frame compression for JavaScript clients supporting it.
    • areNewAtomsPresent Link icon

      public boolean areNewAtomsPresent()
      Checks if append property manager data is required.
    • appendPropMgrData Link icon

      public void appendPropMgrData(SendTransaction trans)
      Appends data from the property manager to a transaction.
      Parameters:
      trans - the transaction to the data append to.
    • readPropMgrData Link icon

      public void readPropMgrData(ReadTransaction trans)
      Reads property manager data from a transaction.
      Parameters:
      trans - the transaction to read property manager data from.
    • createRootContainer Link icon

      public ClientProps createRootContainer(ReadTransaction trans, IModuleProjectPropProvider modulePropProvider)
      Creates the root container on the client side at the reception of the TRANS_CREATE transaction, initiates it from the Transaction and returns it.
      Parameters:
      trans - The create transaction.
      Returns:
      The root property container.
    • createClientRootContainer Link icon

      public ClientProps createClientRootContainer(IModuleProjectPropProvider modulePropProvider)
      Creates the client root container.
    • getRootContainer Link icon

      public ClientProps getRootContainer()
      Gets the root container.
      Returns:
      The last instance created by createRootContainer().
    • getEnvironment Link icon

      public EnvProps getEnvironment()
      Gets the Environment property.
      Returns:
      The Environment or null if communication is not established.
    • getClientEnv Link icon

      public StringMapProp getClientEnv()
      Gets the Client Environment.
      Returns:
      The Client Environment or null if communication is not established.
    • setProvider Link icon

      public void setProvider(IPropMgrInfoProvider provider)
      Sets the information provider for the Property Manager.
      Parameters:
      provider - The provider, non-null.
      Throws:
      NullPointerException - If provider is null.
      IllegalStateException - If the provider already is initialized.
    • getProvider Link icon

      public IPropMgrInfoProvider getProvider()
      Returns the information provider.
      Returns:
      The information provider, null for none.