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(); }
protected override void Rename(string name) { TargetEditorItem page = (TargetEditorItem)getTargetEditor().getActivePage(); page.getTargetForm().TargetPropertiesPanel.nameTextBox.Text = name; page.EditedObject.name = name; base.Rename(name); }
/// <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; } }
/// <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(); } }
/// <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); } }
/// <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); }