Example #1
0
        /// <summary>
        ///   get the recompute attributes
        /// </summary>
        private Task fillAttributes(XmlParser parser)
        {
            int endContext = parser.getXMLdata().IndexOf(XMLConstants.TAG_CLOSE, parser.getCurrIndex());
            int Index      = parser.getXMLdata().IndexOf(XMLConstants.MG_TAG_RECOMPUTE, parser.getCurrIndex()) +
                             XMLConstants.MG_TAG_RECOMPUTE.Length;
            Task task = null;

            List <string> tokensVector = XmlParser.getTokens(parser.getXMLdata().Substring(Index, endContext - Index), "\"");

            for (int j = 0; j < tokensVector.Count; j += 2)
            {
                string attribute = (tokensVector[j]);
                string valueStr  = (tokensVector[j + 1]);

                if (attribute.Equals(XMLConstants.MG_ATTR_TASKID))
                {
                    task = (Task)MGDataCollection.Instance.GetTaskByID(valueStr);
                }
                else
                {
                    Logger.Instance.WriteExceptionToLog(string.Format("Unrecognized attribute: '{0}'", attribute));
                }
            }
            parser.setCurrIndex(parser.getXMLdata().IndexOf(XMLConstants.TAG_CLOSE, parser.getCurrIndex()) + 1);
            //start of <fld ...>

            return(task);
        }
Example #2
0
        /// <summary>
        ///   if the current task and its parent are from different components then
        ///   set the task to the main program of the component of the current task.
        ///   otherwise, set the task to be the parent of the current task
        /// </summary>
        private void getParentOrCompMainPrg()
        {
            int  ctlIdx = _task.getCtlIdx();
            Task parent;

            _prevTask = _task;
            // Retrieve the task's calling-parent. We need the task who invoked the current task
            // rather than the task's triggering parent.
            // The Path Parent is the parent of that task as if the server had done build path. It is more logical to search using the trigger task tree
            // but since the online/server does not use the trigger tree, we decided not to use it here as well.
            // If the path parent is from a different comp, it means that between curr task and parent there should be a comp main prog.
            parent = _task.PathParentTask;
            if (parent == null)
            {
                _task = null;
                return;
            }

            // check if the parent task is from another component
            if (ctlIdx != parent.getCtlIdx())
            {
                // replace the parent task to search with the comp main program. later on, the main prog will be replaced with
                // the real PathParentTask.
                _rtEvt.setMainPrgCreator(_task);
                _task = (Task)MGDataCollection.Instance.GetMainProgByCtlIdx(ctlIdx);
            }
            else
            {
                _rtEvt.setMainPrgCreator(null);
                _task = parent;
            }
        }
Example #3
0
        /// <summary>
        /// get menu path
        /// </summary>
        /// <param name="task">
        /// <returns>string</returns>
        internal static string GetMenuPath(Task task)
        {
            Task mainProg = MGDataCollection.Instance.GetMainProgByCtlIdx((task).getCtlIdx());
            Task currTsk  = ClientManager.Instance.EventsManager.getCurrTask() ?? (Task)task.GetContextTask();

            // fixed bug#919779, the MenuUid is save on the parent.
            // MenuUid is saved on the parent. bacouse we don't have menu on the current form.
            int menuUid = currTsk.MenuUid;

            while (menuUid == 0 && currTsk != null)
            {
                currTsk = currTsk.getParent();
                if (currTsk != null)
                {
                    menuUid = currTsk.MenuUid;
                }
            }

            //as we doing for online: if it is not program that was called, then get the last click menu id from the top most form.
            if (menuUid == 0)
            {
                currTsk = ClientManager.Instance.EventsManager.getCurrTask() ?? (Task)task.GetContextTask();
                menuUid = currTsk.getTopMostForm().LastClickedMenuUid;
            }

            string menuPath = Manager.MenuManager.GetMenuPath(mainProg, menuUid);

            return(menuPath);
        }
Example #4
0
 /// <summary>
 ///   This constructor creates a matching event object for the passed menuEntryEvent
 /// </summary>
 /// <param name = "menuEntryEvent">event menu entry for which we create this event</param>
 /// <param name = "currentTask">current task from which the menu entry was activated</param>
 /// <param name = "control"></param>
 internal RunTimeEvent(MenuEntryEvent menuEntryEvent, Task currentTask, MgControl control, int ctlIdx)
     : base(menuEntryEvent, ctlIdx)
 {
     _task    = currentTask;
     _taskTag = currentTask.getTaskTag();
     Control  = control;
 }
Example #5
0
 /// <summary>
 ///   CTOR - creates a new run time event by copying the member variables of a given
 ///   event and the member variables of a given run time event
 /// </summary>
 /// <param name = "evt">a reference to the event to be used </param>
 /// <param name = "rtEvt">a reference to the run time event to be used </param>
 internal RunTimeEvent(Event evt, RunTimeEvent rtEvt)
     : base(evt)
 {
     _taskTag           = rtEvt._taskTag;
     _task              = rtEvt._task;
     Control            = rtEvt.Control;
     _eventFld          = rtEvt._eventFld;
     _mgdId             = rtEvt._mgdId;
     _displayLine       = rtEvt._displayLine;
     _reversibleExit    = rtEvt._reversibleExit;
     _argList           = rtEvt._argList;
     _immediate         = rtEvt._immediate;
     _mprgCreator       = rtEvt._mprgCreator;
     _priority          = rtEvt._priority;
     _guiTriggeredEvent = rtEvt._guiTriggeredEvent;
     _isIdleTimer       = rtEvt._isIdleTimer;
     _val            = rtEvt._val;
     _selectionStart = rtEvt._selectionStart;
     _selectionEnd   = rtEvt._selectionEnd;
     _controlsList   = rtEvt._controlsList;
     _direction      = rtEvt._direction;
     _dotNetObject   = rtEvt._dotNetObject;
     DotNetArgs      = rtEvt.DotNetArgs;
     LastFocusedVal  = rtEvt.LastFocusedVal;
     _imeParam       = rtEvt._imeParam;
 }
Example #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tsk"></param>
 internal DvCache(Task tsk)
 {
     _task        = tsk;
     _cacheTable  = new Hashtable(100, 0.7F);
     _deletedList = new List <long>();
     _cacheSize   = 0;
 }
Example #7
0
        /// <summary>
        ///   To parse input string and fill inner data : Vector props
        /// </summary>
        internal void fillData(DataView dataView, Task task)
        {
            XmlParser parser = ClientManager.Instance.RuntimeCtx.Parser;

            while (initInnerObjects(parser, parser.getNextTag(), dataView, task))
            {
            }
        }
Example #8
0
        /// <summary>
        ///   This method is activated when a program menu was selected. It performs the needed operations in order to
        ///   translate the selected program menu into the matching operation
        /// </summary>
        /// <param name="contextID">active/target context (irelevant for RC)</param>
        /// <param name="menuEntryProgram">the selected menu \ bar menuEntryProgram object</param>
        /// <param name="activeForm"></param>
        /// <param name="ActivatedFromMDIFrame"></param>
        /// <returns></returns>
        internal static void onProgramMenuSelection(Int64 contextID, MenuEntryProgram menuEntryProgram, MgForm activeForm, bool ActivatedFromMDIFrame)
        {
            Task menuTask = getLastFocusedTask(activeForm);

            ClientManager.Instance.RuntimeCtx.LastClickedMenuUid = menuEntryProgram.menuUid();
            RunTimeEvent programMenuEvt = new RunTimeEvent(menuEntryProgram, menuTask, ActivatedFromMDIFrame);

            ClientManager.Instance.EventsManager.addToTail(programMenuEvt);
        }
Example #9
0
 /// <summary>
 ///   CTOR
 /// </summary>
 /// <param name = "taskref">reference to task</param>
 /// <param name = "guiTriggeredEvent"></param>
 internal RunTimeEvent(Task taskref, bool guiTriggeredEvent)
     : this(taskref)
 {
     _guiTriggeredEvent = guiTriggeredEvent;
     if (guiTriggeredEvent)
     {
         //Events that are triggered by GUI level, must be executed after all
         //other events, thus they have low priority;
         _priority = Priority.LOW;
     }
 }
Example #10
0
        /// <summary>
        ///   set the task
        /// </summary>
        /// <param name = "aTask">- reference to a task</param>
        internal void setTask(Task taskRef)
        {
            _task = taskRef;

            if (_task != null)
            {
                _taskTag = _task.getTaskTag();
            }
            else
            {
                _taskTag = null;
            }
        }
Example #11
0
 /// <summary>
 ///   Check if this event is blocked by the currently active window. If the
 ///   current window is modal, and the event defined in one of its ancestors,
 ///   the event should not be executed.
 /// </summary>
 /// <param name = "activeWindowData">The MGData object describing the currently active window.</param>
 /// <returns>
 ///   The method returns true if the currently active window is modal is a
 ///   descendant of the event's task. Otherwise it returns false.
 /// </returns>
 internal bool isBlockedByModalWindow(MGData activeWindowData)
 {
     if (activeWindowData.IsModal)
     {
         // Check that the event's task is an ancestor of the active window's task.
         Task eventTask = getTask();
         Task baseTask  = activeWindowData.getTask(0);
         if (eventTask != baseTask && baseTask.isDescendentOf(eventTask))
         {
             return(true);
         }
     }
     return(false);
 }
Example #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contextID">active/target context (irelevant for RC)</param>
        /// <param name="osCommandMenuEntry"></param>
        /// <param name="lastFocusedCtrlTask">
        ///the task of the last focused control. This is required because even if there is no
        ///last focused control, then also we have task and hence expression/function will be executed properly.
        ///Previously task was obtained from the control and when there was no control,task could not be obtained.
        /// </param>
        /// <returns></returns>
        internal static void onOSMenuSelection(Int64 contextID, MenuEntryOSCommand osCommandMenuEntry, MgForm activeForm)
        {
            Task lastFocusedCtrlTask = getLastFocusedTask(activeForm);

            RunTimeEvent osMenuEvent = new RunTimeEvent(osCommandMenuEntry, lastFocusedCtrlTask);

            if (osCommandMenuEntry.Wait)
            {
                ClientManager.Instance.EventsManager.handleEvent(osMenuEvent, false);
            }
            else
            {
                ClientManager.Instance.EventsManager.addToTail(osMenuEvent);
            }
        }
Example #13
0
        /// <summary>
        ///   Create an Event for the passed program menu entry
        /// </summary>
        /// <param name = "menuEntryProgram">the selected program menu entry</param>
        /// <param name = "currentTask">the task from which the menu was activated</param>
        /// <param name = "activatedFromMDIFrame"></param>
        internal RunTimeEvent(MenuEntryProgram menuEntryProgram, Task currentTask, bool activatedFromMDIFrame)
            : base(ConstInterface.EVENT_TYPE_MENU_PROGRAM)
        {
            PrgFlow          = menuEntryProgram.Flow;
            PublicName       = menuEntryProgram.PublicName;
            PrgDescription   = menuEntryProgram.Description;
            CopyGlobalParams = menuEntryProgram.CopyGlobalParameters;
            MainProgVars     = menuEntryProgram.MainProgVars;

            ActivatedFromMDIFrame = activatedFromMDIFrame;

            _task     = currentTask;
            _menuUid  = menuEntryProgram.menuUid();
            _menuComp = menuEntryProgram.getParentMgMenu().CtlIdx;
        }
Example #14
0
        /// <summary>
        ///
        /// </summary>
        internal void fillData()
        {
            XmlParser parser = ClientManager.Instance.RuntimeCtx.Parser;

            Task task = fillAttributes(parser);

            if (task != null)
            {
                Logger.Instance.WriteDevToLog("goes to refill recompute");
                fillData((DataView)task.DataView, task);
            }
            else
            {
                throw new ApplicationException("in RecomputeTable.fillData() invalid task id: "); //+ valueStr);
            }
        }
Example #15
0
        /// <summary>
        ///   The menu texts needs to be refreshed due to a change in the language.
        /// </summary>
        private void RefreshMenusText()
        {
            int  ctlIdx   = 0;
            Task mainProg = (Task)MGDataCollection.Instance.GetMainProgByCtlIdx(ctlIdx);

            while (mainProg != null)
            {
                ApplicationMenus menus = Manager.MenuManager.getApplicationMenus(mainProg);
                // call refreshMenuesTextMls for each application menu of components, starting with the main.
                if (menus != null)
                {
                    menus.refreshMenuesTextMls();
                }

                ctlIdx   = mainProg.getCtlIdx();
                mainProg = (Task)mainProg.getMGData().getNextMainProg(ctlIdx);
            }
        }
Example #16
0
        /// <summary> Add Open Context Menu event on right click on form.</summary>
        /// <param name = "guiMgControl">control </param>
        /// <param name = "guiMgForm">code of internal event </param>
        /// <param name = "left">code of internal event </param>
        /// <param name = "top">code of internal event </param>
        /// <param name = "line">code of internal event </param>
        public void AddOpenContextMenuEvent(GuiMgControl guiMgControl, GuiMgForm guiMgForm, int left, int top, int line)
        {
            MgControl ctrl = null;
            Task      task = null;

            if (guiMgControl != null)
            {
                if (guiMgControl is MgControl)
                {
                    ctrl = (MgControl)guiMgControl;
                    if (ctrl.Type == MgControlType.CTRL_TYPE_SUBFORM)
                    {
                        task = (Task)ctrl.GetSubformMgForm().getTask();
                    }
                    else
                    {
                        task = (Task)((MgControlBase)guiMgControl).getForm().getTask();
                    }
                }
            }
            else
            {
                task = (Task)((MgFormBase)guiMgForm).getTask();
            }

            // Prepare event for MG_ACT_CONTEXT_MENU to open context menu.
            var rtEvt = new RunTimeEvent(task);

            rtEvt.setInternal(InternalInterface.MG_ACT_CONTEXT_MENU);

            rtEvt.setCtrl(ctrl);
            //Prepare an argument list for left and top co-ordinate.
            var argsList = new GuiExpressionEvaluator.ExpVal[3];

            argsList[0] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.ALPHA, false, left.ToString());
            argsList[1] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.ALPHA, false, top.ToString());
            argsList[2] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.ALPHA, false, line.ToString());
            var args = new ArgumentsList(argsList);

            rtEvt.setArgList(args);

            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Example #17
0
        /// <summary>
        ///   init the position to start a new chain of search
        /// </summary>
        internal void init(RunTimeEvent rtEvent)
        {
            _rtEvt = rtEvent;
            _task  = _rtEvt.getTask();
            if (_task.isMainProg())
            {
                //phase = PHASE_CONTROL_NON_SPECIFIC;
                _prevTask = _rtEvt.getMainPrgCreator();
                if (_prevTask != null && _prevTask.isMainProg())
                {
                    _prevTask = null;
                }
            }

            if (rtEvent.getType() == ConstInterface.EVENT_TYPE_USER_FUNC)
            {
                _phase = PHASE_CONTROL_NON_SPECIFIC;
            }
            else
            {
                if (rtEvent.getType() == ConstInterface.EVENT_TYPE_USER_FUNC)
                {
                    _phase = PHASE_CONTROL_NON_SPECIFIC;
                }
                else
                {
                    _phase = PHASE_CONTROL_SPECIFIC;
                }
            }

            _orgTask     = _task;
            _orgPrevTask = _prevTask;

            _handlersTab = _task.getHandlersTab();
            if (_handlersTab == null)
            {
                goUpTaskChain();
            }
            _handlerIdx = -1;
        }
Example #18
0
        /// <summary>
        ///   This method is activated when an Event menu was selected. It performs the needed operations in order to
        ///   translate the selected event menu into the matching operation
        /// </summary>
        /// <param name = "menuEntryEvent">the selected menu \ bar menuEntryEvent object</param>
        /// <param name = "activeForm">last active Form</param>
        /// <param name = "ctlIdx">the index of the ctl which the menu is attached to in toolkit</param>
        internal static void onEventMenuSelection(MenuEntryEvent menuEntryEvent, MgForm activeForm, int ctlIdx)
        {
            MgControl lastFocusedControl = getLastFocusedControl(activeForm);
            Task      task = getLastFocusedTask(activeForm);

            RunTimeEvent aRtEvt = new RunTimeEvent(menuEntryEvent, task, lastFocusedControl, ctlIdx);

            aRtEvt.setPublicName();
            aRtEvt.setMainPrgCreator(null);

            // build the argument list from the mainProgVars
            List <String> mainProgVars = menuEntryEvent.MainProgVars;

            if (mainProgVars != null && mainProgVars.Count > 0)
            {
                ArgumentsList argList = new ArgumentsList();
                argList.fillListByMainProgVars(mainProgVars, task.getCtlIdx());
                aRtEvt.setArgList(argList);
                aRtEvt.setTask(null);
            }

            ClientManager.Instance.EventsManager.addToTail(aRtEvt);
        }
Example #19
0
 /// <summary>
 ///   CTOR
 /// </summary>
 /// <param name = "taskRef">reference to task</param>
 /// <param name = "ctrlRef">reference to control</param>
 internal RunTimeEvent(Task taskRef, MgControl ctrlRef)
     : this(ctrlRef != null ? (Task)ctrlRef.getForm().getTask() : taskRef)
 {
     Control = ctrlRef;
 }
Example #20
0
 /// <summary>
 ///   Create an Event for the passed os menu entry
 /// </summary>
 /// <param name = "osCommand">the selected os command menu entry</param>
 /// <param name = "currentTask">the task from which the menu was activated</param>
 internal RunTimeEvent(MenuEntryOSCommand osCommand, Task currentTask)
     : base(osCommand)
 {
     _task = currentTask;
 }
Example #21
0
        /// <summary>
        ///   get the next task in the tasks chain and returns false if no task was found.
        ///   this function changes the phase variable accordingly
        /// </summary>
        private bool goUpTaskChain()
        {
            MGData mgd    = _task.getMGData();
            int    ctlIdx = _task.getCtlIdx();

            //handlers for events  for  .NET object must be in the same task (not including control)
            if (_rtEvt.DotNetObject != null)
            {
                if (_phase != PHASE_CONTROL_NON_SPECIFIC) //QCR #940545, check only the same tasks
                {
                    _phase++;                             //go to the next phase
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            switch (_phase)
            {
            /*case PHASE_CONTROL_SPECIFIC:
             * phase = PHASE_CONTROL_NON_SPECIFIC;
             * break;*/
            case PHASE_CONTROL_SPECIFIC:
            case PHASE_CONTROL_NON_SPECIFIC:
                // non specific handlers are searched till we hit our main program (inclusive)
                // afterwards we switch to global phase.
                if (!_task.isMainProg())
                {
                    getParentOrCompMainPrg();
                    break;
                }
                else
                {
                    // internal, internal, system and user events may cross component bounderies
                    if ((_rtEvt.getType() == ConstInterface.EVENT_TYPE_PUBLIC ||
                         _rtEvt.getType() == ConstInterface.EVENT_TYPE_INTERNAL ||
                         _rtEvt.getType() == ConstInterface.EVENT_TYPE_SYSTEM ||
                         _rtEvt.getType() == ConstInterface.EVENT_TYPE_USER) && ctlIdx != 0)
                    {
                        // load the RT parent of the previous task. If no prevtask exists then we are
                        // simply running on the main progs list (for example, when a main prg catches
                        // a timer event, no prevtask exists.
                        if (_prevTask == null)
                        {
                            _task = (Task)mgd.getNextMainProg(ctlIdx);
                            if (_task == null && ctlIdx != 0)
                            {
                                _task = MGDataCollection.Instance.GetMainProgByCtlIdx(ClientManager.Instance.EventsManager.getCompMainPrgTab().getCtlIdx(0));
                            }
                        }
                        else
                        {
                            // the component main program that was set in getParentOrCompMainPrg, is now replaced back to the path parent.
                            _task     = _prevTask.PathParentTask;
                            _prevTask = null;
                        }
                        _rtEvt.setMainPrgCreator(null); //moving out of a main program to another task
                        break;
                    }

                    // here we scan the main progs according to the load sequence (first to last).
                    if (_phase == PHASE_CONTROL_SPECIFIC)
                    {
                        // specific search is over. start the non specific search from
                        // the first task.
                        _phase = PHASE_GLOBAL_SPECIFIC;
                    }
                    else
                    {
                        // here we scan the main progs according to the load sequence (first to last).
                        _phase = PHASE_GLOBAL;
                    }
                    _task = MGDataCollection.Instance.GetMainProgByCtlIdx(ClientManager.Instance.EventsManager.getCompMainPrgTab().getCtlIdx(0));
                    _rtEvt.setMainPrgCreator(_task);
                    if (_task == null)
                    {
                        return(false);
                    }
                    break;
                }

            case PHASE_GLOBAL_SPECIFIC:
            case PHASE_GLOBAL:
                _task = (Task)mgd.getNextMainProg(ctlIdx);
                if (_task == null)
                {
                    if (_phase == PHASE_GLOBAL)
                    {
                        return(false);
                    }
                    // PHASE_GLOBAL_SPECIFIC
                    else
                    {
                        // specific search is over. start the non specific search from
                        // the first task.
                        _phase    = PHASE_CONTROL_NON_SPECIFIC;
                        _task     = _orgTask;
                        _prevTask = _orgPrevTask;
                        break;
                    }
                }
                break;

            default:
                Logger.Instance.WriteExceptionToLog("in EventHandlerPosition.goUpTaskChain() invalid phase: " + _phase);
                break;
            }
            if (_task == null)
            {
                return(false);
            }
            _handlersTab = _task.getHandlersTab();
            if (_handlersTab == null)
            {
                return(goUpTaskChain());
            }
            _handlerIdx = -1;
            return(true);
        }
Example #22
0
 /// <summary>
 ///   a helper method that does some common initialization for some of the constructors
 /// </summary>
 private void init(Task taskRef)
 {
     _task        = taskRef ?? MGDataCollection.Instance.getCurrMGData().getFirstTask();
     _taskTag     = _task == null ? "" : _task.getTaskTag();
     _mprgCreator = null;
 }
Example #23
0
 /// <summary>
 ///   set the reference to the task which is "responsible" for a main program to become active.
 ///   For example: if task A calls task B and B's ctlIdx is different than A's, then B's main
 ///   program will be inserted into the task hirarchy thus B is "responsible" for the main prg.
 /// </summary>
 /// <param name = "src">the "responsible" task.</param>
 internal void setMainPrgCreator(Task src)
 {
     _mprgCreator = src;
 }
Example #24
0
 /// <summary>
 ///   CTOR
 /// </summary>
 /// <param name = "taskRef">a reference to the task</param>
 internal RunTimeEvent(Task taskRef)
     : base()
 {
     init(taskRef);
 }
Example #25
0
        /// <summary>
        ///   Fill Recompute Object, gives its reference to Field and reference of Field to him
        /// </summary>
        private bool initInnerObjects(XmlParser parser, String nameOfFound, DataView dataView, Task task)
        {
            if (nameOfFound == null)
            {
                return(false);
            }

            if (nameOfFound.Equals(XMLConstants.MG_TAG_RECOMPUTE))
            {
                parser.setCurrIndex(parser.getXMLdata().IndexOf(XMLConstants.TAG_CLOSE, parser.getCurrIndex()) +
                                    1);
            }
            //satrt of <fld ...>
            else if (nameOfFound.Equals(XMLConstants.MG_TAG_FLD))
            {
                Recompute recompute = new Recompute();
                recompute.fillData(dataView, task); //get reference to DataView, to make linked ref. : Recompute<-Field
                //taskReference for Recompute.props=> ControlTable.Control.task
            }
            else if (nameOfFound.Equals('/' + XMLConstants.MG_TAG_RECOMPUTE))
            {
                parser.setCurrIndex2EndOfTag();
                return(false);
            }
            else
            {
                Logger.Instance.WriteExceptionToLog(
                    "There is no such tag in <recompute>, add case to RecomputeTable.initInnerObjects for " + nameOfFound);
                return(false);
            }
            return(true);
        }