예제 #1
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();
            }
        }
예제 #2
0
        protected void onGroupFieldChange()
        {
            TargetEditorItem page = (TargetEditorItem)getTargetEditor().getActivePage();
            string           name = page.getTargetForm().TargetPropertiesPanel.groupField.textBox.Text;

            ((TargetSideBar)SideBar).TargetGroup.TargetTreeview.updateTarget(name, page.Title, true);
            OnChange();
        }
예제 #3
0
        protected override void Rename(string name)
        {
            TargetEditorItem page = (TargetEditorItem)getTargetEditor().getActivePage();

            page.getTargetForm().TargetPropertiesPanel.nameTextBox.Text = name;
            page.EditedObject.name = name;
            base.Rename(name);
        }
예제 #4
0
        public override OperationState Rename()
        {
            if (base.Rename() != OperationState.CONTINUE)
            {
                return(OperationState.STOP);
            }

            IsRenameOnDoubleClick = true;
            TargetEditorItem page = (TargetEditorItem)getTargetEditor().getActivePage();

            return(ValidateEditedNewName(page.EditedObject.name));
        }
예제 #5
0
        /// <summary>
        /// Cette methode permet de créer une nouvelle table.
        /// </summary>
        /// <returns>CONTINUE si la création du nouveau Model se termine avec succès. STOP sinon</returns>
        public override OperationState Create()
        {
            Target target = GetNewTarget();

            ((TargetSideBar)SideBar).TargetGroup.TargetTreeview.AddTarget(target);
            TargetEditorItem page = (TargetEditorItem)getTargetEditor().addOrSelectPage(target);

            initializePageHandlers(page);
            page.Title = target.name;

            getTargetEditor().ListChangeHandler.AddNew(target);
            return(OperationState.CONTINUE);
        }
예제 #6
0
        /// <summary>
        /// Cette methode est exécuté lorsqu'on édit le nom de la table active.
        /// Si l'utilisateur tappe sur la touche ENTER, le nouveau nom est validé.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void onNameTextChange(object sender, KeyEventArgs args)
        {
            TargetEditorItem page = (TargetEditorItem)getTargetEditor().getActivePage();

            if (args.Key == Key.Escape)
            {
                page.getTargetForm().TargetPropertiesPanel.nameTextBox.Text = page.Title;
            }
            else if (args.Key == Key.Enter)
            {
                ValidateEditedNewName();
            }
        }
예제 #7
0
 /// <summary>
 /// Cette méthode est exécutée lorsqu'on sélectionne une target sur la sidebar.
 /// Cette opération a pour but de rajouté la target sélectionnée au filtre de la table en édition,
 /// ou au scope des cellProperties correspondants à la sélection Excel.
 /// </summary>
 /// <param name="sender">La target sélectionné</param>
 protected void onSelectStandardTargetFromSidebar(object sender)
 {
     if (sender != null && sender is Target)
     {
         Target           value = (Target)sender;
         TargetEditorItem page  = (TargetEditorItem)getTargetEditor().getActivePage();
         if (page == null)
         {
             return;
         }
         page.getTargetForm().ScopePanel.SetTargetItemValue(value);
     }
 }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected virtual OperationState ValidateEditedNewName(string newName = "")
        {
            TargetEditorItem page  = (TargetEditorItem)getTargetEditor().getActivePage();
            Target           table = page.EditedObject;

            if (string.IsNullOrEmpty(newName))
            {
                newName = page.getTargetForm().TargetPropertiesPanel.nameTextBox.Text.Trim();
            }
            if (string.IsNullOrEmpty(newName))
            {
                DisplayError("Empty Name", "The Target name can't be mepty!");
                page.getTargetForm().TargetPropertiesPanel.nameTextBox.SelectAll();
                page.getTargetForm().TargetPropertiesPanel.nameTextBox.Focus();
                return(OperationState.STOP);
            }

            bool found = false;

            if (GetTargetService().getByName(newName) != null)
            {
                found = true;
            }

            foreach (TargetEditorItem unInputTable in getTargetEditor().getPages())
            {
                if ((found && newName != getTargetEditor().getActivePage().Title) || (unInputTable != getTargetEditor().getActivePage() && newName == unInputTable.Title))
                {
                    DisplayError("Duplicate Name", "There is another Target named: " + newName);
                    page.getTargetForm().TargetPropertiesPanel.nameTextBox.Text = page.Title;
                    page.getTargetForm().TargetPropertiesPanel.nameTextBox.SelectAll();
                    page.getTargetForm().TargetPropertiesPanel.nameTextBox.Focus();
                    return(OperationState.STOP);
                }
            }
            if (!IsRenameOnDoubleClick)
            {
                if (table.name.ToUpper().Equals(newName.ToUpper()))
                {
                    return(OperationState.CONTINUE);
                }
            }

            ((TargetSideBar)SideBar).TargetGroup.TargetTreeview.updateTarget(newName, table.name, false);
            table.name = newName;
            page.Title = newName;
            OnChange();
            return(OperationState.CONTINUE);
        }
예제 #9
0
 public override OperationState Save(EditorItem <Target> page)
 {
     try
     {
         currentPage = (TargetEditorItem)page;
         if (base.Save(page) == OperationState.STOP)
         {
             return(OperationState.STOP);
         }
     }
     catch (Exception)
     {
         DisplayError("Unable to save Target", "Unable to save Excel file.");
         return(OperationState.STOP);
     }
     return(OperationState.CONTINUE);
 }
예제 #10
0
        /// <summary>
        /// Initialisation des Handlers sur une nouvelle page.
        /// En plus des handlers de base, on initialise les handlers sur :
        /// - DesignerPropertiesPanel
        /// -
        /// - SpreadSheet
        /// -
        /// </summary>
        protected override void initializePageHandlers(EditorItem <Target> page)
        {
            base.initializePageHandlers(page);
            TargetEditorItem editorPage = (TargetEditorItem)page;

            editorPage.getTargetForm().TargetPropertiesPanel.groupField.GroupService = GetTargetService().GroupService;
            editorPage.getTargetForm().TargetPropertiesPanel.groupField.subjectType = SubjectTypeFound();
            editorPage.getTargetForm().TargetPropertiesPanel.nameTextBox.KeyUp += onNameTextChange;
            editorPage.getTargetForm().TargetPropertiesPanel.nameTextBox.LostFocus += onNameTextLostFocus;
            editorPage.getTargetForm().TargetPropertiesPanel.groupField.Changed += onGroupFieldChange;
            editorPage.getTargetForm().ScopePanel.Changed += onScopePanelChange;
            editorPage.getTargetForm().ScopePanel.ItemDeleted += onScopeItemDeleted;

            if (editorPage.getTargetForm().AdministrationBar != null)
            {
                editorPage.getTargetForm().AdministrationBar.Changed += OnChangeEventHandler;
            }
        }
예제 #11
0
        protected void onScopeItemDeleted(object item)
        {
            TargetEditorItem page = (TargetEditorItem)getTargetEditor().getActivePage();

            page.EditedObject.targetItemListChangeHandler.AddDeleted((TargetItem)item);
        }