private void UpdateSaveInfo(SaveInfo info, object transformationTree) { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); if (page != null && transformationTree != null && transformationTree is TransformationTree) { Mask(false); page.EditedObject = (TransformationTree)transformationTree; page.displayObject(); page.IsModify = false; return; } if (info == null || info.isEnd == true) { Mask(false); GetTransformationTreeService().SaveTransformationTreeHandler -= UpdateSaveInfo; Service.FileService.SaveCurrentFile(); } else { int rate = info.stepCount != 0 ? (Int32)(info.stepRuned * 100 / info.stepCount) : 0; if (rate > 100) { rate = 100; } ApplicationManager.MainWindow.LoadingProgressBar.Maximum = info.stepCount; ApplicationManager.MainWindow.LoadingProgressBar.Value = info.stepRuned; ApplicationManager.MainWindow.LoadingLabel.Content = "" + rate + " %"; } }
private void OnEditingItemEnded(object obj) { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); if (page.GetTransformationTreeForm().EditedDesignerItem == null || page.GetTransformationTreeForm().EditedDesignerItem.Tag == null) { return; } TransformationTreeItem item = (TransformationTreeItem)page.GetTransformationTreeForm().EditedDesignerItem.Tag; TransformationTreeItem parent = item.parent; item = GetTransformationTreeService().SaveTransformationTreeItem(item); AfterSave(); if (item != null) { item.parent = parent; item.tree = page.EditedObject; if (item.parent != null) { item.parent.ReplaceChild(item); } else { page.EditedObject.ReplaceItem(item); } page.GetTransformationTreeForm().refreshItem(item); page.GetTransformationTreeForm().EditedDesignerItem.Tag = item; page.GetTransformationTreeForm().RedisplayItem(item); } BlockPanel.Loops = new List <TransformationTreeItem>(page.EditedObject.GetAllLoops().ToList()); }
protected void OnEditingItem(DesignerItem item) { if (item.Tag != null) { if (!(item.Tag is TransformationTreeItem)) { System.Web.Script.Serialization.JavaScriptSerializer Serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); Serializer.MaxJsonLength = 99999999; item.Tag = Serializer.Deserialize <TransformationTreeItem>(item.Tag.ToString()); } TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); TransformationTreeItem treeItem = (TransformationTreeItem)item.Tag; //if (treeItem.IsAction && page.EditedObject.hasUnsavedLoop()) if (page.IsModify) { Save(page); DesignerItem block = page.GetTransformationTreeForm().TransformationTreeDiagramView.designerCanvas.GetBlockByName(treeItem.name); if (block == null) { return; } item = block; treeItem = (TransformationTreeItem)item.Tag; } page.GetTransformationTreeForm().EditedDesignerItem = item; this.RemoveCommands(); page.GetTransformationTreeForm().Edit(treeItem); this.initializeCommands(); } }
/// <summary> /// Cette methode permet d'exporter le fichier excel ouvert dans la page active. /// On ouvre le dialogue pour permettre à l'utilisateur d'indiquer le répertoire et le nom /// sous lequel il faut exporter le fichier. /// </summary> /// <returns> /// OperationState.CONTINUE si l'opération a réussi /// OperationState.STOP sinon /// </returns> public virtual OperationState Clear() { OperationState state = OperationState.CONTINUE; TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); if (page == null) { return(state); } if (page.IsModify) { state = Save(page); } if (state == OperationState.STOP) { return(state); } if (page.EditedObject.oid == null || !page.EditedObject.oid.HasValue) { return(state); } TableActionData data = new TableActionData(page.EditedObject.oid.Value, null); GetTransformationTreeService().ClearTreeHandler += updateClearProgress; GetTransformationTreeService().ClearTree(data); Mask(true, "Clearing..."); return(state); }
public virtual OperationState Run() { OperationState state = OperationState.CONTINUE; TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); if (page == null) { return(state); } List <int> stringOid = new List <int>(); if (!page.EditedObject.oid.HasValue) { Save(page); } if (!page.EditedObject.oid.HasValue) { return(state); } stringOid.Add((int)page.EditedObject.oid); PowerpointLoader.stop = false; GetTransformationTreeService().RunHandler += updateRunProgress; GetTransformationTreeService().PowerpointHandler += loadPowerpoint; PowerpointLoader.PRESENTATIONS.Clear(); GetTransformationTreeService().Run(stringOid); Mask(true, "Running...", true); return(state); }
protected void onGroupFieldChange() { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); string name = page.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.textBox.Text; BGroup group = page.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.Group; page.EditedObject.group = group; ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.updateTransformationTree(name, page.Title, true); //page.GetTransformationTreeForm().TransformationTreePropertiePanel.displayTransformationTree(tree); page.EditedObject.isModified = true; }
private void OnTableVisibleInShortcutOptionChecked(object sender, RoutedEventArgs e) { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); if (page == null) { return; } page.EditedObject.isModified = true; page.EditedObject.visibleInShortcut = (sender as CheckBox).IsChecked.Value; OnChange(); }
/// <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) { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); if (args.Key == Key.Escape) { page.GetTransformationTreeForm().TransformationTreePropertiePanel.nameTextBox.Text = page.Title; } else if (args.Key == Key.Enter) { String name = page.GetTransformationTreeForm().TransformationTreePropertiePanel.nameTextBox.Text; Rename(name); } }
protected override void Rename(string name) { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getEditor().getActivePage(); if (validateName(page, name)) { ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.updateTransformationTree(name, page.Title, false); page.GetTransformationTreeForm().TransformationTreePropertiePanel.nameTextBox.Text = name; base.Rename(name); } else { page.GetTransformationTreeForm().TransformationTreePropertiePanel.nameTextBox.Text = page.Title; } }
/// <summary> /// Cette methode permet de créer un nouvel arbre. /// </summary> /// <returns> /// - CONTINUE si la création de l'arbre se termine avec succès. /// - STOP sinon /// </returns> public override OperationState Create() { try { TransformationTree transformationTree = GetNewTransformationTree(); ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.AddTransformationTree(transformationTree); TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().addOrSelectPage(transformationTree); page.GetTransformationTreeForm().TransformationTreeService = this.GetTransformationTreeService(); initializePageHandlers(page); page.Title = transformationTree.name; page.EditedObject = transformationTree; getTransformationTreeEditor().ListChangeHandler.AddNew(transformationTree); } catch (Exception e) { logger.Error("Unable to create new Transformation tree", e); } return(OperationState.CONTINUE); }
protected override void OnPageClosed(object sender, EventArgs args) { TransformationTreeEditorItem page = (TransformationTreeEditorItem)sender; if (page == null) { base.OnPageClosed(sender, args); return; } page.GetTransformationTreeForm().Dispose(); if (!page.EditedObject.oid.HasValue) { ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.RemoveTransformationTree(page.EditedObject); } base.OnPageClosed(sender, args); if (page.EditedObject.oid.HasValue) { GetTransformationTreeService().unlocked(ApplicationManager.Instance.File.oid.Value, page.EditedObject.oid.Value); } }
protected override void initializePageHandlers(EditorItem <TransformationTree> page) { base.initializePageHandlers(page); TransformationTreeEditorItem editorPage = (TransformationTreeEditorItem)page; editorPage.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.GroupService = GetTransformationTreeService().GroupService; editorPage.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.subjectType = SubjectTypeFound(); editorPage.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.Changed += onGroupFieldChange; editorPage.GetTransformationTreeForm().TransformationTreePropertiePanel.nameTextBox.KeyUp += onNameTextChange; editorPage.GetTransformationTreeForm().TransformationTreePropertiePanel.visibleInShortcutCheckBox.Checked += OnTableVisibleInShortcutOptionChecked; editorPage.GetTransformationTreeForm().TransformationTreePropertiePanel.visibleInShortcutCheckBox.Unchecked += OnTableVisibleInShortcutOptionChecked; editorPage.GetTransformationTreeForm().TransformationTreeDiagramView.designerCanvas.Editing += OnEditingItem; editorPage.GetTransformationTreeForm().SaveEventHandler += OnEditingItemEnded; if (editorPage.GetTransformationTreeForm().AdministrationBar != null) { editorPage.GetTransformationTreeForm().AdministrationBar.Changed += OnChangeEventHandler; } }
/// <summary> /// Ouvre l'arbre passé en parametre dans l'éditeur. /// </summary> /// <param name="table">L'arbre à ouvrir</param> /// <returns> /// - CONTINUE si l'ouverture de l'arbre se termine avec succès. /// - STOP sinon /// </returns> public override OperationState Open(TransformationTree tree) { if (tree == null) { MessageDisplayer.DisplayInfo("Transformation Tree", "Unable to open the selected tree"); this.ApplicationManager.HistoryHandler.closePage(this); return(OperationState.STOP); } bool isReadonly = false; if (tree.oid.HasValue) { bool isOk = GetTransformationTreeService().locked(ApplicationManager.File.oid.Value, tree.oid.Value); if (!isOk) { MessageBoxResult response = MessageDisplayer.DisplayYesNoQuestion("Tree Locked", "Tree '" + tree.name + "' is locked by another user!\n" + "You cannot edit the tree until the tree is open by another user.\n" + "Do you want to switch in read only mode ?"); if (MessageBoxResult.Yes != response) { return(OperationState.STOP); } else { isReadonly = true; } } } ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.AddTransformationTreeIfNatExist(tree); TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().addOrSelectPage(tree, isReadonly); page.GetTransformationTreeForm().TransformationTreeService = this.GetTransformationTreeService(); initializePageHandlers(page); getEditor().ListChangeHandler.AddNew(tree); return(OperationState.CONTINUE); }
/// <summary> /// Retourne une nouvelle page. /// </summary> /// <returns>Une nouvelle instance de EditorItem</returns> protected override EditorItem <Misp.Kernel.Domain.TransformationTree> getNewPage() { TransformationTreeEditorItem page = new TransformationTreeEditorItem(this.SubjectType); return(page); }