Class UIContextMenu

All Implemented Interfaces:
EventListener, IFocusComp, IMessageBox, IComponent, IClassReferenceOwner, ICustomDataProvider, IGProp<GProp<?>[]>, IPropCnr, IReferrerParticipant, IUIClassReferenceOwner, IUIComp, IUIContainer, IUIContextMenuOwner, IUIFocusComp, IUIGroupSeparator, IUIPanelOwner, IUIHTMLTextComponent, IUITextComponent, IVSAccessor, IVSComponentListener, IVSComponentState, IVSFieldListener, IVSGenericComponentListener, IVSParticipant, Cloneable
Direct Known Subclasses:
EUIContextMenu

public class UIContextMenu extends UIMenu implements IUIPanelOwner, IUIClassReferenceOwner, IUIGroupSeparator
Context menu UI container.
Author:
Christopher Mindus
  • Constructor Details

    • UIContextMenu

      public UIContextMenu()
      Creates the container without name with a null value.
    • UIContextMenu

      public UIContextMenu(Atom propertyAtom)
      Creates the container with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • UIContextMenu

      public UIContextMenu(Atom propertyAtom, GProp<?>[] properties) throws PropException
      Creates the container with the specified name and properties.
      Parameters:
      propertyAtom - the property atom.
      properties - the property array value for the container.
      Throws:
      PropException - when properties are not correctly defined.
  • Method Details

    • getDeviceType

      public final int getDeviceType()
      Gets the device type: -1=mobile, 0=both, 1=desktop.
      Specified by:
      getDeviceType in interface IUIComp
      Overrides:
      getDeviceType in class UIMenu
    • clone

      public UIContextMenu clone()
      Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.

      Cloning is used for "virtualization" of a property tree in the server. Client property classes will therefore throw CloneNotSupportedException.

      Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set. All children properties are also (deep) cloned.

      Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!

      Overrides:
      clone in class UIContainer
    • getApproximateSize

      public Size getApproximateSize()
      Returns the size of the component in pixels. The size is a calculation and does not exactly reflect the real size that may be different due to additional styles not taken into account by this method. The size is calculated from the font of the component and default or defined values (such as character length or number of lines for text area).
      Overrides:
      getApproximateSize in class UIContainer
      Returns:
      The size of the component: 0x0 (none).
    • getDefaultTextTable

      public TextTable getDefaultTextTable()
      Gets the default text table of the panel. This text table may be derived from another base table, and the default input language code can also be checked.
      Returns:
      The default text table, or null if not defined.
    • virtualize

      public final UIContextMenu virtualize(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace) throws CloneNotSupportedException, PropException
      Call this method to "virtualize" a property tree. This method is used at runtime in the Server for the application session of virtual instances of VirtualSpace, but also virtual instances of panels, for the individual client session. The VirtualSpace is virtualized once for the application session and is shared for parallel client sessions.

      This method is similar to cloning, but enables references that are already resolved to remain if they point to a shared instance, e.g. the VirtualSpace pointing to its participants in the application property container shared instance, or a panel with references to text IDs, assets, etc.

      It is up to the property class to handle this by overriding this method.

      Overrides:
      virtualize in class PropCnr
      Parameters:
      appGyro - The application gyro instance performing the virtualization.
      clientGyro - The client gyro session, can be null if not initialized from the client gyro.
      virtualSpace - The virtualized or virtualizing VirtualSpace.
      Returns:
      The virtualized property.
      Throws:
      CloneNotSupportedException - If a subclass doesn't allow cloning, e.g. the client properties.
      PropException - For property errors during the virtualization.
    • getAppSessionGyro

      public IAppSessionGyro getAppSessionGyro()
      Returns the Application Session Gyro instance of this virtualized property.
      Specified by:
      getAppSessionGyro in interface IGProp<GProp<?>[]>
      Overrides:
      getAppSessionGyro in class GProp<GProp<?>[]>
      Returns:
      The Application Session Gyro if this instance is virtualized, null otherwise.
    • getClientSessionGyro

      public IClientSessionGyro getClientSessionGyro()
      Returns the Client Session Gyro instance of this virtualized property. This method only work for properties in a panel tree. Data connectors may sometimes also provide IClientSessionGyro support.

      To get the IClientSessionGyro instance from the current thread use IClientSessionGyro.getSessionInstance(), or IClientSessionGyro.getSessionInstance(SessionInfo) to get it from the session information instance.

      Specified by:
      getClientSessionGyro in interface IGProp<GProp<?>[]>
      Overrides:
      getClientSessionGyro in class GProp<GProp<?>[]>
      Returns:
      The Client Session Gyro if this instance is virtualized and is in a UIPanelBase (panels) tree (or for certain data connectors), null otherwise.
    • getPropBaseReference

      public PropCnr getPropBaseReference()
      The panel is the base component base reference.
      Specified by:
      getPropBaseReference in interface IGProp<GProp<?>[]>
      Overrides:
      getPropBaseReference in class PropCnr
      Returns:
      This UIContextMenu instance.
    • getPanelOwner

      public UIPanelBase getPanelOwner()
      Gets the panel owner. This method only returns non-null when a panel is virtualized and has virtualized this context menu.
      Specified by:
      getPanelOwner in interface IUIPanelOwner
      Returns:
      The panel itself or that owns e.g. the context menu, null for none.
    • getVSReference

      public VSParticipant getVSReference(Atom refAtom)
      Gets a VSReference instance from the container or any parent containers. The method is used by VSRelativeReference to look up the VSReference instance in order to resolve the relative path to the target property.
      Specified by:
      getVSReference in interface IGProp<GProp<?>[]>
      Overrides:
      getVSReference in class PropCnr
      Parameters:
      refAtom - The property atom of the requesting relative reference property.
      Returns:
      The instance of the VSParticipant (that extends VSReference) or null if unassigned.
    • createVSReference

      public VSParticipant createVSReference(Atom refAtom, PropCnr[] returnParent)
      Creates a VSReference instance from the container or any parent containers. The method is used in the Designer to create a VirtualSpace connection for VSRelativeReference to look up the VSReference instance in order to resolve the relative path to the target property.

      This method needs to be overridden by subclasses of PropCnr that has a VSReference as property, and *SHOULD* match getVSReference(Atom).

      The default is to re-target the call to the parent container, and if the root, a folder or a file property is reached, null is returned.

      Overrides:
      createVSReference in class PropCnr
      Parameters:
      refAtom - The property asking for the VSReference.
      returnParent - An array of PropCnr [1] that will be filled in with the parent property of the VSRefernce.
      Returns:
      The instance of the VSReference or null if unassigned. The returned instance could also be a VSParticipant and should therefore be processed accordingly.

      For this method, it's a VSParticipant.

    • getVSParticipant

      public VSParticipant getVSParticipant()
      Gets the VSParticipant instance. This is also an instance of VSReference.
      Specified by:
      getVSParticipant in interface IUIPanelOwner
      Returns:
      The instance of the VSParticipant, or null if not yet defined.
    • getVirtualSpace

      public VirtualSpace getVirtualSpace()
      Gets the VirtualSpace for this panel.

      Method for IVSParticipant: Gets the referrer's back-reference to the VirtualSpace. This is used by the VSParticipantReference when verifying its references.

      Specified by:
      getVirtualSpace in interface IUIComp
      Specified by:
      getVirtualSpace in interface IVSAccessor
      Overrides:
      getVirtualSpace in class UIComp
      Returns:
      The VirtualSpace, or null for none.
    • getParticipantDescription

      public String getParticipantDescription()
      Returns the given description of the referrer participant.
      Specified by:
      getParticipantDescription in interface IReferrerParticipant
      Returns:
      The string the Designer entered in the Description field, or "n/a" for none.
    • getParticipantType

      public String getParticipantType()
      Returns the given type of the referrer participant.
      Specified by:
      getParticipantType in interface IReferrerParticipant
    • isPrimaryParticipant

      public final boolean isPrimaryParticipant()
      Checks if this panel is primary or not. A primary participant is chosen in the selection processing when multiple participants are ordered in a VSParticipantsHolder container.
      Specified by:
      isPrimaryParticipant in interface IReferrerParticipant
      Returns:
      When virtualized, the owner panels participant state is returned, otherwise always false: context menus are secondary.
    • getGroupID

      public int getGroupID(GroupNameProp groupName)
      Gets the unique ID for a group name.
      Specified by:
      getGroupID in interface IUIGroupSeparator
      Parameters:
      groupName - The group name. Return The unique for the group name.
    • onPrepare

      protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, List<Throwable> errors) throws PropException
      Called when the application is being prepared. The order of onPrepare calls is always parent first, the children. The method is called twice, first time with isPostCall set to false, then a second time with true.
      Overrides:
      onPrepare in class UIComp
      Parameters:
      appOwner - The application owner.
      moduleOwner - The Module owner.
      isPostCall - Flag indicating this is a post-call.
      errors - A list of errors that occurred but did not cause an abort.
      Throws:
      PropException - For property errors during the application preparation to need to abort.
    • invokeOnUICreateMethod

      protected void invokeOnUICreateMethod(UIComp component)
      Invoke the create event methods of the component and the panel.

      This method is not intended to be called, it is used by the framework.

      Parameters:
      component - The UI component.
    • invokeOnUIDestroyMethod

      protected void invokeOnUIDestroyMethod(UIComp component)
      Invoke the create event methods of the component and the panel.

      This method is not intended to be called, it is used by the framework.

      Parameters:
      component - The UI component.
    • invokeOnUITextChangeMethod

      public void invokeOnUITextChangeMethod(UIComp component, GProp<?> trigger)
      Invoke the onUITextChange event methods of the component and the panel.
      Parameters:
      component - The UI component.
      trigger - The trigger property.
    • invokeOnUISelectionMethod

      public void invokeOnUISelectionMethod(IUISelectionComp source, GProp<?> trigger)
      Invoke the focus event method.
      Parameters:
      source - The selection UI component source.
      trigger - The trigger, null for none.
    • isParticipating

      public boolean isParticipating(EnvProps envProps)
      Checks if this panel is participating in the VirtualSpace, i.e. if it's used in the current user session or if it's e.g. the wrong resolution or device.
      Specified by:
      isParticipating in interface IReferrerParticipant
      Parameters:
      envProps - The Client Environment instance of the current client connection.
      Returns:
      The participation state is always false for a context menu, as it is a "slave" to its panels where used or referenced.
    • onVirtualSpaceVirtualized

      public void onVirtualSpaceVirtualized(IAppSessionGyro appGyro, VirtualSpace virtualizedVirtualSpace)
      Called when the VirtualSpace has been virtualized, giving the opportunity for e.g. data connectors to prepare it's virtualized counterparts if this is required.

      This call is done to the non-virtualized instance of the VirtualSpace participant.

      Specified by:
      onVirtualSpaceVirtualized in interface IVSParticipant
      Parameters:
      appGyro - The application gyro instance.
      virtualizedVirtualSpace - The virtualized VirtualSpace instance.