/// <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(); } }
protected override void Rename(string name) { ProfilEditorItem page = (ProfilEditorItem)getProfilEditor().getActivePage(); page.EditedObject.name = name; base.Rename(name); }
/// <summary> /// /// </summary> /// <param name="oid"></param> /// <returns></returns> public override OperationState Open(Domain.Profil profil) { ProfilEditorItem page = (ProfilEditorItem)getEditor().addOrSelectPage(profil); initializePageHandlers(page); page.getProfilForm().displayObject(); getEditor().ListChangeHandler.AddNew(profil); return(OperationState.CONTINUE); }
/// <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 <Domain.Profil> page) { base.initializePageHandlers(page); ProfilEditorItem editorPage = (ProfilEditorItem)page; editorPage.getProfilForm().profileMainPanel.nameTextBox.KeyUp += onNameTextChange; editorPage.getProfilForm().profileMainPanel.nameTextBox.LostFocus += onNameTextLostFocus; editorPage.getProfilForm().profileMainPanel.RightsPanel.Changed += OnRightsChanged; }
/// <summary> /// /// </summary> /// <returns></returns> protected virtual OperationState ValidateEditedNewName(string newName = "") { ProfilEditorItem page = (ProfilEditorItem)getProfilEditor().getActivePage(); if (page == null) { return(OperationState.CONTINUE); } Domain.Profil table = page.EditedObject; if (string.IsNullOrEmpty(newName)) { newName = page.getProfilForm().profileMainPanel.nameTextBox.Text.Trim(); } if (string.IsNullOrEmpty(newName)) { DisplayError("Empty Name", "The Profil name can't be mepty!"); page.getProfilForm().profileMainPanel.nameTextBox.SelectAll(); page.getProfilForm().profileMainPanel.nameTextBox.Focus(); return(OperationState.STOP); } bool found = false; if (GetProfilService().getByName(newName) != null) { found = true; } foreach (ProfilEditorItem unReco in getProfilEditor().getPages()) { if ((found && newName != getProfilEditor().getActivePage().Title) || (unReco != getProfilEditor().getActivePage() && newName == unReco.Title)) { DisplayError("Duplicate Name", "There is another Target named: " + newName); page.getProfilForm().profileMainPanel.nameTextBox.Text = page.Title; page.getProfilForm().profileMainPanel.nameTextBox.SelectAll(); page.getProfilForm().profileMainPanel.nameTextBox.Focus(); return(OperationState.STOP); } } if (!IsRenameOnDoubleClick) { if (table.name.ToUpper().Equals(newName.ToUpper())) { return(OperationState.CONTINUE); } } ((ProfilSideBar)SideBar).ProfilGroup.profilTreeview.updateProfil(newName, table.name, false); table.name = newName; page.Title = newName; page.getProfilForm().profileMainPanel.nameTextBox.Text = newName; OnChange(); return(OperationState.CONTINUE); }
public override OperationState Rename() { if (base.Rename() != OperationState.CONTINUE) { return(OperationState.STOP); } IsRenameOnDoubleClick = true; ProfilEditorItem page = (ProfilEditorItem)getProfilEditor().getActivePage(); return(ValidateEditedNewName(page.EditedObject.name)); }
/// <summary> /// Cette methode permet de créer une nouvelle reco. /// </summary> /// <returns>CONTINUE si la création de la nouvelle reconciliation se termine avec succès. STOP sinon</returns> public override OperationState Create() { Domain.Profil profil = GetNewProfil(); ((ProfilSideBar)SideBar).ProfilGroup.profilTreeview.AddProfil(profil); ProfilEditorItem page = (ProfilEditorItem)getProfilEditor().addOrSelectPage(profil); initializePageHandlers(page); page.Title = profil.name; getProfilEditor().ListChangeHandler.AddNew(profil); return(OperationState.CONTINUE); }
/// <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) { ProfilEditorItem page = (ProfilEditorItem)getProfilEditor().getActivePage(); if (args.Key == Key.Escape) { page.getProfilForm().profileMainPanel.nameTextBox.Text = page.Title; } else if (args.Key == Key.Enter) { ValidateEditedNewName(); } }
public override OperationState Save(EditorItem <Domain.Profil> page) { try { currentPage = (ProfilEditorItem)page; if (base.Save(page) == OperationState.STOP) { return(OperationState.STOP); } } catch (Exception e) { DisplayError("Unable to save Profil", "Unable to save Profil."); return(OperationState.STOP); } return(OperationState.CONTINUE); }