예제 #1
0
        /// <summary>
        /// Function handling form close event.
        /// </summary>
        /// <param name="guiMgForm"></param>
        /// <returns>true if event is CLR handled else false.</returns>
        protected virtual bool processFormClose(GuiMgForm guiMgForm)
        {
            bool       clrHandledEvent = false;
            MgFormBase mgForm          = (MgFormBase)guiMgForm;

            if (mgForm.IsMDIFrame)
            {
                Manager.EventsManager.addGuiTriggeredEvent(mgForm.getTask(), InternalInterface.MG_ACT_EXIT_SYSTEM);
            }
            else
            {
                if (!mgForm.IsHelpWindow)
                {
                    if (mgForm.ShouldPutActOnFormClose())
                    {
                        Manager.EventsManager.addGuiTriggeredEvent(mgForm.getTask(), InternalInterface.MG_ACT_HIT, RaisedBy.CLOSE_SYSTEM_MENU);
                    }
                    Manager.EventsManager.addGuiTriggeredEvent(mgForm.getTask(), InternalInterface.MG_ACT_CLOSE);
                }
                else
                {
                    if (mgForm.Opened)
                    {
                        clrHandledEvent = true;
                    }
                }
            }

            return(clrHandledEvent);
        }
예제 #2
0
        /// <summary>
        /// Build source definitions list for data controls contained in the form of the given task.
        /// </summary>
        /// <param name="task">The task whose form should be searched for data controls.</param>
        /// <returns>A list of data source definitions that correspond to the data controls. If the
        /// task does not have a form, the method will return an empty list.</returns>
        public static List <IDataSourceViewDefinition> BuildDataControlSourceDefinitions(Task task)
        {
            List <IDataSourceViewDefinition> viewDefs = new List <IDataSourceViewDefinition>();
            MgFormBase form = task.getForm();

            if (form != null)
            {
                foreach (var control in form.CtrlTab.GetControls(ControlTable.SelectDataControlPredicate))
                {
                    DataSourceId sourceId = new DataSourceId();
                    sourceId.CtlIdx = control.SourceTableReference.CtlIndex;
                    sourceId.Isn    = control.SourceTableReference.ObjectISN;

                    var dsDef = ClientManager.Instance.LocalManager.ApplicationDefinitions.DataSourceDefinitionManager.GetDataSourceDefinition(sourceId);
                    if (dsDef != null)
                    {
                        DataSourceReference dataSourceRef = new DataSourceReference(dsDef, Access.Read);
                        Property            indexProperty = control.getProp(PropInterface.PROP_TYPE_INDEX);
                        int keyIndex = indexProperty.getValueInt() - 1;

                        Property valueFieldProperty   = control.getProp(PropInterface.PROP_TYPE_LINK_FIELD);
                        int      valueFieldIndex      = valueFieldProperty.getValueInt() - 1;
                        Property displayFieldProperty = control.getProp(PropInterface.PROP_TYPE_DISPLAY_FIELD);
                        int      displayFieldIndex    = displayFieldProperty.getValueInt() - 1;

                        var viewDef = new DataControlSourceViewDefinition(dataSourceRef, keyIndex, valueFieldIndex, displayFieldIndex, control.getDitIdx());

                        viewDef.RangeDataBuilder = CreateRangeDataBuilder(((MgControl)control).RangeBoundaryFactories, task, viewDef);
                        viewDefs.Add(viewDef);
                    }
                }
            }
            return(viewDefs);
        }
예제 #3
0
        /// <summary>
        ///   applies column properties on a line mode form
        /// </summary>
        /// <param name = "tableNode"></param>
        /// <param name = "mgForm"></param>
        private void ApplyTableProp(XmlElement tableNode, MgFormBase mgForm)
        {
            // read val for all columns and set them on form
            if (mgForm.HasTable() && !IsTableDesignChanged(mgForm, tableNode))
            {
                MgControlBase tableCtrl   = mgForm.getTableCtrl();
                int           columnCount = tableNode.ChildNodes.Count;
                var           columnData  = new List <int[]>(); // {layer, width, widthForFillTablePlacement}

                for (int index = 0;
                     index < columnCount;
                     index++)
                {
                    var columnElement = (XmlElement)tableNode.ChildNodes[index];

                    // get layer and width
                    int colLayer = int.Parse(columnElement.GetAttribute(STR_LAYER));
                    int colWidth = int.Parse(columnElement.GetAttribute(STR_WIDTH));
                    int colWidthForFillTablePlacement;
                    if (!int.TryParse(columnElement.GetAttribute(STR_WIDTH_FOR_FILL_TABLE_PLACEMENT), out colWidthForFillTablePlacement))
                    {
                        colWidthForFillTablePlacement = colWidth;
                    }

                    columnData.Add(new[] { colLayer, colWidth, colWidthForFillTablePlacement });
                }

                Commands.addAsync(CommandType.REORDER_COLUMNS, tableCtrl, 0, columnData);
            }
        }
예제 #4
0
        /// <summary>
        ///   get the path from 'mgFormFrm' to 'mgFormTo'
        /// </summary>
        /// <param name = "mgFormFrm"></param>
        /// <param name = "mgFormTo"></param>
        /// <returns></returns>
        private List <MgFormBase> GetMatchingPath(MgFormBase mgFormFrm, MgFormBase mgFormTo)
        {
            var        formPathList = new List <MgFormBase>();
            MgFormBase mgForm       = mgFormFrm;

            // get the path from current Form to TopMost Form
            while (mgForm != null && mgForm != mgFormTo)
            {
                formPathList.Add(mgForm);

                if (mgForm.isSubForm())
                {
                    mgForm = mgForm.getSubFormCtrl().getForm();
                }
                else
                {
                    throw new Exception("One of the parents is not a subform");
                }
            }

            // mgFormTo not found
            if (mgForm == null)
            {
                formPathList.Clear();
            }

            return(formPathList);
        }
예제 #5
0
        /// <summary>
        ///   saves table properties of a line mode form
        /// </summary>
        /// <param name = "formNode"></param>
        /// <param name = "mgForm"></param>
        private void SaveTableProp(XmlElement formNode, MgFormBase mgForm)
        {
            Debug.Assert(_xmlDoc != null);

            if (mgForm.isLineMode())
            {
                // Add table column node
                XmlElement tableColumnNode = XmlServices.AddElement(_xmlDoc, formNode, STR_TABLECOLS);

                MgControlBase tableCtrl = mgForm.getTableCtrl();

                List <int[]> columnsState = Commands.getColumnsState(tableCtrl);

                for (int idx = 0;
                     idx < columnsState.Count;
                     idx++)
                {
                    // Add column node
                    XmlElement columnNode = XmlServices.AddElement(_xmlDoc, tableColumnNode, STR_COLUMN);

                    // Add layer of column
                    int propLayer = columnsState[idx][0];
                    XmlServices.setAttribute(columnNode, STR_LAYER, propLayer.ToString());

                    // Add width of column
                    int propWidth = columnsState[idx][1];
                    XmlServices.setAttribute(columnNode, STR_WIDTH, propWidth.ToString());

                    // Add widthForFillTablePlacement of column
                    int propWidthForFillTablePlacement = columnsState[idx][2];
                    XmlServices.setAttribute(columnNode, STR_WIDTH_FOR_FILL_TABLE_PLACEMENT, propWidthForFillTablePlacement.ToString());
                }
            }
        }
예제 #6
0
        /// <summary>
        ///   applies frames on a frameform
        /// </summary>
        /// <param name = "framesetsNode"></param>
        /// <param name = "mgform"></param>
        private void ApplyFramesetsProp(XmlElement framesetsNode, MgFormBase mgform)
        {
            List <MgControlBase> framesetCtrls = mgform.getCtrls(MgControlType.CTRL_TYPE_FRAME_SET);

            if (!isFramesetsDesignChanged(framesetsNode, framesetCtrls))
            {
                for (int index = 0;
                     index < framesetsNode.ChildNodes.Count;
                     index++)
                {
                    var framesetNode = (XmlElement)framesetsNode.ChildNodes[index];
                    var arrayList    = new List <int>();

                    // get splitter style
                    int splitterstyle = int.Parse(framesetNode.GetAttribute(STR_SPLITTERSTYLE));

                    // get widths or heights of all the splits in this frameset
                    foreach (XmlElement frameNode in framesetNode.ChildNodes)
                    {
                        int val = int.Parse(splitterstyle == MgSplitContainer.SPLITTER_STYLE_HORIZONTAL
                                         ? frameNode.GetAttribute(STR_WIDTH)
                                         : frameNode.GetAttribute(STR_HEIGHT));
                        arrayList.Add(val);
                    }

                    // apply the widths or heights of all the splits in this frameset
                    Commands.addAsync(splitterstyle == MgSplitContainer.SPLITTER_STYLE_HORIZONTAL
                                    ? CommandType.SET_FRAMES_WIDTH
                                    : CommandType.SET_FRAMES_HEIGHT, framesetCtrls[index], 0, arrayList);
                    Commands.addAsync(CommandType.EXECUTE_LAYOUT, framesetCtrls[index], true);
                }
            }
        }
예제 #7
0
        /// <summary>
        ///   This method rebuilds all menu objects which were used before the menus file has changed.
        ///   This way we refresh the menus to use the definitions of the updated menus file
        /// </summary>
        public void rebuild(List <MgFormBase> formsToRefresh)
        {
            Property prop = null;

            // refresh the menu properties of all effected forms contents (controls)
            if (formsToRefresh != null)
            {
                for (int i = 0; i < formsToRefresh.Count; i++)
                {
                    MgFormBase formToRefresh = formsToRefresh[i];
                    prop = formToRefresh.getProp(PropInterface.PROP_TYPE_CONTEXT_MENU);
                    if (prop != null)
                    {
                        prop.RefreshDisplay(true);
                    }

                    // It is possible that the controls on the form had different context menus than the form itself.
                    // So under form property we will find only the context menu attached to the form. But we need to refresh the other context menus as well.
                    formToRefresh.refreshContextMenuForControls();

                    prop = formToRefresh.getProp(PropInterface.PROP_TYPE_PULLDOWN_MENU);
                    //In order to skip the computation of pulldown menu , call refreshPulldownMenu() directly instead of refreshDisplay().
                    if (prop != null)
                    {
                        prop.refreshPulldownMenu();
                    }
                }
            }
        }
예제 #8
0
        /// <summary>
        ///   saves form state of the form in this class
        /// </summary>
        /// <param name = "mgform"></param>
        internal void Save(MgFormBase mgform)
        {
            try
            {
                // When closing the MDI form, save its details --- irrespective of whether PersistentState=Y/N.
                if (mgform.getTask().isMainProg())
                {
                    if (mdiFormDetails == null)
                    {
                        mdiFormDetails = new MDIFormDetails();
                    }

                    mdiFormDetails.windowState = Commands.getLastWindowState(mgform);
                    mdiFormDetails.rect        = Commands.getFormBounds(mgform);
                }

                XmlElement formNode = GetNode(mgform);
                // if formNode is null, return
                if (formNode == null)
                {
                    return;
                }

                // remove the previously saved form properties
                RemoveFormProp(formNode);

                // Add user state info of the form
                SaveFormProp(formNode, mgform);
            }
            catch (Exception exception)
            {
                Events.WriteExceptionToLog(exception);
            }
        }
예제 #9
0
 public void checkEndtSepForGroup(MgFormBase form, int toolGroup, GuiMenuEntry.MenuType menuType)
 {
     if (menuType != GuiMenuEntry.MenuType.SEPARATOR)
     {
         form.createSepOnGroup(this, toolGroup);
     }
 }
예제 #10
0
        /// <summary>
        ///   This method adds a tool to the passed group and returns the new tool’s index.
        /// </summary>
        /// <param name = "toolGroup">group to which we add the tool</param>
        /// <returns>new tool index</returns>
        public int addToolToGroup(MgFormBase form, int toolGroup, GuiMenuEntry.MenuType menuType)
        {
            int i;
            int newToolIndex = 0;
            int count        = 0;

            for (i = 0; i <= toolGroup; i++)
            {
                count         = form.getToolbarGroupCount(i);
                newToolIndex += count;
            }

            //if we added a new tool and we already have a tool items we need to add the new tool before the seperator
            if (menuType != GuiMenuEntry.MenuType.SEPARATOR &&
                form.getToolbarGroupMenuEntrySep(toolGroup) != null)
            {
                newToolIndex--;
            }

            // each group ends with a separator, so we will increase the counter only after
            // we got the index
            form.setToolbarGroupCount(toolGroup, count + 1);

            return(newToolIndex);
        }
예제 #11
0
파일: PropTable.cs 프로젝트: rinavin/RCJS
        /// <summary>
        ///   refresh display of the properties in the Table
        /// </summary>
        /// <param name = "forceRefresh">if true, refresh is forced regardless of the previous value</param>
        /// <param name = "onlyRepeatableProps">if true, refreshes only repeatable tree properties</param>
        public bool RefreshDisplay(bool forceRefresh, bool onlyRepeatableProps)
        {
            bool       allPropsRefreshed = true;
            Property   prop;
            int        i;
            MgFormBase form         = null;
            ArrayList  visibleProps = new ArrayList();

            if (_parent != null && _parent is MgControlBase)
            {
                form = ((MgControlBase)_parent).getForm();
            }

            if (form != null)
            {
                form.checkAndCreateRow(form.DisplayLine);
            }

            for (i = 0; i < getSize(); i++)
            {
                prop = getProp(i);
                try
                {
                    //if this property is not repeatable in tree or table, and onlyRepeatableProps turned on
                    //do not refresh this property
                    if (onlyRepeatableProps && !Property.isRepeatableInTree(prop.getID()) && !Property.isRepeatableInTable(prop.getID()))
                    {
                        continue;
                    }

                    // Refresh Visible prop only after refreshing the navigation props like X, Y.
                    // Otherwise, the control is shown on its default location first and
                    // then moved somewhere else. And this is clearly visible.
                    if (prop.getID() == PropInterface.PROP_TYPE_VISIBLE)
                    {
                        visibleProps.Add(prop);
                    }
                    else
                    {
                        prop.RefreshDisplay(forceRefresh);
                    }
                }
                catch (ApplicationException ex)
                {
                    Events.WriteExceptionToLog(ex);
                    allPropsRefreshed = false;
                }
            }
            if (form != null)
            {
                form.validateRow(form.DisplayLine);
            }

            foreach (Property visibleProp in visibleProps)
            {
                visibleProp.RefreshDisplay(forceRefresh);
            }

            return(allPropsRefreshed);
        }
예제 #12
0
파일: MenuEntry.cs 프로젝트: rinavin/RCJS
        /// <summary>
        /// Create a menuentry for WindowList items.
        /// </summary>
        /// <param name="mgFormBase">Form associated with windowmenu entry</param>
        /// <param name="menuType">WindowMenu/Separator</param>
        /// <param name="guiMgForm"></param>
        /// <param name="menuStyle">pulldown/context</param>
        /// <param name="bChecked">menuentry should be checked or not</param>
        /// <returns></returns>
        public MenuEntry CreateMenuEntryItem(MgFormBase mgFormBase, MenuType menuType, GuiMgForm guiMgForm, MenuStyle menuStyle, bool bChecked)
        {
            MenuEntry menuEntry = null;

            if (menuType == MenuType.WINDOW_MENU_ENTRY)
            {
                menuEntry = new MenuEntryWindowMenu(getParentMgMenu());
                ((MenuEntryWindowMenu)menuEntry).SetForm(mgFormBase);

                //String menuText = mgFormBase.getProp(PropInterface.PROP_TYPE_FORM_NAME).getValue();
                //windowMenuEntry.setText(menuText, false);
                //windowMenuEntry.TextMLS = Events.Translate(menuText);
                menuEntry.setEnabled(true, false, false);
                menuEntry.setChecked(bChecked, false);
            }
            else if (menuType == MenuType.SEPARATOR)
            {
                menuEntry = new MenuEntry(menuType, getParentMgMenu());
            }

            menuEntry.setVisible(true, true, false, null);
            menuEntry.setMenuIsInstantiated(guiMgForm, menuStyle);

            return(menuEntry);
        }
예제 #13
0
파일: MenuEntry.cs 프로젝트: rinavin/RCJS
        /// <summary>
        ///   This method creates the gui commands in order to delete the matching menu object.
        /// </summary>
        /// <param name = "menuStyle"></param>
        public void deleteMenuEntryObject(MgFormBase form, MenuStyle menuStyle)
        {
            if (this is MenuEntryMenu)
            {
                //MenuReference menuItemReference = getInstantiatedMenuItem(form, menuStyle);
                for (int i = 0;
                     i < ((MenuEntryMenu)this).subMenus.Count;
                     i++)
                {
                    MenuEntry subMenuEntry = (((MenuEntryMenu)this).subMenus[i]);
                    subMenuEntry.deleteMenuEntryObject(form, menuStyle);
                }

                //if (menuItemReference != null && ((form.ShouldShowPullDownMenu && menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) ||
                //                                  (menuStyle == MenuStyle.MENU_STYLE_CONTEXT)))
                //{
                //   cmdQueue.add(CommandType.DELETE_MENU, menuItemReference, this, true);
                //   cmdQueue.execute();
                //}
            }

            deleteMenuEntryObjectItem(form, menuStyle);
            //      deleteMenuEntryObjectItems(parentMenuObject, MenuStyle.MENU_STYLE_CONTEXT);
            if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN && form.ShouldCreateToolbar)
            {
                deleteMenuEntryTool(form, true, false);
            }
        }
예제 #14
0
파일: Manager.cs 프로젝트: rinavin/RCJS
 public static void ApplyformUserState(MgFormBase mgForm)
 {
     if (!FormUserState.GetInstance().IsDisabled)
     {
         FormUserState.GetInstance().Apply(mgForm);
     }
 }
예제 #15
0
        /// <summary>
        /// Perform actions required when a dragged object is dropped (mouse released).
        /// Put actions : ACT_CTRL_HIT or ACT_HIT and MG_ACT_BEGIN_DROP.
        /// </summary>
        /// <param name="guiMgForm"></param>
        /// <param name="guiMgCtrl"></param>
        /// <param name="line"></param>
        protected virtual void processBeginDrop(GuiMgForm guiMgForm, GuiMgControl guiMgCtrl, int line)
        {
            MgControlBase mgControl = (MgControlBase)guiMgCtrl;
            MgFormBase    mgForm    = (guiMgForm == null) ? mgControl.getForm() : (MgFormBase)guiMgForm;
            bool          isCtrlHit = (mgControl != null) ? true : false; // Drop occurs on a control or a form?

            if (isCtrlHit)
            {
                Manager.EventsManager.addGuiTriggeredEvent(mgControl, InternalInterface.MG_ACT_CTRL_HIT, line);

                if (mgControl.isSubform())
                {
                    Manager.EventsManager.addGuiTriggeredEvent(mgControl.GetSubformMgForm().getTask(), InternalInterface.MG_ACT_BEGIN_DROP);
                }
                else
                {
                    Manager.EventsManager.addGuiTriggeredEvent(mgControl, InternalInterface.MG_ACT_BEGIN_DROP, line);
                }
            }
            else
            { // If Drop occurs on FORM.
                Manager.EventsManager.addGuiTriggeredEvent(mgForm.getTask(), InternalInterface.MG_ACT_HIT);
                Manager.EventsManager.addGuiTriggeredEvent(mgForm.getTask(), InternalInterface.MG_ACT_BEGIN_DROP);
            }
        }
예제 #16
0
        /// <summary>
        /// When menuEntry is selected on Menu, this method gets called. It calls appropriate functions depending
        /// upon type of menu selected.
        /// </summary>
        /// <param name="menuEntry">selected menu entry</param>
        /// <param name="activeForm">current active form, when menu is selected.</param>
        /// <param name="activatedFromMDIFrame">Is menu selected from MDI Frame. </param>
        public void onMenuSelection(GuiMenuEntry menuEntry, GuiMgForm activeForm, bool activatedFromMDIFrame)
        {
            try
            {
                MgFormBase topMostForm = null;
                TaskBase   task        = null;

                if (!((MgFormBase)activeForm).IsHelpWindow)
                {
                    task = ((MgFormBase)activeForm).getTask();
                    //from the menu task get the form of the menu(topmost) and save member of the last menu Id selected.
                    topMostForm = (MgFormBase)task.getTopMostForm();
                }
                else
                {
                    //In case of help window, get the parent form of help form and get task from that.
                    activeForm = topMostForm = ((MgFormBase)activeForm).ParentForm;
                    task       = topMostForm.getTask();
                }

                topMostForm.LastClickedMenuUid = menuEntry.menuUid();

                if (menuEntry is MenuEntryProgram)
                {
                    Events.OnMenuProgramSelection(task.ContextID, (MenuEntryProgram)menuEntry, activeForm, activatedFromMDIFrame);
                }
                else if (menuEntry is MenuEntryOSCommand)
                {
                    Events.OnMenuOSCommandSelection(task.ContextID, (MenuEntryOSCommand)menuEntry, activeForm);
                }
                else if (menuEntry is MenuEntryEvent)
                {
                    // in order to get the correct ctlidx we take it from the parent MgMenu of the menuentry and then
                    // change it if the event is a user event from another component
                    int            ctlIdx         = ((MenuEntryEvent)menuEntry).getParentMgMenu().CtlIdx;
                    MenuEntryEvent menuEntryEvent = (MenuEntryEvent)menuEntry;
                    if (menuEntryEvent.UserEvtCompIndex > 0)
                    {
                        ctlIdx = menuEntryEvent.UserEvtCompIndex;
                    }

                    Events.OnMenuEventSelection(task.ContextID, (MenuEntryEvent)menuEntry, activeForm, ctlIdx);
                }
                else if (menuEntry is MenuEntryWindowMenu)
                {
                    MgFormBase mgFormbase = ((MenuEntryWindowMenu)menuEntry).MgForm;

                    // Activate the form associated with the entry
                    Commands.addAsync(CommandType.ACTIVATE_FORM, mgFormbase);

                    // Put ACT_HIT on form.
                    Events.OnMenuWindowSelection((MenuEntryWindowMenu)menuEntry);
                }
            }
            catch (ApplicationException ex)
            {
                Events.WriteExceptionToLog(ex);
            }
        }
예제 #17
0
파일: Manager.cs 프로젝트: rinavin/RCJS
 /// <summary> Performs first refresh for the table control </summary>
 public static void DoFirstRefreshTable(MgFormBase mgForm)
 {
     if (mgForm != null && !mgForm.ignoreFirstRefreshTable)
     {
         mgForm.ignoreFirstRefreshTable = true;
         mgForm.firstTableRefresh();
     }
 }
예제 #18
0
 /// <summary>
 ///   refresh the internal event menus of form
 /// </summary>
 /// <param name = "form"></param>
 public void refreshInternalEventMenus(MgFormBase form)
 {
     for (int i = 0; i < menus.Count; i++)
     {
         MgMenu menu = menus[i];
         menu.refreshInternalEventMenus(form);
     }
 }
예제 #19
0
        /// <summary>
        /// Create a WindowMenuEntry under a MgMenu
        /// </summary>
        /// <param name="mgFormBase"></param>
        /// <param name="menuType">WindowMenu / Separator</param>
        /// <param name="windowMenuIdx">Index where new menuentry should be added</param>
        /// <param name="guiMgForm"></param>
        /// <param name="menuStyle">Pulldown / Context</param>
        /// <param name="setChecked"
        public override void CreateMenuEntry(MgFormBase mgFormBase, MenuType menuType, int windowMenuIdx, GuiMgForm guiMgForm, MenuStyle menuStyle, bool setChecked)
        {
            MenuEntry menuEntry = base.CreateMenuEntryItem(mgFormBase, menuType, guiMgForm, menuStyle, setChecked);
            MgMenu    mgMenu    = getParentMgMenu();

            mgMenu.addMenu(menuEntry, windowMenuIdx + 1);
            mgMenu.setIndexes(false);
        }
예제 #20
0
 /// <summary>
 ///   Context menus are not automatically disposed when a form is disposed (unlike the swt version).
 ///   For every menu , dispose all its instances for the disposing form.
 /// </summary>
 /// <param name = "form"></param>
 public void disposeFormContexts(MgFormBase form)
 {
     for (int i = 0; i < menus.Count; i++)
     {
         MgMenu menu = menus[i];
         menu.disposeFormContexts(form);
     }
 }
예제 #21
0
파일: Manager.cs 프로젝트: rinavin/RCJS
        /// <summary> Open the form. </summary>
        /// <param name="mgForm">form to be opened.</param>
        public static void OpenForm(MgFormBase mgForm)
        {
            mgForm.startupPosition();

            // non interactive can choose not to open the window.
            if (!mgForm.Opened && (mgForm.getTask().IsInteractive || mgForm.getTask().isOpenWin()))
            {
                if (!mgForm.isSubForm())
                {
                    // if the form is to be opened as a modal, then increment the modal count on its frame window.
                    if (mgForm.isDialog())
                    {
                        MgFormBase topMostFrameForm = mgForm.getTopMostFrameForm();
                        if (topMostFrameForm != null)
                        {
                            topMostFrameForm.UpdateModalFormsCount(mgForm, true);
                        }
                    }

                    if (mgForm.ParentForm != null)
                    {
                        mgForm.ParentForm.ApplyChildWindowPlacement(mgForm);
                    }

                    Commands.addAsync(CommandType.INITIAL_FORM_LAYOUT, mgForm, mgForm.isDialog(), mgForm.Name);
                    ApplyformUserState(mgForm);
                }
                else
                {
                    //layout for subform already was resumend
                    if (!mgForm.getTask().ShouldResumeSubformLayout)
                    {
                        ApplyformUserState(mgForm);
                    }
                }


                if (!mgForm.isSubForm())
                {
                    Commands.addAsync(CommandType.SHOW_FORM, mgForm, mgForm.isDialog(), false, mgForm.Name);
                }

                // expand does not executed until form is opened, when form is opened tree sends expand events on all expanded nodes.
                // we need to perform this before we perform ensureSelection on the selected node - to make sure that selected node is visible
                // QCR #764980
                // for RTE the mgTree might not exist yet, so skip it.
                if (mgForm.hasTree() && mgForm.getMgTree() != null)
                {
                    mgForm.getMgTree().updateExpandStates(1);
                    mgForm.SelectRow(true);
                }

                mgForm.Opened = true;

                Commands.beginInvoke();
            }
        }
예제 #22
0
파일: MenuEntry.cs 프로젝트: rinavin/RCJS
        /// <summary>
        /// </summary>
        /// <param name = "form">
        /// </param>
        /// <param name = "removeSeperat">TODO
        /// </param>
        public void deleteMenuEntryTool(MgFormBase form, bool removeSeperat, bool fourceDelete)
        {
            if (toolIsDefined() || fourceDelete)
            {
                Object toolbar = _parentMgMenu.createAndGetToolbar(form);
                Commands.addAsync(CommandType.DELETE_TOOLBAR_ITEM, toolbar, form, this, 0);

                form.removeToolFromGroupCount(ImageGroup, removeSeperat);
            }
        }
예제 #23
0
        /// <summary>
        ///   Deletes a menu
        /// </summary>
        public void removeAll(MgFormBase form)
        {
            for (int idx = 0; idx < _menuEntries.Count; idx++)
            {
                _menuEntries[idx].deleteMenuEntryObject(form, MenuStyle.MENU_STYLE_PULLDOWN);
            }

            _menuEntries.Clear();
            Commands.invoke();
        }
예제 #24
0
        /// <summary>parse input string and fill inner data</summary>
        public void fillData(MgFormBase mgForm)
        {
            XmlParser parser = Manager.GetCurrentRuntimeContext().Parser;

            _mgForm = mgForm;

            while (initInnerObjects(parser.getNextTag()))
            {
            }
        }
예제 #25
0
        /// <summary>
        ///   This method updates a menu as instantiated for a specific form and style. It returns a reference to a
        ///   menu object - to be used in order to retrieve this menu object, if it is needed. The returned object
        ///   should be placed in the controlsMap, with the created menu for future use
        /// </summary>
        /// <param name = "form">the form for which the menus is instatiated</param>
        /// <returns> menu reference object</returns>
        public MenuReference setToolBarIsInstantiated(MgFormBase form)
        {
            // toolbar will not save a ref to a form. since we do not handle the toolbar dispose,
            // then there will not be a way to remove the ref of the form and we might have a dengling ref.
            // in any case, there is no use for a form on a menuref for the toolbar itself.
            MenuReference menuReference = new MenuReference(null);

            _instantiatedToolbar[form] = menuReference;
            return(menuReference);
        }
예제 #26
0
        /// <summary> Refresh internal actions used in Menus </summary>
        /// <param name = "guiMgMenu"></param>
        /// <param name = "guiMgForm"></param>
        private void refreshMenuActions(GuiMgMenu guiMgMenu, GuiMgForm guiMgForm)
        {
            MgMenu     mgMenu = (MgMenu)guiMgMenu;
            MgFormBase mgForm = (MgFormBase)guiMgForm;

            if (mgMenu != null)
            {
                mgMenu.refreshInternalEventMenus(mgForm);
            }
        }
예제 #27
0
파일: WindowList.cs 프로젝트: rinavin/RCJS
        /// <summary>
        /// Create MenuEntries for WindowList Items.
        /// </summary>
        /// <param name="guiMgForm"></param>
        /// <param name="guiMenuEntry"></param>
        /// <param name="menuStyle"></param>
        public void CreateWindowMenuEntries(GuiMgForm guiMgForm, Object guiMenuEntry, MenuStyle menuStyle)
        {
            Debug.Assert(Misc.IsGuiThread());
            bool      IsMenuEntryWindowMenu = guiMenuEntry is MenuEntryWindowMenu;
            MenuEntry menuEntry;
            int       windowMenuIdx = 0;

            //We get this flag as true only when the menu contains WindowList at first level and it is being used as context menu
            if (IsMenuEntryWindowMenu)
            {
                //Here we add the new WindowMenu in the parent MgMenu
                menuEntry     = (MenuEntryWindowMenu)guiMenuEntry;
                windowMenuIdx = menuEntry.getParentMgMenu().GetWindowMenuEntryIndex();
            }
            else
            {
                //We add the WindowMenu in the MenuEntryMenu
                menuEntry     = (MenuEntryMenu)guiMenuEntry;
                windowMenuIdx = ((MenuEntryMenu)menuEntry).GetWindowMenuEntryIndex();
            }

            // Enable/Disable MenuEntries for CloseAll, NextWindow & PreviousWindow.
            TaskBase task   = ((MgFormBase)guiMgForm).getTask();
            MgMenu   mgMenu = menuEntry.getParentMgMenu();

            mgMenu.enableInternalEvent((MgFormBase)guiMgForm, InternalInterface.MG_ACT_CLOSE_ALL_WIN, task.ActionManager.isEnabled(InternalInterface.MG_ACT_CLOSE_ALL_WIN), null);
            mgMenu.enableInternalEvent((MgFormBase)guiMgForm, InternalInterface.MG_ACT_NEXT_RT_WINDOW, task.ActionManager.isEnabled(InternalInterface.MG_ACT_NEXT_RT_WINDOW), null);
            mgMenu.enableInternalEvent((MgFormBase)guiMgForm, InternalInterface.MG_ACT_PREV_RT_WINDOW, task.ActionManager.isEnabled(InternalInterface.MG_ACT_PREV_RT_WINDOW), null);

            lock (_windowListLock)
            {
                if (IsValidIndex(windowMenuIdx))
                {
                    // Delete the existing MenuEntries.
                    DeleteWindowMenuEntries(menuEntry, windowMenuIdx + 1, IsMenuEntryWindowMenu);

                    // Create new MenuEntries for WindowList Items.
                    if (_windowList.Count > 0)
                    {
                        // Create menu item for a form in window list.
                        for (int i = 0; i < _windowList.Count; i++)
                        {
                            MgFormBase mgForm = _windowList[i];
                            menuEntry.CreateMenuEntry(mgForm, GuiMenuEntry.MenuType.WINDOW_MENU_ENTRY, windowMenuIdx++, guiMgForm, menuStyle, _sortByRecentlyUsed ? i == 0 : i == _currWinIdx);
                        }

                        // Create a separator to distinguish the window menu items only for PullDown menu
                        if (menuStyle != MenuStyle.MENU_STYLE_CONTEXT)
                        {
                            menuEntry.CreateMenuEntry(null, GuiMenuEntry.MenuType.SEPARATOR, windowMenuIdx++, guiMgForm, menuStyle, false);
                        }
                    }
                }
            }
        }
예제 #28
0
 /// <summary>
 ///   Remove menu entry at location idx from mgMenu.
 /// </summary>
 /// <param name = "idx">location of menu entry.</param>
 /// <param name = "mgMenu">menu from which menu entry is to be deleted.</param>
 /// <param name = "form">Frame window</param>
 private void RemoveAt(int idx, object mgMenu, MgFormBase form)
 {
     if (mgMenu.GetType() == typeof(MgMenu))
     {
         ((MgMenu)mgMenu).removeAt(idx, form);
     }
     else
     {
         ((MenuEntryMenu)mgMenu).removeAt(idx, form);
     }
 }
예제 #29
0
파일: MenuEntry.cs 프로젝트: rinavin/RCJS
        /// <summary>
        ///   This method creates the gui commands in order to delete the matching menu object.
        /// </summary>
        /// <param name = "menuStyle"></param>
        public void deleteMenuEntryObjectItem(MgFormBase form, MenuStyle menuStyle)
        {
            //we call this method for menuEntry and MenuStyle(context\pulldown)
            //when create toolbar without pulldown the Reference is null
            MenuReference menuReference = getInstantiatedMenu(form, menuStyle);

            if (menuReference != null)
            {
                Commands.addAsync(CommandType.DELETE_MENU_ITEM, menuReference, menuStyle, this);
            }
        }
예제 #30
0
        /// <summary>
        /// Create a WindowMenuEntry under a MenuEntryMenu and also create a ToolSripMenuItem using Manager.
        /// </summary>
        /// <param name="mgFormBase"></param>
        /// <param name="menuType">WindowMenu / Separator</param>
        /// <param name="windowMenuIdx">Index where new menuentry should be added</param>
        /// <param name="guiMgForm"></param>
        /// <param name="menuStyle">Pulldown / Context</param>
        /// <param name="setChecked"
        public override void CreateMenuEntry(MgFormBase mgFormBase, MenuType menuType, int windowMenuIdx, GuiMgForm guiMgForm, MenuStyle menuStyle, bool setChecked)
        {
            MenuReference menuReference = getInstantiatedMenu(guiMgForm, menuStyle);
            MenuEntry     menuEntry     = base.CreateMenuEntryItem(mgFormBase, menuType, guiMgForm, menuStyle, setChecked);

            addSubMenu(menuEntry, windowMenuIdx + 1);
            setIndexes(false);

            // Create a corresponding ToopStripMenuItem for windowMenuEntry.
            Manager.CreateMenuItem(menuReference, menuEntry, guiMgForm, menuStyle, menuEntry.getIndex() - 1);
        }