public override OperationState Save(EditorItem <Design> page)
        {
            try
            {
                currentPage = (DesignerEditorItem)page;
                if (base.Save(page) == OperationState.STOP)
                {
                    return(OperationState.STOP);
                }
            }
            catch (Exception)
            {
                DisplayError("Unable to save Design", "Unable to save Excel file.");
                return(OperationState.STOP);
            }
            Design editedObject = page.EditedObject;

            if (DesignWindow != null)
            {
                DesignWindow.curentDesign = editedObject;
            }
            int CountOpeningDesigner = getEditor().ListChangeHandler.Items.Count;

            return(OperationState.CONTINUE);
        }
Exemplo n.º 2
0
        /// <summary>
        /// validate operatuions syntax
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public OperationState validateOperations(EditorItem <CalculatedMeasure> page)
        {
            if (page.EditedObject.GetCalculatedMeasureItems().Count == 0)
            {
                string message = "Item can't be empty";
                Kernel.Util.MessageDisplayer.DisplayError("Syntax Error", message);
                return(OperationState.STOP);
            }
            int countEqualUsed = 0;

            foreach (CalculatedMeasureItem item in page.EditedObject.GetCalculatedMeasureItems())
            {
                if (item.measure != null && (item.sign == null || item.sign.Equals("")) && !item.openPar && item.position > 0)
                {
                    string message = "sign of measure " + item.measure.name + " can't be empty ";
                    Kernel.Util.MessageDisplayer.DisplayError("Syntax Error", message);
                    return(OperationState.STOP);
                }
                if (item.sign != null && item.sign.Equals("="))
                {
                    countEqualUsed = countEqualUsed + 1;
                }
            }
            if (countEqualUsed > 1)
            {
                string message = "Cannot save with more than one operator = ";
                Kernel.Util.MessageDisplayer.DisplayError("Syntax Error", message);
                return(OperationState.STOP);
            }

            return(OperationState.CONTINUE);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la calculatedMeasure selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La calculatedMeasure sélectionnée</param>
        protected void onSelectCalculatedMeasureFromSidebar(object sender)
        {
            if (sender != null && sender is CalculatedMeasure)
            {
                CalculatedMeasure CalculatedMeasure = (CalculatedMeasure)sender;
                EditorItem <CalculatedMeasure> page = getCalculatedMeasureEditor().getPage(CalculatedMeasure.name);
                if (page != null)
                {
                    page.fillObject();
                    getCalculatedMeasureEditor().selectePage(page);
                    string expression = page.EditedObject.computeExpression();
                    this.ApplicationManager.MainWindow.StatusLabel.Content = String.IsNullOrEmpty(expression) ? "" : "Operation: " + expression; initializePageHandlers(page);
                }
                else if (CalculatedMeasure.oid != null && CalculatedMeasure.oid.HasValue)
                {
                    this.Open(CalculatedMeasure.oid.Value);
                }
                else
                {
                    page = getCalculatedMeasureEditor().addOrSelectPage(CalculatedMeasure);
                    initializePageHandlers(page);
                    page.Title = CalculatedMeasure.name;

                    getCalculatedMeasureEditor().ListChangeHandler.AddNew(CalculatedMeasure);
                }
                CalculatedMeasureEditorItem pageOpen = (CalculatedMeasureEditorItem)getCalculatedMeasureEditor().getActivePage();
            }
        }
Exemplo n.º 4
0
 private void SetPassword(object entity, EditorItem editorItem, PropertyInfo property)
 {
     if (entity.GetType().GetInterfaces().Count(t => t == typeof(IPassword)) == 0)
         property.SetValue(entity, editorItem.Value, null);
     else
         typeof(IPassword).GetMethod("SetPassword").Invoke(entity, new object[] { editorItem.Value });
 }
Exemplo n.º 5
0
 private void onSelectPresentationFromSidebar(object sender)
 {
     if (sender != null && sender is Presentation)
     {
         Presentation table                 = (Presentation)sender;
         EditorItem <Presentation> page     = getPresentationEditor().getPage(table.name);
         Kernel.Service.FileDirs   fileDirs = this.Service.FileService.GetFileDirs();
         string excelDir = getPowerPointFolder();
         string filePath = excelDir + table.name + EdrawOffice.EXCEL_EXT;
         if (page != null)
         {
             page.fillObject();
             getPresentationEditor().selectePage(page);
         }
         else if (table.oid != null && table.oid.HasValue && table.oid.Value > 0)
         {
             this.Open(table.oid.Value);
         }
         else
         {
             page = getPresentationEditor().addOrSelectPage(table);
             initializePageHandlers(page);
             page.Title = table.name;
             getPresentationEditor().ListChangeHandler.AddNew(table);
         }
         PresentationEditorItem pageOpen = (PresentationEditorItem)getPresentationEditor().getActivePage();
         //pageOpen.getInputTableForm().SpreadSheet.Open(filePath, EdrawOffice.EXCEL_ID);
         /// UpdateStatusBar(null);
     }
 }
Exemplo n.º 6
0
        private void RenameDataAndColumn(EditorItem newItem, renamedItems renItem)
        {
            string tmpColumnString;

            foreach (EditorItem item in newItem.Children)
            {
                RenameDataAndColumn(item, renItem);
                if (item is DynamicEditorItemInterface)
                {
                    DynamicEditorItemInterface tmp = (DynamicEditorItemInterface)item;
                    if (renItem.type == 0)
                    {
                        if (tmp.SourceDataStream == renItem.befoure)
                        {
                            tmpColumnString      = tmp.SourceColumn;
                            tmp.SourceDataStream = renItem.after;
                            tmp.SourceColumn     = tmpColumnString;
                        }
                    }
                    else if (renItem.type == 1)
                    {
                        if (tmp.SourceColumn == renItem.befoure)
                        {
                            tmp.SourceColumn = renItem.after;
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// This will select item. You can use list of selected items to check what is selected. Selection is done so deepest object becomes selected.
        /// </summary>
        /// <param name="x">world x coordinate</param>
        /// <param name="y">world y coordinate</param>
        /// <returns></returns>
        public void SelectItem(float mx, float my, bool addToSelection)
        {
            EditorItem selectedItem = editorProject.CurrentReportPage.SelectItem(mx, my);

            if (selectedItem != null)
            {
                if (!this.SelectedItems.Contains(selectedItem))
                {
                    if (!addToSelection)
                    {
                        DeselectAll();
                        selectedItem.IsSelected = true;
                        this.SelectedItems.Add(selectedItem);
                    }
                    else
                    {
                        selectedItem.IsSelected = true;
                        this.SelectedItems.Add(selectedItem);
                    }
                }
            }
            else if (!addToSelection)
            {
                DeselectAll();
            }

            ShowPropertiesOfSelectedItems();

            // notify for selection changed
            if (this.SelectionChanged != null)
            {
                this.SelectionChanged(this.SelectedItems);
            }
        }
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectStructuredReportFromSidebar(object sender)
        {
            if (sender != null && sender is Kernel.Domain.StructuredReport)
            {
                Kernel.Domain.StructuredReport design = (Kernel.Domain.StructuredReport)sender;
                EditorItem<Kernel.Domain.StructuredReport> page = getStructuredReportEditor().getPage(design.name);
                if (page != null)
                {
                    page.fillObject();
                    getStructuredReportEditor().selectePage(page);
                }
                else if (design.oid != null && design.oid.HasValue)
                {
                    this.Open(design.oid.Value);
                }
                else
                {
                    page = getStructuredReportEditor().addOrSelectPage(design);
                    initializePageHandlers(page);
                    page.Title = design.name;

                    getStructuredReportEditor().ListChangeHandler.AddNew(design);
                }
                StructuredReportEditorItem pageOpen = (StructuredReportEditorItem)getStructuredReportEditor().getActivePage();
                UpdateStatusBar();
            }
        }
Exemplo n.º 9
0
                protected override void OnInsertComplete(int index, object value)
                {
                    EditorItem item = (EditorItem)value;

                    if (item.Host != null)
                    {
                        this._listBoxList.Insert(index, item.Host);
                        base.OnInsertComplete(index, value);
                    }
                    else
                    {
                        if (!this._targetCollectionList.Contains(item.Component))
                        {
                            try
                            {
                                this._owner.Context.OnComponentChanging();
                                this._targetCollectionList.Insert(index - 1, item.Component);
                            }
                            finally
                            {
                                this._owner.Context.OnComponentChanged();
                            }
                        }
                        this._listBoxList.Insert(index, item.Component);
                        base.OnInsertComplete(index, value);
                    }
                }
Exemplo n.º 10
0
 public MovingCommandItem(EditorItem owner) : base(CommandPosition.TopLeft, owner)
 {
     this.commandSize    = 10;
     this.widthInPixels  = 10;
     this.heightInPixels = 10;
     this.cursor         = Cursors.SizeAll;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectDesignFromSidebar(object sender)
        {
            if (sender != null && sender is Design)
            {
                Design design            = (Design)sender;
                EditorItem <Design> page = getDesignerEditor().getPage(design.name);
                if (page != null)
                {
                    page.fillObject();
                    getDesignerEditor().selectePage(page);
                }
                else if (design.oid != null && design.oid.HasValue)
                {
                    this.Open(design.oid.Value);
                }
                else
                {
                    page = getDesignerEditor().addOrSelectPage(design);
                    initializePageHandlers(page);
                    page.Title = design.name;

                    getDesignerEditor().ListChangeHandler.AddNew(design);
                }
                DesignerEditorItem pageOpen = (DesignerEditorItem)getDesignerEditor().getActivePage();

                UpdateStatusBar();
            }
        }
Exemplo n.º 12
0
        public override OperationState SaveAs()
        {
            EditorItem <T> page = getEditor().getActivePage();

            if (page == null)
            {
                return(OperationState.STOP);
            }
            string newName = getNewPageName(page.Title);

            page.InitializeCustomDialog("Save as");
            page.namePanel.NameTextBox.Text = newName;
            page.namePanel.NameTextBox.SelectAll();
            if (page.CustomDialog.ShowCenteredToMouse().Value)
            {
                string name = page.namePanel.NameTextBox.Text;
                if (name == null || string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name))
                {
                    Util.MessageDisplayer.DisplayError("Save as", "The name can't be empty!");
                    return(OperationState.STOP);
                }
                return(SaveAs(name));
            }

            return(OperationState.CONTINUE);
        }
Exemplo n.º 13
0
        public SizingCommandItem(CommandPosition position, EditorItem owner) : base(position, owner)
        {
            this.commandSize    = 6;
            this.widthInPixels  = 6;
            this.heightInPixels = 6;
            switch (this.CommandPosition)
            {
            case CommandPosition.TopLeft:
            case CommandPosition.BottomRight:
                this.cursor = Cursors.SizeNWSE;

                break;

            case CommandPosition.TopCenter:
            case CommandPosition.BottomCenter:
                this.cursor = Cursors.SizeNS;
                break;

            case CommandPosition.MiddleLeft:
            case CommandPosition.MiddleRight:
                this.cursor = Cursors.SizeWE;
                break;

            case CommandPosition.TopRight:
            case CommandPosition.BottomLeft:
                this.cursor = Cursors.SizeNESW;
                break;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectProfilFromSidebar(object sender)
        {
            if (sender != null && sender is Domain.Profil)
            {
                Domain.Profil profil            = (Domain.Profil)sender;
                EditorItem <Domain.Profil> page = getProfilEditor().getPage(profil.name);
                if (page != null)
                {
                    page.fillObject();
                    getProfilEditor().selectePage(page);
                }
                else if (profil.oid != null && profil.oid.HasValue)
                {
                    this.Open(profil.oid.Value);
                }
                else
                {
                    page = getProfilEditor().addOrSelectPage(profil);
                    initializePageHandlers(page);
                    page.Title = profil.name;

                    getProfilEditor().ListChangeHandler.AddNew(profil);
                }
                ProfilEditorItem pageOpen = (ProfilEditorItem)getProfilEditor().getActivePage();
            }
        }
Exemplo n.º 15
0
 public EditorUpdateAction(EditorItem item, string property, object oldValue, object newValue)
 {
     this.item     = item;
     this.property = property;
     this.oldValue = oldValue;
     this.newValue = newValue;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Create <fonts> node and put all fonts here by analyzing BaseTextItems in parentItem
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="element"></param>
        public void Save(EditorItem parentItem, System.Xml.XmlDocument doc, System.Xml.XmlElement element)
        {
            XmlElement el = doc.CreateElement("Fonts");

            List <BaseTextItems> baseTextItems = new List <BaseTextItems>();
            EditorFont           editorFont;

            GetBaseTextItems(parentItem, baseTextItems);

            this.fonts.Clear();
            foreach (BaseTextItems textItem in baseTextItems)
            {
                // create and save each font still not created. We first check if it exists so not to save duplicates
                // currently font is unique if has same name and style
                editorFont = FindFont(textItem.Font.Name, textItem.Font.Style);
                if (editorFont == null)
                {
                    editorFont = CreateFont(textItem.Font);
                    editorFont.Save(doc, el);
                }
                // so we later know how to load it
                textItem.FontSaveId = editorFont.SaveID;
            }
            element.AppendChild(el);
        }
 public override OperationState Save(EditorItem <Kernel.Domain.StructuredReport> page)
 {
     if (page.IsModify)
     {
         if (!page.validateEdition())
         {
             return(OperationState.STOP);
         }
         Kernel.Domain.StructuredReport table;
         if (page.EditedObject is Kernel.Domain.TransformationTable)
         {
             table = (Kernel.Domain.TransformationTable)page.EditedObject;
         }
         else
         {
             table = page.EditedObject;
         }
         try
         {
             StructuredReportEditorItem currentPage = (StructuredReportEditorItem)page;
             this.EditedObject = (Kernel.Domain.TransformationTable)GetTransformationTableService().Save(table);
         }
         catch (Exception)
         {
             return(OperationState.STOP);
         }
         this.EditedObject = (Kernel.Domain.TransformationTable)page.EditedObject;
     }
     return(OperationState.CONTINUE);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Sauve les objets en cours d'édition sur la page.
 /// </summary>
 /// <returns>
 /// OperationState.CONTINUE si l'opération a réussi
 /// OperationState.STOP sinon
 /// </returns>
 public virtual OperationState Save(EditorItem <T> page)
 {
     if (!page.IsReadOnly && page.IsModify)
     {
         if (!page.validateEdition())
         {
             return(OperationState.STOP);
         }
         page.fillObject();
         T editedObject = page.EditedObject;
         try
         {
             editedObject      = Service.Save(editedObject);
             page.EditedObject = editedObject;
             page.displayObject();
             page.IsModify = false;
         }
         catch (Domain.BcephalException)
         {
             DisplayError("Unable to save item", "Unable to save : " + editedObject.ToString());
             return(OperationState.STOP);
         }
     }
     return(OperationState.CONTINUE);
 }
Exemplo n.º 19
0
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectTargetFromSidebar(object sender)
        {
            if (sender != null && sender is Target)
            {
                Target target            = (Target)sender;
                EditorItem <Target> page = getTargetEditor().getPage(target.name);
                if (page != null)
                {
                    page.fillObject();
                    getTargetEditor().selectePage(page);
                }
                else if (target.oid != null && target.oid.HasValue)
                {
                    this.Open(target.oid.Value);
                }
                else
                {
                    page = getTargetEditor().addOrSelectPage(target);
                    initializePageHandlers(page);
                    page.Title = target.name;

                    getTargetEditor().ListChangeHandler.AddNew(target);
                }
                TargetEditorItem pageOpen = (TargetEditorItem)getTargetEditor().getActivePage();
            }
        }
Exemplo n.º 20
0
 private void onSelectCombinedTreeFromSidebar(object sender)
 {
     if (sender != null && sender is Kernel.Domain.CombinedTransformationTree)
     {
         Kernel.Domain.CombinedTransformationTree ctree             = (Kernel.Domain.CombinedTransformationTree)sender;
         EditorItem <Kernel.Domain.CombinedTransformationTree> page = getCombineTransformationTreeEditor().getPage(ctree.name);
         if (page != null)
         {
             page.fillObject();
             getCombineTransformationTreeEditor().selectePage(page);
         }
         else if (ctree.oid != null && ctree.oid.HasValue)
         {
             this.Open(ctree.oid.Value);
         }
         else
         {
             page = getCombineTransformationTreeEditor().addOrSelectPage(ctree);
             initializePageHandlers(page);
             page.Title = ctree.name;
             getCombineTransformationTreeEditor().ListChangeHandler.AddNew(ctree);
         }
         CombinedTransformationTreeEditorItem pageOpen = (CombinedTransformationTreeEditorItem)getCombineTransformationTreeEditor().getActivePage();
     }
 }
 public override OperationState Save(EditorItem <ReconciliationFilterTemplate> page)
 {
     if (!page.IsReadOnly && page.IsModify)
     {
         if (!page.validateEdition())
         {
             return(OperationState.STOP);
         }
         page.fillObject();
         ReconciliationFilterTemplate editedObject = page.EditedObject;
         try
         {
             page.EditedObject = GetService().Save(editedObject);
             //page.EditedObject = GetService().getByOid(editedObject.oid.Value);
             ((ReconciliationFilterTemplateEditorItem)page).getForm().displayObject();
             page.IsModify = false;
         }
         catch (Misp.Kernel.Domain.BcephalException)
         {
             DisplayError("Unable to save item", "Unable to save : " + editedObject.ToString());
             return(OperationState.STOP);
         }
     }
     return(OperationState.CONTINUE);
 }
Exemplo n.º 22
0
        public virtual void CustomizeForUser(EditorItem <T> page)
        {
            List <Right>      rights   = null;
            PrivilegeObserver observer = new PrivilegeObserver();

            if (!ApplicationManager.User.IsAdmin() && page.EditedObject.oid.HasValue)
            {
                RightService service = ApplicationManager.ControllerFactory.ServiceFactory.GetRightService();
                rights = service.getUserRights(this.SubjectType.label, page.EditedObject.oid.Value);
            }
            if (this.ToolBar != null)
            {
                this.ToolBar.Customize(this.FunctionalityCode, observer, rights, page.IsReadOnly);
            }
            if (this.SideBar != null)
            {
                this.SideBar.Customize(rights, page.IsReadOnly);
            }
            CustomizeContexMenu(observer, rights, page);

            bool edit = RightsUtil.HasRight(Domain.RightType.EDIT, rights);

            page.CanRename = edit && !page.IsReadOnly;
            page.CanSave   = edit;
        }
Exemplo n.º 23
0
        public override OperationState Edit(object oid)
        {
            ApplicationManager.MainWindow.IsBussy = true;
            Kernel.Application.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                                                          new Action(() =>
            {
                try
                {
                    this.Search();
                    ApplicationManager.MainWindow.IsBussy = true;
                    EditorItem <Kernel.Domain.Model> page = getModelController().getEditor().getPage((int)oid);
                    getModelController().getEditor().selectePage(page);
                }
                catch (Exception e)
                {
                    MessageDisplayer.DisplayError("Error", e.Message);
                }
                finally
                {
                    ApplicationManager.MainWindow.IsBussy = false;
                }
            }));

            return(OperationState.CONTINUE);
        }
Exemplo n.º 24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected virtual void OnPageClosing(object sender, CancelEventArgs args)
        {
            if (sender is EditorItem <T> )
            {
                EditorItem <T> page = (EditorItem <T>)sender;
                if (page.IsModify && !page.IsReadOnly)
                {
                    MessageBoxResult result = Util.MessageDisplayer.DisplayYesNoCancelQuestion("Close Page",
                                                                                               "You are about closing page : " + page.Title + "\nDo you want to save change before close?");
                    if (result == MessageBoxResult.Yes)
                    {
                        OperationState state = Save(page);
                        if (state == OperationState.STOP)
                        {
                            args.Cancel = true;
                        }
                    }
                    else if (result == MessageBoxResult.Cancel)
                    {
                        args.Cancel = true;
                    }
                }
                else
                {
                    MessageBoxResult result = Util.MessageDisplayer.DisplayYesNoQuestion("Close Page",
                                                                                         "You are about closing page : " + page.Title + "\nDo you want to continue?");
                    if (result != MessageBoxResult.Yes)
                    {
                        args.Cancel = true;
                    }
                }

                this.IsModify = this.IsModify;
            }
        }
Exemplo n.º 25
0
        private async Task ShowDialog()
        {
            var items = EditorItem <Foo> .GenerateEditorItems();

            var item = items.First(i => i.GetFieldName() == nameof(Foo.Hobby));

            item.Data = Foo.GenerateHobbys(Localizer);

            var option = new EditDialogOption <Foo>()
            {
                Title        = "编辑对话框",
                Model        = Model,
                Items        = items,
                OnCloseAsync = () =>
                {
                    Trace.Log("关闭按钮被点击");
                    return(Task.CompletedTask);
                },
                OnSaveAsync = context =>
                {
                    Trace.Log("保存按钮被点击");
                    return(Task.FromResult(true));
                }
            };

            await DialogService.ShowEditDialog(option);
        }
Exemplo n.º 26
0
        public override OperationState SaveAs(string name)
        {
            EditorItem <T> page = getEditor().getActivePage();

            page.InitializeCustomDialog("Save as");
            if (!page.EditedObject.oid.HasValue)
            {
                Rename(name);
                return(Save(page));
            }

            if (page != null && validateName(page, name))
            {
                try
                {
                    T item = Service.SaveAs(page.EditedObject.oid.Value, name);
                    Open(item);
                }
                catch (Domain.BcephalException)
                {
                    DisplayError("Unable to save item", "Unable to save : " + name);
                    return(OperationState.STOP);
                }
            }
            return(OperationState.CONTINUE);
        }
Exemplo n.º 27
0
 public EditorUpdateAction(EditorItem item, string[] property, object[] oldValues, object[] newValues)
 {
     this.item       = item;
     this.properties = property;
     this.oldValues  = oldValues;
     this.newValues  = newValues;
 }
Exemplo n.º 28
0
        public override bool validateName(EditorItem <TransformationTree> page, string name)
        {
            if (!base.validateName(page, name))
            {
                return(false);
            }
            TransformationTree tree = ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.getTransformationTreeByName(name);

            if (tree == null)
            {
                return(true);
            }

            if (page.EditedObject.oid.HasValue && tree.oid.HasValue && page.EditedObject.oid.Value != tree.oid.Value)
            {
                Kernel.Util.MessageDisplayer.DisplayError("Duplicate Name", "Another tree named " + name + " already exists!");
                return(false);
            }

            if (page.EditedObject.oid.HasValue != (tree.oid.HasValue && tree.oid.Value > 0))
            {
                Kernel.Util.MessageDisplayer.DisplayError("Duplicate Name", "Another tree named " + name + " already exists!");
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectTemplateFromSidebar(object sender)
        {
            if (sender != null && sender is ReconciliationFilterTemplate)
            {
                ReconciliationFilterTemplate grid = (ReconciliationFilterTemplate)sender;
                EditorItem <ReconciliationFilterTemplate> page = getEditor().getPage(grid.name);
                if (page != null)
                {
                    page.fillObject();
                    getEditor().selectePage(page);
                }
                else if (grid.oid != null && grid.oid.HasValue)
                {
                    this.Open(grid.oid.Value);
                }
                else
                {
                    page = getEditor().addOrSelectPage(grid);
                    initializePageHandlers(page);
                    page.Title = grid.name;

                    getEditor().ListChangeHandler.AddNew(grid);
                }
                ReconciliationFilterTemplateEditorItem pageOpen = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectTransformationTreeFromSidebar(object sender)
        {
            if (sender != null && sender is TransformationTree)
            {
                TransformationTree tree = (TransformationTree)sender;
                EditorItem <TransformationTree> page = getTransformationTreeEditor().getPage(tree.name);
                if (page != null)
                {
                    page.fillObject();
                    getTransformationTreeEditor().selectePage(page);
                }
                else if (tree.oid != null && tree.oid.HasValue)
                {
                    this.Open(tree.oid.Value);
                }
                else
                {
                    page = getTransformationTreeEditor().addOrSelectPage(tree);
                    initializePageHandlers(page);
                    page.Title = tree.name;

                    getTransformationTreeEditor().ListChangeHandler.AddNew(tree);
                }
                //UpdateStatusBar();
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// this will delete item
        /// </summary>
        /// <param name="item"></param>
        public void DeleteItem(EditorItem item)
        {
            // mark item as deleted
            //item.IsDeleted = true;
            // detach it from parent
            if (item.Parent == null)
            {
                throw new Exception("Item for removal has no parent");
            }
            else
            {
                // find exact child and remember index of it
                int parentIndex = 0;
                foreach (EditorItem child in item.Parent.Children)
                {
                    if (child == item)
                    {
                        break;
                    }
                    parentIndex++;
                }
                item.Parent.Children.Remove(item);
                item.StopMoving(true);
                item.IsSelected = false;
                if (EditorItemDeleted != null && item.NotifyDeletion)
                {
                    EditorItemDeleted(item);
                }

                ActionManager.Instance.EditorItemDeleted(item, parentIndex);

                // perform docking on parent to rearrange items
                item.Parent.DockAll();
            }
        }
Exemplo n.º 32
0
 private void Setter(object entity, EditorItem editorItem, System.Reflection.PropertyInfo property)
 {
     Saving = true;
     if (Value == null)
         Value = Activator.CreateInstance(typeof(List<>).MakeGenericType(Type));
     var collection = typeof(ICollection<>).MakeGenericType(Type);
     var add = collection.GetMethod("Add");
     var clear = collection.GetMethod("Clear");
     clear.Invoke(Value,null);
     foreach (var item in List.Items)
         add.Invoke(Value, new object[] { item });
     Saving = false;
 }