private void CollectNodesInExperiment(IExperiment experiment, ref List <ExperimentNode> nodes) { foreach (ExperimentNode currentNode in experiment.Vertices) { ScopeNodeBase scopeNode = currentNode as ScopeNodeBase; if (scopeNode != null) { CollectNodesInExperiment(scopeNode.CompositeComponentMetadata.ComponentGraph, ref nodes); } nodes.Add(currentNode); } }
/* * private ScopeNodeBase GetScopeUp(ExperimentNode experimentNode, BaseExperiment experiment, double x, double y){ * BasicNodeControl componentControl; * ScopeNodeBase scopeUp = null; * ExperimentCanvasPad pad = null; * if (experiment == null) * return null; * foreach (ExperimentNode node in experiment.Vertices) * if (node is ScopeNodeBase && !node.Equals(experimentNode)) * if(m_applicationContext.NodeControlFactory.TryGetNodeControl(node, out componentControl)){ * ScopeBaseMetadata scopeBaseMetadata = node.Data.Metadata as ScopeBaseMetadata; * int xMouse = 0; * int yMouse = 0; * BasicNodeControl internalComponentControl = null; * foreach (ExperimentNode internalNode in scopeBaseMetadata.ComponentGraph.Vertices){ * m_applicationContext.NodeControlFactory.TryGetNodeControl(internalNode, out internalComponentControl) ; * break; * } * if (internalComponentControl == null) * return null; * pad = ExperimentCanvasPadFactory.GetExperimentCanvasPad (m_applicationContext, componentControl); * if (pad == null) * return null; * pad.ExperimentCanvasWidget.GetPointer(out xMouse, out yMouse); * scopeUp = GetScopeUp(experimentNode, scopeBaseMetadata.ComponentGraph as BaseExperiment, xMouse, yMouse); * if (scopeUp != null) * return scopeUp; * ScopeNodeControl scopeNodeControl = componentControl as ScopeNodeControl; * if (scopeNodeControl.ContainsPoint (x, y)) * return node as ScopeNodeBase; * } * return null; * } */ // END HERZUM SPRINT 2.3 TLAB-60 public override ITool CreateFigureTool(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool defaultTool, MouseEvent ev) { DragTool dragTool = defaultTool as DragTool; if (dragTool != null) { //when drag is completed update model data dragTool.DragCompleted += (object sender, EventArgs e) => { this.ExperimentNode.Data.X = this.DisplayBox.X; this.ExperimentNode.Data.Y = this.DisplayBox.Y; // HERZUM SPRINT 2.3 TLAB-60 int xMouse = 0; int yMouse = 0; ScopeNodeBase scopeNode = GetScopeUp(ExperimentNode, ExperimentNode.Owner as BaseExperiment, ExperimentNode.Data.X, ExperimentNode.Data.Y); if (scopeNode != null) { ScopeBaseMetadata scopeBaseMetadata = scopeNode.Data.Metadata as ScopeBaseMetadata; BaseExperiment experimentTarget = scopeBaseMetadata.ComponentGraph; BasicNodeControl componentControl = null; ExperimentCanvasPad pad = null; foreach (ExperimentNode node in scopeBaseMetadata.ComponentGraph.Vertices) { m_applicationContext.NodeControlFactory.TryGetNodeControl(node, out componentControl); break; } if (componentControl != null) { pad = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, componentControl); } if (pad != null) { pad.ExperimentCanvasWidget.GetPointer(out xMouse, out yMouse); // HERZUM SPRINT 2.4 TLAB-56 TLAB-57 TLAB-58 TLAB-59 CLASS //TraceLab.Core.Experiments.Clipboard.Cut(ExperimentNode.Owner as BaseExperiment); //TraceLab.Core.Experiments.Clipboard.Paste(experimentTarget,xMouse,yMouse); DragClipboard.Cut(m_applicationContext, ExperimentNode.Owner as BaseExperiment); DragClipboard.Paste(m_applicationContext, experimentTarget, xMouse, yMouse); // END HERZUM SPRINT 2.4 TLAB-56 TLAB-57 TLAB-58 TLAB-59 CLASS pad.DisplayAddedSubgraph(experimentTarget); } } // END HERZUM SPRINT 2.3 TLAB-60 }; } return(base.CreateFigureTool(mainTool, editor, defaultTool, ev)); }
private static void RemoveReferenceFromScopes(IExperiment experiment, Core.PackageSystem.PackageReference packageReference) { foreach (ExperimentNode node in experiment.Vertices) { ScopeNodeBase scopeNode = node as ScopeNodeBase; if (scopeNode != null) { var subgraph = scopeNode.CompositeComponentMetadata.ComponentGraph; if (subgraph.References.Contains(packageReference)) { subgraph.References.Remove(packageReference); } } } }
private static void AddReferenceToScopes(IExperiment experiment, PackageReference packageReference) { foreach (ExperimentNode node in experiment.Vertices) { ScopeNodeBase scopeNode = node as ScopeNodeBase; if (scopeNode != null) { var subgraph = scopeNode.CompositeComponentMetadata.ComponentGraph; if (!subgraph.References.Contains(packageReference)) { subgraph.References.Add(packageReference); } } } }
public override NSObject GetObjectValue(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item) { if (item == null) { return(new NSString(" ")); } else { ScopeNodeBase passedNode = item as ScopeNodeBase; if (passedNode != null) { return((NSString)passedNode.DisplayName); } else { return(new NSString()); } } }
public void DeleteZone(object sender, EventArgs args) { UIErrorHelper.CheckedExec(delegate() { if (UIErrorHelper.ConfirmDeleteOperation(VMIdentityConstants.CONFIRM_DELETE)) { this.ServerNode.ServerDTO.DNSClient.DeleteZone(this.DisplayName); this.Children.Clear(); ScopeNodeBase node = this.Parent; if (node != null) { node.Children.Remove(this); UIErrorHelper.ShowAlert("", VMDNSConstants.SUCCESS_DELETE_ZONE); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", node); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", node); } } }); }
private void SetComboBoxAction() { fillSelectComboBox(); fillLoadComboBox(); DecisionControl.ExperimentNode.Owner.EdgeAdded += (ExperimentNodeConnection e) => { fillSelectComboBox(); fillLoadComboBox(); }; DecisionControl.ExperimentNode.Owner.EdgeRemoved += (ExperimentNodeConnection e) => { fillSelectComboBox(); fillLoadComboBox(); }; m_applicationContext.Application.Experiment.VertexAdded += (ExperimentNode vertex) => { fillSelectComboBox(); fillLoadComboBox(); }; m_applicationContext.Application.Experiment.VertexRemoved += (ExperimentNode vertex) => { fillSelectComboBox(); fillLoadComboBox(); }; foreach (ExperimentNode node in m_applicationContext.Application.Experiment.Vertices) { ScopeNodeBase scopeNode = node as ScopeNodeBase; if (scopeNode != null) { ScopeBaseMetadata scopeMetadata = scopeNode.Data.Metadata as ScopeBaseMetadata; scopeMetadata.ComponentGraph.VertexAdded += (ExperimentNode vertex) => { fillLoadComboBox(); fillSelectComboBox(); }; scopeMetadata.ComponentGraph.VertexRemoved += (ExperimentNode vertex) => { fillLoadComboBox(); fillSelectComboBox(); }; } } }
public override bool ItemExpandable(NSOutlineView outlineView, NSObject item) { if (item != null) { ScopeNodeBase passedNode = item as ScopeNodeBase; // cast to appropriate type of node if (passedNode != null) { return(passedNode.NumberOfChildren() != 0); } else { return(false); } } else { // if null, it's asking about the root element return(true); } }
public override nint GetChildrenCount(NSOutlineView outlineView, NSObject item) { // if null, it's asking about the root element if (item == null) { return(1); } else { ScopeNodeBase passedNode = item as ScopeNodeBase; if (passedNode != null) { return(passedNode.NumberOfChildren()); } else { return(0); } } }
//HERZUM END SPRINT 2: TLAB-156 //HERZUM SPRINT 2.0 TLAB-135 protected void OverlayScope (ApplicationContext applicationContext) { ScopeNodeControl sncBrother; ScopeNodeBase scopeNodeBrother; Gdk.Rectangle areaBrother = new Gdk.Rectangle(); Gdk.Rectangle areaTarget = new Gdk.Rectangle(); BasicNodeControl componentControl; ScopeNodeBase scopeNodeTarget = ExperimentNode as ScopeNodeBase; GetSizeAreaWidget (out areaTarget.X, out areaTarget.Y, out areaTarget.Width, out areaTarget.Height); foreach (ExperimentNode node in ExperimentNode.Owner.Vertices) { if (!node.Equals(ExperimentNode)) { scopeNodeBrother= node as ScopeNodeBase; if (scopeNodeBrother != null) { if (m_applicationContext.NodeControlFactory.TryGetNodeControl (node, out componentControl)) { sncBrother = componentControl as ScopeNodeControl; sncBrother.GetSizeAreaWidget(out areaBrother.X, out areaBrother.Y, out areaBrother.Width, out areaBrother.Height); if (areaTarget.IntersectsWith(areaBrother) && sncBrother.stateWidget!="iconized") { sncBrother.IconizeScope(); sncBrother.IconisationForced = true; } else if (!areaTarget.IntersectsWith(areaBrother) && sncBrother.IconisationForced) { sncBrother.NormalizeScope(); sncBrother.IconisationForced = false; } } } } } }
public OutlineViewDataSource(ScopeNodeBase node) : base() { RootNode = node; }