private Gtk.Widget CreateInfoWidget(BasicNodeControl basicComponentControl) { //case 1: Component Panel ComponentControl componentControl = basicComponentControl as ComponentControl; if (componentControl != null) { ComponentInfoPanel panel = new ComponentInfoPanel(); panel.Component = componentControl; return(panel); } else { //case 2: decision panel DecisionNodeControl decisionControl = basicComponentControl as DecisionNodeControl; if (decisionControl != null) { DecisionInfoPanel panel = new DecisionInfoPanel(m_applicationContext); panel.DecisionControl = decisionControl; return(panel); } } //invalid Gtk.Label errorLabel = new Gtk.Label("Not implemented. Panels not supported for the given component control."); return(errorLabel); }
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; }
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); }
private Gtk.Widget CreateInfoWidget(BasicNodeControl basicComponentControl) { //case 1: decision panel //must be check first, as it inherits from ComponentControl DecisionNodeControl decisionControl = basicComponentControl as DecisionNodeControl; if (decisionControl != null) { DecisionInfoPanel panel = new DecisionInfoPanel(m_applicationContext); panel.DecisionControl = decisionControl; return(panel); } else { //case 2: Component Panel if (basicComponentControl is ComponentControl || basicComponentControl is CompositeComponentControl) { ComponentInfoPanel panel = new ComponentInfoPanel(); panel.Component = basicComponentControl; return(panel); } } //invalid Gtk.Label errorLabel = new Gtk.Label("Not implemented. Panels not supported for the given component control."); return(errorLabel); }
private Gtk.Widget CreateInfoWidget(BasicNodeControl basicComponentControl) { //case 1: decision panel //must be check first, as it inherits from ComponentControl DecisionNodeControl decisionControl = basicComponentControl as DecisionNodeControl; // HERZUM SPRINT 1.1 LOOP // TO DO New LoopInfoPanel // HERZUM SPRINT 2.0: TLAB-65 /* * ChallengeNodeControl challengeControl = basicComponentControl as ChallengeNodeControl; * if(challengeControl != null) * { * AboutExperimentDialog dialog = new AboutExperimentDialog(m_applicationContext.MainWindow.); * return dialog; * } */ // END HERZUM SPRINT 2.0: TLAB-65 LoopNodeControl loopControl = basicComponentControl as LoopNodeControl; if (loopControl != null) { LoopDecisionInfoPanel panel = new LoopDecisionInfoPanel(m_applicationContext); panel.LoopNodeControl = loopControl; return(panel); } // END HERZUM SPRINT 1.1 LOOP if (decisionControl != null) { DecisionInfoPanel panel = new DecisionInfoPanel(m_applicationContext); panel.DecisionControl = decisionControl; return(panel); } else { // SPRINT 2: TLAB-98, TLAB-127 //case 2: Component Panel if (basicComponentControl is ScopeNodeControl || basicComponentControl is CommentNodeControl) { BaseInfoPanel panel = new BaseInfoPanel(); panel.Component = basicComponentControl; return(panel); } // END SPRINT2: TLAB-98, TLAB-127 //case 3: Component Panel if (basicComponentControl is ComponentControl || basicComponentControl is CompositeComponentControl) { // HERZUM SPRINT 2.4: TLAB-162 ComponentInfoPanel panel = new ComponentInfoPanel(m_applicationContext); // END HERZUM SPRINT 2.4: TLAB-162 panel.Component = basicComponentControl; return(panel); } } //invalid Gtk.Label errorLabel = new Gtk.Label("Not implemented. Panels not supported for the given component control."); return(errorLabel); }
// HERZUM SPRINT 2.0: TLAB-148 internal void AddScopeInDecisionComponent(DecisionNodeControl decisionNodeControl) { double x = 0; IEnumerable<ExperimentNodeConnection> edges = null; IEnumerable<ExperimentNode> vertices = null; if (m_subExperiment != null){ edges = m_subExperiment.Edges; vertices = m_subExperiment.Vertices; } else { edges = m_applicationViewModel.Experiment.Edges; vertices = m_applicationViewModel.Experiment.Vertices; } foreach (ExperimentNodeConnection edge in edges){ if (edge.Source.Equals(decisionNodeControl.ExperimentNode)) if (edge.Target is ScopeNode) if (edge.Target.Data.X > x) x = edge.Target.Data.X; } String label = "Scope"; for (int n=1;; n++) { bool found = false; foreach (ExperimentNodeConnection edge in edges) if (edge.Source.Equals(decisionNodeControl.ExperimentNode)) if (edge.Target is ScopeNode) if (edge.Target.Data.Metadata.Label.Equals("Scope " + n)){ found = true; break; } if (!found){ label = "Scope " + n; break; } } Cairo.PointD translation = m_experimentCanvasWidget.ExperimentCanvas.View.ViewToDrawing(decisionNodeControl.DisplayBox.X, decisionNodeControl.DisplayBox.Y); ScopeMetadataDefinition meta_def = new ScopeMetadataDefinition(ScopeMetadataDefinition.ScopeGuid); meta_def.Label = label; ExperimentNode scopeNode = null; if (m_subExperiment != null) scopeNode = m_subExperiment.AddComponentFromDefinition (meta_def, x + 230, translation.Y + 120); else scopeNode = m_applicationViewModel.Experiment.AddComponentFromDefinition (meta_def, x + 230, translation.Y + 120); TryFixScopeDecisionEntryAndExitNodes (decisionNodeControl.ExperimentNode, scopeNode); m_experimentDrawer.DrawComponent (scopeNode, true); ExperimentNodeConnection new_edge = null; if (m_subExperiment != null) new_edge = m_subExperiment.AddConnection (decisionNodeControl.ExperimentNode, scopeNode); else new_edge = m_applicationViewModel.Experiment.AddConnection (decisionNodeControl.ExperimentNode, scopeNode); m_experimentDrawer.DrawEdge (new_edge, false); ExperimentNode exitNode = null; bool response = false; foreach (ExperimentNode n in vertices) if (n is ExitDecisionNode) { if (m_subExperiment != null) response = m_subExperiment.TryGetEdge (decisionNodeControl.ExperimentNode, n, out new_edge); else response = m_applicationViewModel.Experiment.TryGetEdge (decisionNodeControl.ExperimentNode, n, out new_edge); if (response) { exitNode = n; break; } } if (exitNode != null) { TryFixScopeDecisionEntryAndExitNodes (scopeNode, exitNode); if (m_subExperiment != null) new_edge = m_subExperiment.AddConnection (scopeNode, exitNode); else new_edge = m_applicationViewModel.Experiment.AddConnection (scopeNode, exitNode); m_experimentDrawer.DrawEdge (new_edge, false); } }
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 ExitDecisionNode) { // HERZUM SPRINT 0.0 // control = null; // throw new NotImplementedException(); // HERZUM SPRINT 1.1 IF // control = new EndNodeControl(node, m_applicationContext); control = new ExitDecisionControl(node, m_applicationContext); // END HERZUM SPRINT 1.1 IF // END HERZUM } else if (node is LoopScopeNode) { // HERZUM SPRINT 1.1 LOOP // control = null; // throw new NotImplementedException(); control = new LoopNodeControl(node, m_applicationContext); // END HERZUM SPRINT 1.1 LOOP } else if (node is ScopeNode) { // HERZUM SPRINT 0.0 //control = null; //throw new NotImplementedException(); control = new ScopeNodeControl(node, m_applicationContext); // END HERZUM } // HERZUM SPRINT 2.0: TLAB-65 CLASS else if (node is ChallengeNode) { control = new ChallengeNodeControl(node, m_applicationContext); } // END HERZUM SPRINT 2.0: TLAB-65 CLASS else if (node is CompositeComponentNode) { control = new CompositeComponentControl(node, m_applicationContext); } // HERZUM SPRINT 1.0 else if (node is CommentNode) { control = new CommentNodeControl(node, m_applicationContext); } // END HERZUM SPRINT 1.0 else { control = new BasicNodeControl(node, m_applicationContext); } m_mapNodesToControls.Add(node, control); return control; }