Changeset 3361


Ignore:
Timestamp:
04/16/10 01:39:32 (11 years ago)
Author:
mkommend
Message:

added operator graph tab page to EngineAlgorithmView (ticket #973)

Location:
trunk/sources
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorGraphView.cs

    r3281 r3361  
    3131  /// </summary>
    3232  [View("OperatorGraph View (Tree)",ShowInViewHost=true)]
    33   [Content(typeof(OperatorGraph), true)]
     33  [Content(typeof(OperatorGraph), false)]
    3434  public partial class OperatorGraphView : ItemView {
    3535    /// <summary>
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewHost.cs

    r3350 r3361  
    6363          viewContextMenuStrip.Item = content;
    6464          cachedViews.Clear();
     65          this.viewsLabel.Enabled = value != null;
    6566          Initialize();
    6667        }
     
    7374        this.SuspendRepaint();
    7475        base.Enabled = value;
    75         this.viewsLabel.Enabled = value;
     76        if (Content != null && value)
     77          this.viewsLabel.Enabled = value;
    7678        this.ResumeRepaint(true);
    7779      }
     
    113115
    114116      if (Content != null) {
    115         if (viewContextMenuStrip.Items.Count == 0) 
     117        if (viewContextMenuStrip.Items.Count == 0)
    116118          messageLabel.Visible = true;
    117          else
     119        else
    118120          viewsLabel.Visible = true;
    119121
     
    140142      UpdateActiveMenuItem();
    141143      cachedViews.Clear();
    142       Control view = (Control)MainFormManager.CreateView(viewType, Content,ReadOnly);
     144      Control view = (Control)MainFormManager.CreateView(viewType, Content, ReadOnly);
    143145      cachedViews.Add(viewType, ((IView)view));
    144146      view.Dock = DockStyle.Fill;
     
    168170
    169171    private void viewsLabel_DoubleClick(object sender, EventArgs e) {
    170       MainFormManager.CreateView(viewType, Content,ReadOnly).Show();
     172      MainFormManager.CreateView(viewType, Content, ReadOnly).Show();
    171173    }
    172174
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs

    r3355 r3361  
    3838namespace HeuristicLab.Operators.Views.GraphVisualization {
    3939  [View("OperatorGraph View (Chart)")]
    40   [Content(typeof(OperatorGraph), false)]
     40  [Content(typeof(OperatorGraph), true)]
    4141  public partial class OperatorGraphView : ContentView {
    4242    public OperatorGraphView() {
     
    9393        graphVisualizationInfoView.ReadOnly = true;
    9494        connectButton.Enabled = false;
    95        
    9695      } else {
    9796        selectButton.Enabled = true;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r3306 r3361  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EngineAlgorithmView));
    4748      this.engineLabel = new System.Windows.Forms.Label();
    4849      this.createUserDefinedAlgorithmButton = new System.Windows.Forms.Button();
     
    5051      this.engineTabPage = new System.Windows.Forms.TabPage();
    5152      this.engineViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     53      this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
     54      this.saveOperatorGraphButton = new System.Windows.Forms.Button();
     55      this.openOperatorGraphButton = new System.Windows.Forms.Button();
     56      this.newOperatorGraphButton = new System.Windows.Forms.Button();
     57      this.operatorGraphViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5258      this.tabControl.SuspendLayout();
    5359      this.parametersTabPage.SuspendLayout();
     
    5864      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5965      this.engineTabPage.SuspendLayout();
     66      this.operatorGraphTabPage.SuspendLayout();
    6067      this.SuspendLayout();
    6168      //
    6269      // tabControl
    6370      //
     71      this.tabControl.Controls.Add(this.operatorGraphTabPage);
    6472      this.tabControl.Controls.Add(this.engineTabPage);
    6573      this.tabControl.Size = new System.Drawing.Size(713, 467);
     74      this.tabControl.Controls.SetChildIndex(this.engineTabPage, 0);
     75      this.tabControl.Controls.SetChildIndex(this.operatorGraphTabPage, 0);
    6676      this.tabControl.Controls.SetChildIndex(this.runsTabPage, 0);
    6777      this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0);
    68       this.tabControl.Controls.SetChildIndex(this.engineTabPage, 0);
    6978      this.tabControl.Controls.SetChildIndex(this.problemTabPage, 0);
    7079      this.tabControl.Controls.SetChildIndex(this.parametersTabPage, 0);
     
    187196      this.engineComboBox.Location = new System.Drawing.Point(55, 6);
    188197      this.engineComboBox.Name = "engineComboBox";
    189       this.engineComboBox.Size = new System.Drawing.Size(644, 21);
     198      this.engineComboBox.Size = new System.Drawing.Size(610, 21);
    190199      this.engineComboBox.TabIndex = 1;
    191200      this.engineComboBox.SelectedIndexChanged += new System.EventHandler(this.engineComboBox_SelectedIndexChanged);
     
    212221      this.engineViewHost.Location = new System.Drawing.Point(6, 33);
    213222      this.engineViewHost.Name = "engineViewHost";
    214       this.engineViewHost.Size = new System.Drawing.Size(693, 402);
     223      this.engineViewHost.ReadOnly = false;
     224      this.engineViewHost.Size = new System.Drawing.Size(659, 335);
    215225      this.engineViewHost.TabIndex = 2;
    216226      this.engineViewHost.ViewType = null;
     227      //
     228      // operatorGraphTabPage
     229      //
     230      this.operatorGraphTabPage.Controls.Add(this.saveOperatorGraphButton);
     231      this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton);
     232      this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton);
     233      this.operatorGraphTabPage.Controls.Add(this.operatorGraphViewHost);
     234      this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22);
     235      this.operatorGraphTabPage.Name = "operatorGraphTabPage";
     236      this.operatorGraphTabPage.Size = new System.Drawing.Size(705, 441);
     237      this.operatorGraphTabPage.TabIndex = 4;
     238      this.operatorGraphTabPage.Text = "Operator Graph";
     239      this.operatorGraphTabPage.UseVisualStyleBackColor = true;
     240      //
     241      // saveOperatorGraphButton
     242      //
     243      this.saveOperatorGraphButton.Enabled = false;
     244      this.saveOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
     245      this.saveOperatorGraphButton.Location = new System.Drawing.Point(63, 3);
     246      this.saveOperatorGraphButton.Name = "saveOperatorGraphButton";
     247      this.saveOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
     248      this.saveOperatorGraphButton.TabIndex = 1;
     249      this.toolTip.SetToolTip(this.saveOperatorGraphButton, "Save Operator Graph");
     250      this.saveOperatorGraphButton.UseVisualStyleBackColor = true;
     251      //
     252      // openOperatorGraphButton
     253      //
     254      this.openOperatorGraphButton.Enabled = false;
     255      this.openOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open;
     256      this.openOperatorGraphButton.Location = new System.Drawing.Point(33, 3);
     257      this.openOperatorGraphButton.Name = "openOperatorGraphButton";
     258      this.openOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
     259      this.openOperatorGraphButton.TabIndex = 1;
     260      this.toolTip.SetToolTip(this.openOperatorGraphButton, "Open Operator Graph");
     261      this.openOperatorGraphButton.UseVisualStyleBackColor = true;
     262      //
     263      // newOperatorGraphButton
     264      //
     265      this.newOperatorGraphButton.Enabled = false;
     266      this.newOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument;
     267      this.newOperatorGraphButton.Location = new System.Drawing.Point(3, 3);
     268      this.newOperatorGraphButton.Name = "newOperatorGraphButton";
     269      this.newOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
     270      this.newOperatorGraphButton.TabIndex = 1;
     271      this.toolTip.SetToolTip(this.newOperatorGraphButton, "New Operator Graph");
     272      this.newOperatorGraphButton.UseVisualStyleBackColor = true;
     273      //
     274      // operatorGraphViewHost
     275      //
     276      this.operatorGraphViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     277                  | System.Windows.Forms.AnchorStyles.Left)
     278                  | System.Windows.Forms.AnchorStyles.Right)));
     279      this.operatorGraphViewHost.Content = null;
     280      this.operatorGraphViewHost.Location = new System.Drawing.Point(3, 33);
     281      this.operatorGraphViewHost.Name = "operatorGraphViewHost";
     282      this.operatorGraphViewHost.ReadOnly = true;
     283      this.operatorGraphViewHost.Size = new System.Drawing.Size(699, 405);
     284      this.operatorGraphViewHost.TabIndex = 0;
     285      this.operatorGraphViewHost.ViewType = null;
    217286      //
    218287      // EngineAlgorithmView
     
    244313      this.engineTabPage.ResumeLayout(false);
    245314      this.engineTabPage.PerformLayout();
     315      this.operatorGraphTabPage.ResumeLayout(false);
    246316      this.ResumeLayout(false);
    247317      this.PerformLayout();
     
    256326    protected System.Windows.Forms.TabPage engineTabPage;
    257327    protected HeuristicLab.MainForm.WindowsForms.ViewHost engineViewHost;
     328    protected System.Windows.Forms.TabPage operatorGraphTabPage;
     329    protected HeuristicLab.MainForm.WindowsForms.ViewHost operatorGraphViewHost;
     330    protected System.Windows.Forms.Button saveOperatorGraphButton;
     331    protected System.Windows.Forms.Button openOperatorGraphButton;
     332    protected System.Windows.Forms.Button newOperatorGraphButton;
    258333
    259334  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r3262 r3361  
    5959
    6060    protected override void DeregisterContentEvents() {
    61       Content.EngineChanged -= new System.EventHandler(Content_EngineChanged);
     61      Content.EngineChanged -= new EventHandler(Content_EngineChanged);
     62      Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged);
    6263      base.DeregisterContentEvents();
    6364    }
    6465    protected override void RegisterContentEvents() {
    6566      base.RegisterContentEvents();
    66       Content.EngineChanged += new System.EventHandler(Content_EngineChanged);
     67      Content.EngineChanged += new EventHandler(Content_EngineChanged);
     68      Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged);
    6769    }
    6870
     
    8789        engineViewHost.Content = null;
    8890        createUserDefinedAlgorithmButton.Enabled = false;
     91        operatorGraphViewHost.Content = null;
    8992      } else {
    9093        if (Content.Engine == null)
     
    9497        engineViewHost.ViewType = null;
    9598        engineViewHost.Content = Content.Engine;
     99        operatorGraphViewHost.ViewType = null;
     100        operatorGraphViewHost.Content = Content.OperatorGraph;
    96101        createUserDefinedAlgorithmButton.Enabled = true;
    97102      }
     
    105110        engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    106111        engineViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
     112        operatorGraphViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
    107113        base.Content_ExecutionStateChanged(sender, e);
    108114      }
     
    118124        engineViewHost.ViewType = null;
    119125        engineViewHost.Content = Content.Engine;
     126      }
     127    }
     128    private void Content_OperatorGraphChanged(object sender, EventArgs e) {
     129      if (InvokeRequired)
     130        Invoke(new EventHandler(Content_OperatorGraphChanged), sender, e);
     131      else {
     132        operatorGraphViewHost.ViewType = null;
     133        operatorGraphViewHost.Content = Content.OperatorGraph;
    120134      }
    121135    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs

    r3306 r3361  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
    48       this.saveOperatorGraphButton = new System.Windows.Forms.Button();
    49       this.openOperatorGraphButton = new System.Windows.Forms.Button();
    50       this.newOperatorGraphButton = new System.Windows.Forms.Button();
    51       this.operatorGraphViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5247      this.globalScopeTabPage = new System.Windows.Forms.TabPage();
    5348      this.globalScopeView = new HeuristicLab.Core.Views.ScopeView();
     
    6055      this.problemPanel.SuspendLayout();
    6156      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    62       this.operatorGraphTabPage.SuspendLayout();
    6357      this.globalScopeTabPage.SuspendLayout();
    6458      this.SuspendLayout();
     
    7266      // tabControl
    7367      //
    74       this.tabControl.Controls.Add(this.operatorGraphTabPage);
    7568      this.tabControl.Controls.Add(this.globalScopeTabPage);
    7669      this.tabControl.Controls.SetChildIndex(this.globalScopeTabPage, 0);
     
    115108      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    116109      //
    117       // operatorGraphTabPage
    118       //
    119       this.operatorGraphTabPage.Controls.Add(this.saveOperatorGraphButton);
    120       this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton);
    121       this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton);
    122       this.operatorGraphTabPage.Controls.Add(this.operatorGraphViewHost);
    123       this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22);
    124       this.operatorGraphTabPage.Name = "operatorGraphTabPage";
    125       this.operatorGraphTabPage.Size = new System.Drawing.Size(705, 441);
    126       this.operatorGraphTabPage.TabIndex = 2;
    127       this.operatorGraphTabPage.Text = "Operator Graph";
    128       this.operatorGraphTabPage.UseVisualStyleBackColor = true;
    129       //
    130       // saveOperatorGraphButton
    131       //
    132       this.saveOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    133       this.saveOperatorGraphButton.Location = new System.Drawing.Point(63, 3);
    134       this.saveOperatorGraphButton.Name = "saveOperatorGraphButton";
    135       this.saveOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    136       this.saveOperatorGraphButton.TabIndex = 1;
    137       this.toolTip.SetToolTip(this.saveOperatorGraphButton, "Save Operator Graph");
    138       this.saveOperatorGraphButton.UseVisualStyleBackColor = true;
    139       this.saveOperatorGraphButton.Click += new System.EventHandler(this.saveOperatorGraphButton_Click);
    140       //
    141       // openOperatorGraphButton
    142       //
    143       this.openOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open;
    144       this.openOperatorGraphButton.Location = new System.Drawing.Point(33, 3);
    145       this.openOperatorGraphButton.Name = "openOperatorGraphButton";
    146       this.openOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    147       this.openOperatorGraphButton.TabIndex = 1;
    148       this.toolTip.SetToolTip(this.openOperatorGraphButton, "Open Operator Graph");
    149       this.openOperatorGraphButton.UseVisualStyleBackColor = true;
    150       this.openOperatorGraphButton.Click += new System.EventHandler(this.openOperatorGraphButton_Click);
    151       //
    152       // newOperatorGraphButton
    153       //
    154       this.newOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument;
    155       this.newOperatorGraphButton.Location = new System.Drawing.Point(3, 3);
    156       this.newOperatorGraphButton.Name = "newOperatorGraphButton";
    157       this.newOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    158       this.newOperatorGraphButton.TabIndex = 1;
    159       this.toolTip.SetToolTip(this.newOperatorGraphButton, "New Operator Graph");
    160       this.newOperatorGraphButton.UseVisualStyleBackColor = true;
    161       this.newOperatorGraphButton.Click += new System.EventHandler(this.newOperatorGraphButton_Click);
    162       //
    163       // operatorGraphViewHost
    164       //
    165       this.operatorGraphViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    166                   | System.Windows.Forms.AnchorStyles.Left)
    167                   | System.Windows.Forms.AnchorStyles.Right)));
    168       this.operatorGraphViewHost.Content = null;
    169       this.operatorGraphViewHost.Location = new System.Drawing.Point(3, 33);
    170       this.operatorGraphViewHost.Name = "operatorGraphViewHost";
    171       this.operatorGraphViewHost.Size = new System.Drawing.Size(699, 405);
    172       this.operatorGraphViewHost.TabIndex = 0;
    173       this.operatorGraphViewHost.ViewType = null;
    174       //
    175110      // globalScopeTabPage
    176111      //
     
    192127      this.globalScopeView.Location = new System.Drawing.Point(3, 3);
    193128      this.globalScopeView.Name = "globalScopeView";
     129      this.globalScopeView.ReadOnly = false;
    194130      this.globalScopeView.Size = new System.Drawing.Size(699, 435);
    195131      this.globalScopeView.TabIndex = 0;
     
    209145      this.problemPanel.ResumeLayout(false);
    210146      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    211       this.operatorGraphTabPage.ResumeLayout(false);
    212147      this.globalScopeTabPage.ResumeLayout(false);
    213148      this.ResumeLayout(false);
     
    218153    #endregion
    219154
    220     private System.Windows.Forms.TabPage operatorGraphTabPage;
    221155    private System.Windows.Forms.TabPage globalScopeTabPage;
    222156    private HeuristicLab.Core.Views.ScopeView globalScopeView;
    223     private System.Windows.Forms.Button saveOperatorGraphButton;
    224     private System.Windows.Forms.Button openOperatorGraphButton;
    225     private System.Windows.Forms.Button newOperatorGraphButton;
    226     private HeuristicLab.MainForm.WindowsForms.ViewHost operatorGraphViewHost;
    227157
    228158  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs

    r3262 r3361  
    5454    }
    5555
    56     protected override void DeregisterContentEvents() {
    57       Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged);
    58       base.DeregisterContentEvents();
    59     }
    60     protected override void RegisterContentEvents() {
    61       base.RegisterContentEvents();
    62       Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged);
    63     }
    64 
    6556    protected override void OnContentChanged() {
    6657      base.OnContentChanged();
    67       if (Content == null) {
    68         operatorGraphViewHost.Content = null;
     58      if (Content == null)
    6959        globalScopeView.Content = null;
    70       } else {
    71         operatorGraphViewHost.ViewType = null;
    72         operatorGraphViewHost.Content = Content.OperatorGraph;
     60      else
    7361        globalScopeView.Content = Content.GlobalScope;
    74       }
    7562    }
    7663
     
    8067      else {
    8168        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    82         operatorGraphViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
    8369        globalScopeView.Enabled = Content.ExecutionState != ExecutionState.Started;
    8470        base.Content_ExecutionStateChanged(sender, e);
    85       }
    86     }
    87     private void Content_OperatorGraphChanged(object sender, EventArgs e) {
    88       if (InvokeRequired)
    89         Invoke(new EventHandler(Content_OperatorGraphChanged), sender, e);
    90       else {
    91         operatorGraphViewHost.ViewType = null;
    92         operatorGraphViewHost.Content = Content.OperatorGraph;
    9371      }
    9472    }
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r3303 r3361  
    3636    [Storable]
    3737    private OperatorGraph operatorGraph;
    38     protected OperatorGraph OperatorGraph {
     38    public OperatorGraph OperatorGraph {
    3939      get { return operatorGraph; }
    40       set {
     40      protected set {
    4141        if (value == null) throw new ArgumentNullException();
    4242        if (value != operatorGraph) {
     
    194194        EngineChanged(this, EventArgs.Empty);
    195195    }
    196     protected virtual void OnOperatorGraphChanged() { }
     196    public event EventHandler OperatorGraphChanged;
     197    protected virtual void OnOperatorGraphChanged() {
     198      EventHandler handler = OperatorGraphChanged;
     199      if (handler != null) handler(this, EventArgs.Empty);
     200    }
    197201    protected override void OnStopped() {
    198202      if (Problem != null) {
  • trunk/sources/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs

    r3286 r3361  
    5454    [StorableConstructor]
    5555    private UserDefinedAlgorithm(bool deserializing) : base(deserializing) { }
    56 
    57     public event EventHandler OperatorGraphChanged;
    58     protected override void OnOperatorGraphChanged() {
    59       EventHandler handler = OperatorGraphChanged;
    60       if (handler != null) handler(this, EventArgs.Empty);
    61     }
    6256  }
    6357}
Note: See TracChangeset for help on using the changeset viewer.