示例#1
0
        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>
        /// Initializes a new instance of the <see cref="TraceLab.UI.GTK.MainWindow"/> class.
        /// </summary>
        public MainWindow(ApplicationContext dataContext)
        {
            m_applicationContext = dataContext;

            // Init dock frame
            m_dockFrame = new DockFrame();
            m_dockFrame.CompactGuiLevel = 5;

            // Init component info panel
            m_infoPanelFactory = new InfoPanelFactory(m_applicationContext, m_dockFrame);

            //build the window
            CreateWindow();
            
            //set window application view model to all UI panels in current chrome
            //note, that application vm should not be set before m_windowShell.ShowAll is called
            SetApplicationViewModel(m_applicationContext.Application);
            
            // initiate action handlers for all actions in application
            new ActionHandlers(dataContext);
            
            //attach handler to closing event of a main window
            this.WindowShell.DeleteEvent += MainWindow_DeleteEvent;
            
            m_mainWindowCounter++;
        }
 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;
 }
示例#4
0
 protected ComponentControl(ExperimentNode node, ApplicationContext applicationContext, 
                            double waitForAnyAllHandleXLocation, 
                            double waitForAnyAllHandleYLocation) 
     : base(node, applicationContext, waitForAnyAllHandleXLocation, waitForAnyAllHandleYLocation)
 {
     InitControlButtons(applicationContext);
     AttachListenerToIOSpecHighlights(node);
 }
示例#5
0
        public ComponentInfoPanel (ApplicationContext applicationContext) : this()
        {
            m_applicationContext = applicationContext;

            // HERZUM SPRINT 5.0: TLAB-238 TLAB-243
            propertyGrid.DataRoot = System.IO.Path.GetDirectoryName(m_applicationContext.Application.Experiment.ExperimentInfo.FilePath);
            // END // HERZUM SPRINT 5.0: TLAB-238 TLAB-243
        }
 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;
 }
 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));
 }
示例#8
0
        public static void Paste(ApplicationContext applicationContext, BaseExperiment targetExperiment, double x, double y)
        {

            if (clipboardComponentGraph == null)
                return;

            targetExperiment.CopyAndAdd (clipboardComponentGraph, x, y);
        }
示例#9
0
        public static void Run(TraceLab.Core.ViewModels.ApplicationViewModel applicationViewModel) 
        {
            GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(ExceptionManager_UnhandledException);

            Application.Init();
            ApplicationContext app = new ApplicationContext(applicationViewModel);
            app.InitializeWindow();
            Application.Run();
        }
 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;
 }
        public NodeControlButtons(BasicNodeControl ownerControl, ApplicationContext applicationContext)
        {
            //first column with icons
            m_newConnectionHandle = new NewConnectionHandle (ownerControl, applicationContext, new QuickActionLocator (15, 0, QuickActionPosition.Right));
            m_infoHandle = new PixToggleButtonHandle (ownerControl, new QuickActionLocator (15, 0.8, QuickActionPosition.Right),
                                              s_infoIcon, s_infoOnIcon);

            //second column with icons
            m_removeHandle = new RemoveNodeHandle (ownerControl, new QuickActionLocator (35, 0, QuickActionPosition.Right));
        }
        public WelcomePageWidget(ApplicationContext applicationContext) : this()
        {
            m_applicationContext = applicationContext;
            m_applicationContext.Actions.File.New.ConnectProxy(this.buttonCreateNewExperiment);
            m_applicationContext.Actions.File.Open.ConnectProxy(this.buttonOpenExperiment);

            SetRecentExperimentList();
            SetOnlineResourcesList();
            SetVideosTutorialsList();
        }
        // END HERZUM SPRINT 3.0: TLAB-176

        public DefineCompositeComponentWizard(ApplicationContext context) : this() 
        {

            //setup extracts selected nodes from current experiment and constructs composite component
            m_setup = new DefiningCompositeComponentSetup(context.Application.Experiment);

            // HERZUM SPRINT 3.0: TLAB-176
            if (IncludeChallenge(m_setup.CompositeComponentGraph))
            {
                ShowMessageDialog("Challenge Component Removed",
                                  "Define Composite", Gtk.ButtonsType.Ok, Gtk.MessageType.Warning);
            }
            // END HERZUM SPRINT 3.0: TLAB-176

            // HERZUM SPRINT 2.4 TLAB-157
            //create new experiment drawer with own factories
            /*
            ExperimentDrawer drawer = new ExperimentDrawer(this.experimentcanvaswidget1,
                                                           new NodeControlFactory(context),
                                                           new NodeConnectionControlFactory(context));
            //draw composite component that is being defined into canvas
            drawer.DrawExperiment(m_setup.CompositeComponentGraph, false);
            */

            ExperimentCanvasPadFactory.CreateCompositeExperimentCanvasPad(context, this.experimentcanvaswidget1, m_setup.CompositeComponentGraph) ;
            // END HERZUM SPRINT 2.4 TLAB-157

            //zoom to fit moves view to display entire graph in the visible canvas
            //rather part that is not visible
            this.experimentcanvaswidget1.ZoomToFit();

            //if experiment is smaller than than the view scale it to original 
            if(this.experimentcanvaswidget1.ZoomScale > 1)
            {
                this.experimentcanvaswidget1.ZoomToOriginal();
            }
            
            m_ioSpecSetupPage = new IOSpecSetupPage(m_setup);
            m_configPage = new ConfigSetupPage(m_setup);
            m_componentInfoPage = new ComponentInfoPage(m_setup, context.Application.Settings.ComponentPaths);
            m_confirmationPage = new ConfirmationPage();
            
            this.mainVBox.Add(m_ioSpecSetupPage);
            this.mainVBox.Add(m_configPage);
            this.mainVBox.Add(m_componentInfoPage);
            this.mainVBox.Add(m_confirmationPage);

            m_componentInfoPage.ComponentNameChanged += delegate {
                RefreshDefineButton();
            };

            m_currentState = WizardState.IOSpec;
            
            DisplayCurrentPage();
        }
        public ActionHandlers(ApplicationContext applicationWrapper)
        {
            //experiment file actions
            actionHandlers.Add(new OpenExperimentAction(applicationWrapper));
            actionHandlers.Add(new NewExperimentAction(applicationWrapper));
            actionHandlers.Add(new SaveExperimentAction(applicationWrapper));
            actionHandlers.Add(new SaveExperimentAsAction(applicationWrapper));
            actionHandlers.Add(new SettingsAction(applicationWrapper));

            
            // Initialize each action handler
            foreach (var action in actionHandlers)
                action.Initialize();
        }
 /// <summary>
 /// Opens the experiment using given application window
 /// </summary>
 /// <param name="filename">Filename.</param>
 /// <param name="applicationContext">Application context.</param>
 internal static void OpenExperiment(string filename, ApplicationContext applicationContext)
 {
     try
     {
         Experiment experiment = TraceLab.Core.Experiments.ExperimentManager.Load(filename, TraceLab.Core.Components.ComponentsLibrary.Instance);
         ApplicationViewModel newApplicationViewModel = ApplicationViewModel.CreateNewApplicationViewModel(applicationContext.Application, experiment);
         RecentExperimentsHelper.UpdateRecentExperimentList(TraceLab.Core.Settings.Settings.RecentExperimentsPath, experiment.ExperimentInfo.FilePath);
         applicationContext.OpenInWindow(newApplicationViewModel);
     }
     catch (TraceLab.Core.Exceptions.ExperimentLoadException ex)
     {
         string msg = String.Format("Unable to open the file {0}. Error: {1}", filename, ex.Message);
         NLog.LogManager.GetCurrentClassLogger().Error(msg);
     }
 }
示例#16
0
        public static void Copy(ApplicationContext applicationContext, BaseExperiment originalExperiment)
        {
            clipboardComponentGraph = CompositeComponentGraph.ConstructGraphFromSelectedNodes (originalExperiment);

            foreach (ExperimentNode node in clipboardComponentGraph.Vertices)
                node.IsSelected = false;

            BasicNodeControl componentControl;
            foreach (ExperimentNode originalNode in originalExperiment.Vertices)
                foreach (ExperimentNode node in clipboardComponentGraph.Vertices)
                    if (originalNode.ID.Equals(node.ID))
                        if(applicationContext.NodeControlFactory.TryGetNodeControl(originalNode, out componentControl)) {
                        node.Data.X = componentControl.DisplayBox.X;
                        node.Data.Y = componentControl.DisplayBox.Y;
                    }
        }
示例#17
0
        public NodeControlButtons(BasicNodeControl ownerControl, ApplicationContext applicationContext)
        {
            //first column with icons
            m_newConnectionHandle = new NewConnectionHandle (ownerControl, applicationContext, new QuickActionLocator (15, 0, QuickActionPosition.Right));
 
            // HERZUM SPRINT 5.0: TLAB-230
            // HERZUM SPRINT 5.1: TLAB-230
            if (ownerControl is ScopeNodeControl || ownerControl is CommentNodeControl)
                m_infoHandle = new PixToggleButtonHandle (ownerControl, new QuickActionLocator (15, 0.12, QuickActionPosition.Right),
                                                          s_infoIcon, s_infoOnIcon);
            else
                m_infoHandle = new PixToggleButtonHandle (ownerControl, new QuickActionLocator (15, 0.8, QuickActionPosition.Right),
                                                          s_infoIcon, s_infoOnIcon);
            // END HERZUM SPRINT 5.1: TLAB-230
            // END HERZUM SPRINT 5.0: TLAB-230


            //second column with icons
            m_removeHandle = new RemoveNodeHandle (ownerControl, new QuickActionLocator (35, 0, QuickActionPosition.Right));
        }
        protected BasicNodeControl(ExperimentNode node, ApplicationContext applicationContext, 
                                double waitForAnyAllHandleXLocation, 
                                double waitForAnyAllHandleYLocation) : base(node.Data.Metadata.Label)
        {
            m_node = node;
            m_applicationContext = applicationContext;

            //if error changes invalidate figure so that it is redraw
            m_node.ErrorChanged += (sender, e) => 
            { 
                Invalidate(); 
            };

            InitWaitForAnyHandle(waitForAnyAllHandleXLocation, waitForAnyAllHandleYLocation);

            PaddingLeft = 15.0;
            PaddingTop = 7.0;
            PaddingRight = 24.0;
            PaddingBottom = 7.0;
        }
        public DefineCompositeComponentWizard(ApplicationContext context) : this() 
        {
            //setup extracts selected nodes from current experiment and constructs composite component
            m_setup = new DefiningCompositeComponentSetup(context.Application.Experiment);
            
            //create new experiment drawer with own factories
            ExperimentDrawer drawer = new ExperimentDrawer(this.experimentcanvaswidget1,
                                                           new NodeControlFactory(context),
                                                           new NodeConnectionControlFactory(context));
            
            //draw composite component that is being defined into canvas
            drawer.DrawExperiment(m_setup.CompositeComponentGraph, false);
            
            //zoom to fit moves view to display entire graph in the visible canvas
            //rather part that is not visible
            this.experimentcanvaswidget1.ZoomToFit();
            
            //if experiment is smaller than than the view scale it to original 
            if(this.experimentcanvaswidget1.ZoomScale > 1)
            {
                this.experimentcanvaswidget1.ZoomToOriginal();
            }
            
            m_ioSpecSetupPage = new IOSpecSetupPage(m_setup);
            m_configPage = new ConfigSetupPage(m_setup);
            m_componentInfoPage = new ComponentInfoPage(m_setup, context.Application.Settings.ComponentPaths);
            m_confirmationPage = new ConfirmationPage();
            
            this.mainVBox.Add(m_ioSpecSetupPage);
            this.mainVBox.Add(m_configPage);
            this.mainVBox.Add(m_componentInfoPage);
            this.mainVBox.Add(m_confirmationPage);

            m_componentInfoPage.ComponentNameChanged += delegate {
                RefreshDefineButton();
            };

            m_currentState = WizardState.IOSpec;
            
            DisplayCurrentPage();
        }
        //HERZUM END SPRINT 2: TLAB-156

        public static ExperimentCanvasPad CreateExperimentCanvasPad(ApplicationContext applicationContext, BasicNodeControl basicNodeControl) 
        {
            IExperiment experiment = null;
            ScopeBaseMetadata scopeMetadata = basicNodeControl.ExperimentNode.Data.Metadata as ScopeBaseMetadata;
            if (scopeMetadata != null)
                experiment = scopeMetadata.ComponentGraph.GetExperiment ();
            else
                return applicationContext.MainWindow.ExperimentCanvasPad;

            ExperimentCanvasPad   experimentCanvasPad = new  ExperimentCanvasPad(applicationContext);
            if (!m_mapPadToNodes.ContainsKey(applicationContext.GetHashCode() + experiment.ExperimentInfo.Id))
                //HERZUM SPRINT 2: TLAB-156
                {
                  // HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
                  // m_mapPadToNodes.Add(experiment.ExperimentInfo.Id, experimentCanvasPad);
                  // m_mapIdToNodes.Add (experiment.ExperimentInfo.Id, basicNodeControl);
                  m_mapPadToNodes.Add(applicationContext.GetHashCode() + experiment.ExperimentInfo.Id, experimentCanvasPad);
                  m_mapIdToNodes.Add (applicationContext.GetHashCode() + experiment.ExperimentInfo.Id, basicNodeControl);
                // END HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
                }
            //HERZUM END SPRINT 2: TLAB-156
            return experimentCanvasPad;
        }
        // HERZUM SPRINT 2.4 TLAB-157
        public static ExperimentCanvasPad CreateCompositeExperimentCanvasPad(ApplicationContext applicationContext, ExperimentCanvasWidget experimentCanvasWidget, CompositeComponentGraph experiment) 
        {   
            ExperimentCanvasPad experimentCanvasPad = null;
            if (m_mapPadToNodes.TryGetValue (applicationContext.GetHashCode() + experiment.ExperimentInfo.Id, out experimentCanvasPad))
                return experimentCanvasPad;
            else
            {
                experimentCanvasPad = new  ExperimentCanvasPad(applicationContext);
                m_mapPadToNodes.Add(applicationContext.GetHashCode() + experiment.ExperimentInfo.Id, experimentCanvasPad);
            } 
 
            DockFrame m_dockFrame = new DockFrame();
            Gdk.WindowAttr attributes = new Gdk.WindowAttr();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.X = 100;
            attributes.Y = 100;
            attributes.Width = 100;
            attributes.Height = 100;    
            Gdk.WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y;
            m_dockFrame.GdkWindow = new Gdk.Window(null, attributes, (int) mask);
            experimentCanvasPad.Initialize (m_dockFrame);
            experimentCanvasPad.SetApplicationModel(applicationContext.Application, experimentCanvasWidget, experiment);
            return experimentCanvasPad;
        }
        // END HERZUM SPRINT 2.4 TLAB-157


        public static ExperimentCanvasPad GetExperimentCanvasPad(ApplicationContext applicationContext, BasicNodeControl basicNodeControl) 
        {
            ExperimentCanvasPad experimentCanvasPad=null;
            // HERZUM SPRINT 2.4: TLAB-156
            if (basicNodeControl is CommentNodeControl && !m_mapIdToNodes.ContainsValue(basicNodeControl))
                m_mapIdToNodes.Add (applicationContext.GetHashCode() + basicNodeControl.ExperimentNode.ID, basicNodeControl);
            // END HERZUM SPRINT 2.4: TLAB-156

            // HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
            // if (m_mapPadToNodes.TryGetValue (basicNodeControl.ExperimentNode.Owner.ExperimentInfo.Id, out experimentCanvasPad))
            if (m_mapPadToNodes.TryGetValue (applicationContext.GetHashCode() + basicNodeControl.ExperimentNode.Owner.ExperimentInfo.Id, out experimentCanvasPad))
            // END HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
                return experimentCanvasPad;
            else
                return applicationContext.MainWindow.ExperimentCanvasPad;

        }
        // END HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59

        // HERZUM SPRINT 2.5: TLAB-173
        public static void RemoveSubExperimentCanvasPad(ApplicationContext applicationContext,BasicNodeControl basicNodeControl) 
        {   
            IExperiment experiment = null;
            ScopeBaseMetadata scopeMetadata = basicNodeControl.ExperimentNode.Data.Metadata as ScopeBaseMetadata;
            if (scopeMetadata != null)
                experiment = scopeMetadata.ComponentGraph.GetExperiment ();

            if (basicNodeControl is CommentNodeControl)
            {   
                if (m_mapIdToNodes.ContainsKey(applicationContext.GetHashCode() + basicNodeControl.ExperimentNode.Owner.ExperimentInfo.Id))
                    m_mapIdToNodes.Remove (applicationContext.GetHashCode() + basicNodeControl.ExperimentNode.Owner.ExperimentInfo.Id);
                return;
            }
            m_mapPadToNodes.Remove (applicationContext.GetHashCode() + experiment.ExperimentInfo.Id);
            m_mapIdToNodes.Remove (applicationContext.GetHashCode() + experiment.ExperimentInfo.Id);
        } 
 // HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
 public static void RemoveExperimentCanvasPad(ApplicationContext applicationContext,BasicNodeControl basicNodeControl) 
 {   
     m_mapPadToNodes.Remove (applicationContext.GetHashCode() + basicNodeControl.ExperimentNode.Owner.ExperimentInfo.Id);
     //HERZUM SPRINT 2: TLAB-156
     m_mapIdToNodes.Remove (applicationContext.GetHashCode() + basicNodeControl.ExperimentNode.Owner.ExperimentInfo.Id);
     //HERZUM END SPRINT 2: TLAB-156
 } 
示例#25
0
 public PackageBuilderAction(ApplicationContext applicationWrapper)
 {
     m_applicationContext = applicationWrapper;
 }
 public CompositeComponentControl(ExperimentNode node, ApplicationContext applicationContext) : base(node, applicationContext)
 {
     m_displayComponentSubGraph = new PixButtonHandle(this, new QuickActionLocator (35, 0.8, QuickActionPosition.Right),
                                                      s_magnifierGlassIcon, DisplayComponentSubGraph);
 }
示例#27
0
 public ActionManager(ApplicationContext applicationContext)
 {
     m_applicationContext = applicationContext;
     File = new FileActions();
 }
示例#28
0
 public BasicNodeControl(ExperimentNode node, ApplicationContext applicationContext)
     : this(node, applicationContext, s_waitForAnyAllHandleXLocation, s_waitForAnyAllHandleYLocation)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TraceLab.UI.GTK.InfoPanelFactory"/> class.
 /// </summary>
 /// <param name="dockFrame">Reference to main window dock frame.</param>
 internal InfoPanelFactory(ApplicationContext applicationContext, DockFrame dockFrame)
 {
     m_mainWindowDockFrame = dockFrame;
     m_applicationContext = applicationContext;
 }
 public SettingsAction(ApplicationContext applicationWrapper)
 {
     m_applicationContext = applicationWrapper;
 }