private void fillSelectComboBox() { //clear the combo box clearComboBox(selectComboBox1); //ExperimentNodeInfo decisionNodeInfo = DataContext as ExperimentNodeInfo; String wrapper = "Select(\""; ExperimentNode currentNode = DecisionControl.ExperimentNode; this.selectComboBox1.InsertText(0, SELECT_A_VALUE); int i = 1; try { //foreach (ExperimentNodeConnection edge in m_applicationContext.Application.Experiment.OutEdges(currentNode)) { foreach (ExperimentNodeConnection edge in DecisionControl.ExperimentNode.Owner.OutEdges(currentNode)) { this.selectComboBox1.InsertText(i++, wrapper + edge.Target.Data.Metadata.Label + "\")"); edge.Target.Data.Metadata.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { fillSelectComboBox(); }; } } catch (Exception e) { Console.WriteLine(e.ToString()); } setActiveComboBoxValue(selectComboBox1, SELECT_A_VALUE); }
private void ShowInfoForNode(ExperimentNode node, ExperimentNodeInfo info) { m_inactiveInfo.Remove(node); m_activeInfoLookup.Add(node, info); NodeInfo.Add(info); node.IsInfoPaneExpanded = true; }
/// <summary> /// Finds the vertex control (view) of the given node /// </summary> /// <param name="node">The node.</param> /// <param name="graphView">The graph view.</param> /// <returns></returns> private GraphSharp.Controls.VertexControl FindVertexControl(ExperimentNode node, TraceLab.UI.WPF.Views.GraphView graphView) { GraphSharp.Controls.VertexControl vertexControl = null; //check if node belongs to scope, ie. editable composite component graph of the scopenode var ownerGraph = node.Owner as CompositeComponentEditableGraph; if (ownerGraph != null) { //double check if the OwnerNode of the graph is a ScopeNode var scopeNode = ownerGraph.OwnerNode as ScopeNodeBase; if (scopeNode != null) { var scopeVertexControl = FindVertexControl(scopeNode, graphView); var scopeGraphView = FindVisualChild <TraceLab.UI.WPF.Views.GraphView>(scopeVertexControl); if (scopeGraphView != null) { vertexControl = scopeGraphView.ControlForNode(node); } } } else { vertexControl = graphView.ControlForNode(node); } return(vertexControl); }
public void RemoveConnection() { IExperiment experiment = ExperimentManager.New(); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ComponentMetadataDefinition def1 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test.dll"), "IDontExist"); ExperimentNode node1 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def1, -5, 5); ComponentMetadataDefinition def2 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test2.dll"), "IDontExistEither"); ExperimentNode node2 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def2, -5, 5); Assert.AreEqual(0, experiment.EdgeCount); ExperimentNodeConnection newEdge = ((IEditableExperiment)experiment).AddConnection(node1, node2); Assert.IsNotNull(newEdge); Assert.AreEqual(1, experiment.EdgeCount); experiment.ResetModifiedFlag(); Assert.AreEqual(4, experiment.VertexCount); ((IEditableExperiment)experiment).RemoveConnection(newEdge); // Verify that the edge was existed and the number of vertices was unaffected. Assert.AreEqual(0, experiment.EdgeCount); Assert.AreEqual(4, experiment.VertexCount); Assert.IsTrue(experiment.IsModified); }
public void AddNewConnectionTwice() { IExperiment experiment = ExperimentManager.New(); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ComponentMetadataDefinition def1 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test.dll"), "IDontExist"); ExperimentNode node1 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def1, -5, 5); ComponentMetadataDefinition def2 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test2.dll"), "IDontExistEither"); ExperimentNode node2 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def2, -5, 5); Assert.AreEqual(0, experiment.EdgeCount); ExperimentNodeConnection newEdge = ((IEditableExperiment)experiment).AddConnection(node1, node2); Assert.IsNotNull(newEdge); Assert.AreEqual(1, experiment.EdgeCount); //add the same connection once again ExperimentNodeConnection newEdge2 = ((IEditableExperiment)experiment).AddConnection(node1, node2); Assert.IsNotNull(newEdge2); Assert.AreEqual(newEdge, newEdge2); // the amount of edges should still be the same Assert.AreEqual(1, experiment.EdgeCount); }
public void AddCompositeComponent_Bug77() { // load the experiment to be exported string experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_to_test_bug77.gml"); Experiment experiment = ExperimentManager.Load(experimentFilename, AppContext.Components); experiment.Settings = AppContext.Settings; //create ExperimentViewModel for the experiment - the crash happen in the experiment view model, so it has to be initialized var experimentViewModel = new TraceLab.UI.WPF.ViewModels.ExperimentViewModel_Accessor(experiment); CompositeComponentMetadataDefinition compositeComponentDefinition = null; //find the composite component to test bug 77 foreach (MetadataDefinition definition in AppContext.Components.Components) { if (definition.Classname.Equals("Component to test bug 77")) { compositeComponentDefinition = definition as CompositeComponentMetadataDefinition; break; } } //check if definition has been found in library Assert.IsNotNull(compositeComponentDefinition); Assert.AreEqual(3, experiment.VertexCount); ExperimentNode node = ((IEditableExperiment)experiment).AddComponentFromDefinition(compositeComponentDefinition, -5, 5); Assert.IsNotNull(node); Assert.AreEqual(4, experiment.VertexCount); Assert.IsTrue(experiment.IsModified); }
public void AddNewComponentNullDefinition() { IExperiment experiment = ExperimentManager.New(); Assert.AreEqual(2, experiment.VertexCount); ExperimentNode node = ((IEditableExperiment)experiment).AddComponentFromDefinition(null, -5, 5); }
public void GraphStructureValidator_NoPathToEnd2() { IEditableExperiment experiment = ((IEditableExperiment)ExperimentManager.New()); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ExperimentNode node1 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); ExperimentNode node2 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 15, 15); ExperimentNode node3 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 25, 25); experiment.AddConnection(experiment.StartNode, node1); experiment.AddConnection(experiment.StartNode, node3); experiment.AddConnection(node1, node2); experiment.AddConnection(node2, experiment.EndNode); Assert.IsFalse(node1.HasError); Assert.IsFalse(node2.HasError); Assert.IsFalse(node3.HasError); RunnableNodeFactory templateGraphNodesFactory = new RunnableNodeFactory(AppContext.WorkspaceInstance); RunnableExperimentBase template = GraphAdapter.Adapt(experiment, templateGraphNodesFactory, AppContext.Components, AppContext.WorkspaceInstance.TypeDirectories); Assert.IsTrue(template.IsEmpty); Assert.IsTrue(node3.HasError); Assert.AreEqual(node3.ErrorMessage, "Unable to detect path to the END node."); }
/// <summary> /// Called when node added to the experiment, or editable composite graph of a scope /// </summary> /// <param name="vertex">The vertex.</param> void OnNodeAdded(ExperimentNode vertex) { var node = vertex as CompositeComponentNode; if (node != null) { string subLevelId = node.CompositeComponentMetadata.ComponentGraph.GraphIdPath; BaseLevelExperimentViewModel parentLevelViewModel; //component might be added to the editable scope composite graph. if (node.Owner is CompositeComponentEditableGraph) { //thus find parent view string parentLevelId = subLevelId.Remove(subLevelId.LastIndexOf(":")); parentLevelViewModel = FindSubLevel(parentLevelId); } else { //otherwise use top level view parentLevelViewModel = m_topLevel; } //create sub level view model for the given graph with given sub level id CreateSubLevelViewModel(node.CompositeComponentMetadata.ComponentGraph, subLevelId, parentLevelViewModel); } }
public BasicNodeControl CreateNodeControl(ExperimentNode node) { BasicNodeControl control; if (node is ComponentNode) { control = new ComponentControl(node, m_applicationContext); } else if (node is ExperimentStartNode) { control = new StartNodeControl(node, m_applicationContext); } else if (node is ExperimentEndNode) { control = new EndNodeControl(node, m_applicationContext); } else if (node is ExperimentDecisionNode) { control = new DecisionNodeControl(node, m_applicationContext); } else if (node is CompositeComponentNode) { control = new CompositeComponentControl(node, m_applicationContext); } else { control = new BasicNodeControl(node, m_applicationContext); } m_mapNodesToControls.Add(node, control); return(control); }
// END HERZUM SPRINT 1.1 IF public DecisionNodeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext, s_waitForAnyAllHandleXLocation, s_waitForAnyAllHandleYLocation) { PaddingLeft = 30.0; PaddingTop = 7.0; PaddingRight = 40.0; PaddingBottom = 7.0; // HERZUM SPRINT 1.1 IF m_addScopeInDecisionComponent = new PixButtonHandle(this, new QuickActionLocator(35, 0.8, QuickActionPosition.Right), s_newScopeIcon, AddScopeInDecisionComponent); // END HERZUM SPRINT 1.1 IF // HERZUM SPRINT 2 TLAB 131 foreach (ExperimentNodeConnection edge in ExperimentNode.Owner.Edges) { // HERZUM SPRINT 2.3 TLAB 140 // if (edge.Target is ExitDecisionNode){ if (edge.Source.Equals(this.ExperimentNode) && edge.Target is ExitDecisionNode) { // END HERZUM SPRINT 2.3 TLAB 140 IsIfNode = true; break; } } // END HERZUM SPRINT 2 TLAB 131 }
// END HERZUM SPRINT 5.1: TLAB-230 public ComponentResizeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext) { info = this.ExperimentNode.Data as SerializedVertexDataWithSize; double widthMeta = info.Width; double heightMeta = info.Height; PaddingTop = 7.0; PaddingLeft = widthMeta / 2; PaddingRight = widthMeta / 2; PaddingBottom = heightMeta; MoveTo(info.X, info.Y); if (info.WidgetStatus == "" || info.WidgetStatus == null) { stateWidget = "normal"; } else { stateWidget = info.WidgetStatus; } paddingLeftOriginal = 80.0; paddingRightOriginal = 80.0; paddingBottomOriginal = 160.0; xOriginal = rect.X; yOriginal = rect.Y; SetPixButtonHandle(); RedrawButton(); }
public Dictionary <string, string> this[ExperimentNode node] { get { return(m_availableInputMappingsPerNode[node]); } }
public void ExperimentClone() { IExperiment loadedExperiment = ExperimentManager.Load(ExperimentFile, AppContext.Components); ValidateData(loadedExperiment); Experiment clone = (Experiment)((BaseExperiment)loadedExperiment).Clone(); ValidateData(clone); Assert.IsFalse(clone.IsModified); Dictionary <string, ExperimentNode> clonedNodes = new Dictionary <string, ExperimentNode>(); foreach (ExperimentNode clonedNode in clone.Vertices) { clonedNodes[clonedNode.ID] = clonedNode; } // Ensure that none of the vertices from the source experiment are in the clone experiment. // This checks references, since obviously the clone is supposed to have nodes with the same ID. foreach (ExperimentNode node in loadedExperiment.Vertices) { ExperimentNode clonedNode = null; Assert.IsTrue(clonedNodes.TryGetValue(node.ID, out clonedNode)); Assert.IsFalse(object.ReferenceEquals(node, clonedNode)); Assert.IsFalse(object.ReferenceEquals(node.Data, clonedNode.Data)); Assert.IsFalse(object.ReferenceEquals(node.Data.Metadata, clonedNode.Data.Metadata)); } }
public void TestTemplateGraphDisposal_InValidNodes() { IEditableExperiment experiment = ((IEditableExperiment)ExperimentManager.New()); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; //construct some simple m_experiment ExperimentNode node1 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); ExperimentNode node2 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); ExperimentNode node3 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); node1.Data.Metadata.Label = "Broken Component"; experiment.AddConnection(experiment.StartNode, node1); experiment.AddConnection(node1, node2); experiment.AddConnection(node2, node3); experiment.AddConnection(node3, experiment.EndNode); //initiate mockNodesFactory MockNodesFactory mockNodesFactory = new MockNodesFactory(); RunnableExperimentBase template = GraphAdapter.Adapt(experiment, mockNodesFactory, AppContext.Components, AppContext.WorkspaceInstance.TypeDirectories); //adaptation should have failed and graph should be empty because broken node construction failed Assert.IsTrue(template.IsEmpty); //but also all of the previously created nodes before reaching the broken node during adaptation should have been disposed. foreach (MockNode node in mockNodesFactory.CreatedNodes) { Assert.IsTrue(node.disposed); } }
internal static void BFSTraverseExperiment(IExperiment experiment, ExperimentNode startFromNode, TraverseTask Task) { //traverse graph down from the node Queue <ExperimentNode> traversingQueue = new Queue <ExperimentNode>(); HashSet <ExperimentNode> foundVertices = new HashSet <ExperimentNode>(); traversingQueue.Enqueue(startFromNode); while (traversingQueue.Count > 0) { ExperimentNode currentNode = traversingQueue.Dequeue(); //do some stuff Task(currentNode); foreach (ExperimentNodeConnection edge in experiment.OutEdges(currentNode)) { if (foundVertices.Contains(edge.Target) == false) { traversingQueue.Enqueue(edge.Target); foundVertices.Add(edge.Target); } } } }
public void ValidateInputMapping_CorrectFlow_OutputFound2() { IEditableExperiment experiment = ((IEditableExperiment)ExperimentManager.New()); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ExperimentNode readerNode = experiment.AddComponentFromDefinition(m_componentReaderMetaDefinition, 5, 5); ExperimentNode writerNode1 = experiment.AddComponentFromDefinition(m_componentWriterMetaDefinition, 15, 15); ExperimentNode writerNode2 = experiment.AddComponentFromDefinition(m_componentWriterMetaDefinition, 25, 25); experiment.AddConnection(experiment.StartNode, writerNode1); experiment.AddConnection(writerNode1, writerNode2); experiment.AddConnection(writerNode2, readerNode); experiment.AddConnection(readerNode, experiment.EndNode); (writerNode1.Data.Metadata as ComponentMetadata).IOSpec.Output["testoutput"].MappedTo = "test1"; (writerNode2.Data.Metadata as ComponentMetadata).IOSpec.Output["testoutput"].MappedTo = "test2"; (readerNode.Data.Metadata as ComponentMetadata).IOSpec.Input["testinput"].MappedTo = "test1"; RunnableNodeFactory templateGraphNodesFactory = new RunnableNodeFactory(AppContext.WorkspaceInstance); RunnableExperimentBase template = GraphAdapter.Adapt(experiment, templateGraphNodesFactory, AppContext.Components, AppContext.WorkspaceInstance.TypeDirectories); Assert.IsFalse(template.IsEmpty); Assert.IsFalse(readerNode.HasError); Assert.IsFalse(writerNode1.HasError); Assert.IsFalse(writerNode2.HasError); Assert.AreEqual(5, template.Nodes.Count); }
public CommentNodeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext) { // HERZUM SPRINT 2.4: TLAB-156 /* * info = this.ExperimentNode.Data as SerializedVertexDataWithSize; * double widthMeta = info.Width; * double heightMeta = info.Height; * * PaddingTop = 7.0; * PaddingLeft= widthMeta/2; * PaddingRight= widthMeta/2; * PaddingBottom= heightMeta; * MoveTo (info.X, info.Y); */ // END HERZUM SPRINT 2.4: TLAB-156 // HERZUM SPRINT 1.0 cw.Comment = ((CommentMetadata)node.Data.Metadata).Comment; cw.ExposeEvent += delegate { ((CommentMetadata)node.Data.Metadata).Comment = cw.Comment; }; // END HERZUM SPRINT 1.0 //HERZUM SPRINT 2.0 TLAB-136 ecp = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this); //END HERZUM SPRINT 2.0 TLAB-136 }
/// <summary> /// Compiles the decision. /// </summary> /// <param name="node">The node.</param> /// <param name="experiment">The experiment.</param> /// <param name="workspaceTypesDirectories">The workspace types directories.</param> /// <param name="loggerNameRoot">The logger name root.</param> private static void CompileDecisionInternal(ExperimentNode node, IExperiment experiment, List <string> workspaceTypesDirectories, LoggerNameRoot loggerNameRoot, Dictionary <string, string> successorNodeLabelIdLookup) { InputMappings availableInputMappingsPerNode = new InputMappings(experiment); Dictionary <string, string> predeccessorsOutputsNameTypeLookup = PreparePredeccessorsOutputsNameTypeLookup(node, availableInputMappingsPerNode); IDecision decisionMetadata = (IDecision)node.Data.Metadata; try { if (decisionMetadata != null) { node.ClearError(); BuildSourceAndCompileDecisionModule(decisionMetadata, successorNodeLabelIdLookup, predeccessorsOutputsNameTypeLookup, workspaceTypesDirectories, loggerNameRoot); decisionMetadata.CompilationStatus = TraceLab.Core.Components.CompilationStatus.Successful; } } catch (ArgumentException ex) { decisionMetadata.CompilationStatus = TraceLab.Core.Components.CompilationStatus.Failed; node.SetError(ex.Message); } }
private void fillLoadComboBox() { clearComboBox(); ExperimentNode currentNode = LoopNodeControl.ExperimentNode; Dictionary <string, string> predeccessorsOutputsNameTypeLookup; // TLAB-174: we use the Owner instead of the application experiment to get only variables the scope can access //var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings (m_applicationContext.Application.Experiment); var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(m_loopControl.ExperimentNode.Owner); if (availableInputMappingsPerNode.TryGetValue(currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary <string, string> (); //return empty - there is not path from start node to decision } String wrapper = "Load(\""; this.loadComboBox.AppendText(LOAD_A_VALUE); foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { this.loadComboBox.AppendText(wrapper + workspaceUnitName + "\")"); } setActiveComboBoxValue(loadComboBox, LOAD_A_VALUE); }
public EndNodeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext, s_waitForAnyAllHandleXLocation, s_waitForAnyAllHandleYLocation) { PaddingLeft = 6.0; PaddingTop = 5.0; PaddingRight = 20.0; PaddingBottom = 5.0; }
public StartNodeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext) { PaddingLeft = 5.0; PaddingTop = 5.0; PaddingRight = 5.0; PaddingBottom = 5.0; m_newConnectionHandle = new NewConnectionHandle(this, applicationContext, new QuickActionLocator(15, 0.5, QuickActionPosition.Right)); }
protected ComponentControl(ExperimentNode node, ApplicationContext applicationContext, double waitForAnyAllHandleXLocation, double waitForAnyAllHandleYLocation) : base(node, applicationContext, waitForAnyAllHandleXLocation, waitForAnyAllHandleYLocation) { InitControlButtons(applicationContext); AttachListenerToIOSpecHighlights(node); }
public DecisionNodeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext, s_waitForAnyAllHandleXLocation, s_waitForAnyAllHandleYLocation) { PaddingLeft = 30.0; PaddingTop = 7.0; PaddingRight = 40.0; PaddingBottom = 7.0; }
/// <summary> /// The converter method returns the ConfigWrapper object for the calling node info. /// If the node belongs to sub level experiment it will replace the config wrapper with references to /// the ConfigPropertyObjects for the given node in the CompositeComponentNode in the top experiment view. /// If the node is already in the top experiment view, it simply returns original config wrapper. /// </summary> /// <param name="value">The value produced by the binding source.</param> /// <param name="targetType">type ConfigWrapper</param> /// <param name="parameter">not used</param> /// <param name="culture">not used</param> /// <returns> /// ConfigWrapper for the calling node info /// </returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ExperimentNode node = value as ExperimentNode; if (node == null) { throw new InvalidOperationException("Converter cannot accept value that is not of the ExperimentNode type"); } var metadata = (IConfigurableAndIOSpecifiable)node.Data.Metadata; //the default return value is config wrapper itself ConfigWrapper defaultConfigWrapper = metadata.ConfigWrapper; // the config wrapper that is going to be returned ConfigWrapper retConfigWrapper = defaultConfigWrapper; CompositeComponentGraph ownerGraph = node.Owner as CompositeComponentEditableGraph; bool isNodeInScope = (ownerGraph != null); //if node is not in scope (the check is needed, as scope extends composite component, but unlike composite component, it does not need to override config values) if (isNodeInScope == false) { //check if node is in composite component instead ownerGraph = node.Owner as CompositeComponentGraph; //check if node is in the subgraph, and also check if //ownerGraph.OwnerNode as it the top graph might be a composite component - if it is during the process of creating //the composite component bool isNodeInSubgraph = (ownerGraph != null && ownerGraph.OwnerNode != null); if (isNodeInSubgraph) { CompositeComponentNode topCompositeComponentNode = ownerGraph.OwnerNode; string fullNodeId = String.Empty; GetGraphIdPath(topCompositeComponentNode, ref fullNodeId); if (String.IsNullOrEmpty(fullNodeId)) { fullNodeId = node.ID; } else { //otherwise add to already existing path fullNodeId += ":" + node.ID; } CompositeComponentMetadata compositeComponentMetadata = (CompositeComponentMetadata)topCompositeComponentNode.Data.Metadata; ConfigWrapper topConfig = compositeComponentMetadata.ConfigWrapper; //replace the config wrapper retConfigWrapper = topConfig.CreateViewForId(fullNodeId, true); } } return(retConfigWrapper); }
public void DrawComponent(ExperimentNode node, bool editable) { BasicNodeControl componentControl = m_nodeControlFactory.CreateNodeControl(node); m_experimentCanvasWidget.ExperimentCanvas.View.Drawing.Add(componentControl); componentControl.MoveTo(node.Data.X, node.Data.Y); m_experimentCanvasWidget.ExperimentCanvas.View.ClearSelection(); componentControl.IsEditable = editable; }
private void DrawComponent(ExperimentNode node) { var componentControl = m_applicationContext.NodeControlFactory.CreateNodeControl(node); m_experimentCanvasWidget.ExperimentCanvas.View.Drawing.Add(componentControl); componentControl.MoveTo(node.Data.X, node.Data.Y); m_experimentCanvasWidget.ExperimentCanvas.View.ClearSelection(); m_experimentCanvasWidget.ExperimentCanvas.View.AddToSelection(componentControl); }
// END HERZUM BUG FIX: alignment input-output TLAB-255 /// <summary> /// Creates the input mapping column with combo box. /// TODO improve the input mapping combo box: /// 1. it doesn't set values until combo box loses focus within table view confirm change - Edited event is raised only then /// 2. there is no indication that the field can be modified - render combo box always, OR show some icon that it can be modified /// </summary> /// <returns> /// The input mapping column with combo box. /// </returns> /// <param name='inputStore'> /// Input store. /// </param> private TreeViewColumn CreateInputMappingColumnWithComboBox(NodeStore inputStore, string columntTitle) { Gtk.CellRendererCombo comboRenderer = new Gtk.CellRendererCombo(); comboRenderer.HasEntry = false; comboRenderer.Mode = CellRendererMode.Editable; comboRenderer.TextColumn = 0; comboRenderer.Editable = true; ListStore comboBoxStore = new ListStore(typeof(string)); comboRenderer.Model = comboBoxStore; //when user activates combo box, refresh combobox store with available input mapping per node comboRenderer.EditingStarted += delegate(object o, EditingStartedArgs args) { comboBoxStore.Clear(); IOItemNode currentItem = (IOItemNode)inputStore.GetNode(new TreePath(args.Path)); ExperimentNode currentNode = m_component.ExperimentNode; string currentType = currentItem.Type; // HERZUM SPRINT 2.4: TLAB-162 //InputMappings availableInputMappingsPerNode = new InputMappings (currentNode.Owner); InputMappings availableInputMappingsPerNode = new InputMappings(m_applicationContext.Application.Experiment); // END HERZUM SPRINT 2.4: TLAB-162 if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode(currentNode)) { foreach (string incomingOutput in availableInputMappingsPerNode[currentNode].Keys) { if (string.Equals(currentType, availableInputMappingsPerNode [currentNode] [incomingOutput])) { comboBoxStore.AppendValues(Mono.Unix.Catalog.GetString(incomingOutput)); } } } }; //when edition has been completed set current item node with proper mapping comboRenderer.Edited += delegate(object o, EditedArgs args) { IOItemNode n = (IOItemNode)inputStore.GetNode(new TreePath(args.Path)); n.MappedTo = args.NewText; RefreshIOHighlightInExperiment(n.MappedTo); }; //finally create the column with above combo renderer var mappedToColumn = new TreeViewColumn(); mappedToColumn.Title = columntTitle; mappedToColumn.PackStart(comboRenderer, true); //this method sets the text view to current mapping, when combo box is not active mappedToColumn.SetCellDataFunc(comboRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) { IOItemNode currentItem = (IOItemNode)node; comboRenderer.Text = currentItem.MappedTo; }); return(mappedToColumn); }
public DecisionNodeControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext, s_waitForAnyAllHandleXLocation, s_waitForAnyAllHandleYLocation) { PaddingLeft = 30.0; PaddingTop = 7.0; PaddingRight = 40.0; PaddingBottom = 7.0; m_controlButtons = new NodeControlButtons(this, applicationContext); m_controlButtons.InfoButton.Toggled += OnInfoToggled; }
/// <summary> /// Determines whether the specified node is a valid link source /// </summary> /// <param name="node">The node.</param> /// <returns> /// <c>true</c> if the specified node is a valid link source; otherwise, <c>false</c>. /// </returns> private bool IsValidLinkSource(ExperimentNode node) { bool isValid = false; if (node != null && (node is ExperimentStartNode || node is ComponentNode || node is ExperimentDecisionNode || node is CompositeComponentNode || node is ExitDecisionNode)) { isValid = true; } return(isValid); }
/// <summary> /// Copies from. /// </summary> /// <param name="other">The other.</param> protected override void CopyFrom(ExperimentNode other) { base.CopyFrom(other); }