com.ibm.tivoli.maximo.miniapps.control

Class MiniAppControl

  • All Implemented Interfaces:
    java.lang.Cloneable


    public class MiniAppControl
    extends DatasrcInstance
    • Field Detail

      • CLIENT_EVENT_TARGET_EVENT_NAME

        public static final java.lang.String CLIENT_EVENT_TARGET_EVENT_NAME
        Event handler (ie, method) in this Class that will respond to push to client events
        See Also:
        Constant Field Values
    • Constructor Detail

      • MiniAppControl

        public MiniAppControl()
    • Method Detail

      • loadDesigner

        public void loadDesigner(java.lang.String id)
      • loadMiniAppResource

        public java.lang.String loadMiniAppResource(java.lang.String path)
        Give a "path" relative to the miniapp's root directory, then return that resource as a string. The path should not start with "/". For example, if you have file called "myfile.txt" in your miniapp directory, then pass "myfile.txt".
        Parameters:
        path -
        Returns:
      • loadCSS

        public java.lang.String loadCSS()
      • loadMiniAppConfig

        public java.lang.String loadMiniAppConfig()
      • getPresentationOptions

        public com.ibm.json.java.JSONObject getPresentationOptions()
        Returns the "options" json configuration from the presentation element at the time the control was created.
        Returns:
      • getCalendarConstraintsJSON

        protected com.ibm.json.java.JSONObject getCalendarConstraintsJSON()
        Calendar Constraints are used by the Maximo Dojo Calendar Control.
      • resolveExtraPaths

        public java.util.List resolveExtraPaths(java.lang.String servletBaseUrl,
                                                java.lang.String miniappBaseUrl)
      • event_fetch

        public int event_fetch()
                        throws MXException
        This event handles XHR event to call MXEvent events against the underlying databean. The MXEvent name is in the "name" parameter for the mxevent. The async_bean will look for events annotated with the MXEvent annotation and call the method if the event name matches. It will pass parameters to the event method based on the MXEventParam annotations. MXEvent method handlers need to return either a String, JSONObject or JSONArray.
        Returns:
        Throws:
        MXException
      • event_callbean

        public int event_callbean()
                           throws MXException
        Alias for fetch. Typically callbean will not return data.
        Returns:
        Throws:
        MXException
      • event_yes_no_cancel

        public int event_yes_no_cancel()
                                throws MXException,
                                       java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • initialize

        public void initialize()
        Description copied from class: BaseInstance
        should be extended to do any setup required by the instance. for example, the DatasrcInstance will call initialize to create data sources found in the bind list.
        Overrides:
        initialize in class ControlInstance
      • pushMiniAppClientEventHandler

        public int pushMiniAppClientEventHandler()
        means for the server code to dispatch MiniAppControl.ClientEvent instances to the browser miniapp. MiniAppControl.ClientEvent instances are sent using dojo's topic subscription model
        Returns:
        EVENT_HANDLED
      • hasClientEvents

        public boolean hasClientEvents()
        Returns true if there are pending client events that need to be pushed to the browser.
        Returns:
      • getClientEvents

        public java.util.List getClientEvents()
        This will return a COPY of the list of the client events that need to sent to the client. This method will clear the event list, so multiple calls this will return an empty list. Hold a reference to the returned list, if you need to access it multiple times.
        Returns:
      • pushClientEvent

        public static WebClientEvent pushClientEvent(WebClientSession clientSession,
                                                     java.lang.String controlId,
                                                     java.lang.String eventName,
                                                     java.lang.String eventArgs)
        Convenience methof for creating and pushing a client event to a mini app.
        Parameters:
        clientSession - current WebClientSession
        controlId - control id (ie, miniapp control id to handle the event)
        eventName - dojo event name the client will have subscribed to
        eventArgs - an option string contain some data to pass along in the event
        Returns:
      • sendClientEvent

        public static WebClientEvent sendClientEvent(WebClientSession clientSession,
                                                     java.lang.String controlId,
                                                     java.lang.String eventName,
                                                     java.lang.String eventArgs)
        Convenience shortcut method to handleEvent(WebClientSession, WebClientEvent) to a mini app.
        Parameters:
        clientSession - current WebClientSession
        controlId - control id (ie, miniapp control id to handle the event)
        eventName - dojo event name the client will have subscribed to
        eventArgs - an option string contain some data to pass along in the event
        Returns:
        WebClientEvent
        See Also:
        handleEvent(WebClientSession, WebClientEvent)
      • instantiatedatasrc

        public void instantiatedatasrc()
        Description copied from class: DatasrcInstance
        this method will set up the datasource on the control. any controls that need to create a datasource should be an instance of this class. if the datasource is not already created, one will be created and stored in the appropriate place (app or page).
        Overrides:
        instantiatedatasrc in class DatasrcInstance
      • createDOMId

        public java.lang.String createDOMId(java.lang.String appId,
                                            java.lang.String mainClass)
        Create a unique DOM id for this app instance
        Parameters:
        appId -
        mainClass -
        Returns:
      • isSizedToParent

        public boolean isSizedToParent()
        Returns true is this control is supposed to be sized to match another dom element
        Returns:
      • getSizeToParentId

        public java.lang.String getSizeToParentId()
      • getSizeToParentIdForJS

        public java.lang.String getSizeToParentIdForJS()
      • getMiniAppRootDir

        public java.lang.String getMiniAppRootDir(java.lang.String servletPath,
                                                  java.lang.String miniAppId)
      • getMiniAppsDir

        public java.lang.String getMiniAppsDir()
      • getLastWebClientEventInstance

        public com.ibm.json.java.JSONObject getLastWebClientEventInstance()
        Get last known WebClientEvent Details as a JSONObject
      • isInDevelopment

        public static boolean isInDevelopment()
        Returns true if the MiniApps are in development mode
        Returns:
      • render

        public int render()
                   throws java.lang.NoSuchMethodException,
                          java.lang.IllegalAccessException,
                          java.lang.reflect.InvocationTargetException
        Description copied from class: ControlInstance
        Render this control's components
        Overrides:
        render in class DatasrcInstance
        Throws:
        java.lang.NoSuchMethodException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • currentTabOp

        public void currentTabOp()
      • treeGridVisibility

        public void treeGridVisibility(Tab currentTab)
      • sendEventToTreeGrid

        public void sendEventToTreeGrid(java.lang.String eventId,
                                        java.lang.String eventArg)
        Will push a Dojo topic with the given eventId as the topic and eventArg as the event message
        Parameters:
        eventId -
        eventArg -
      • isMiniAppVisible

        public boolean isMiniAppVisible()
      • getCurrentTab

        public Tab getCurrentTab()