Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3507


Ignore:
Timestamp:
04/23/10 04:13:02 (14 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947)

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs

    r3351 r3507  
    6363      this.itemsGroupBox = new System.Windows.Forms.GroupBox();
    6464      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     65      this.toolStrip = new System.Windows.Forms.ToolStrip();
     66      this.analyzeRunsToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton();
    6567      this.splitContainer.Panel1.SuspendLayout();
    6668      this.splitContainer.Panel2.SuspendLayout();
     
    6870      this.detailsGroupBox.SuspendLayout();
    6971      this.itemsGroupBox.SuspendLayout();
     72      this.toolStrip.SuspendLayout();
    7073      this.SuspendLayout();
    7174      //
     
    7982      // splitContainer.Panel1
    8083      //
     84      this.splitContainer.Panel1.Controls.Add(this.toolStrip);
    8185      this.splitContainer.Panel1.Controls.Add(this.itemsListView);
    8286      this.splitContainer.Panel1.Controls.Add(this.removeButton);
     
    153157                  | System.Windows.Forms.AnchorStyles.Left)
    154158                  | System.Windows.Forms.AnchorStyles.Right)));
     159      this.viewHost.Caption = null;
    155160      this.viewHost.Content = null;
    156161      this.viewHost.Location = new System.Drawing.Point(6, 19);
    157162      this.viewHost.Name = "viewHost";
     163      this.viewHost.ReadOnly = false;
    158164      this.viewHost.Size = new System.Drawing.Size(254, 310);
    159165      this.viewHost.TabIndex = 0;
     
    170176      this.itemsGroupBox.TabStop = false;
    171177      this.itemsGroupBox.Text = "Items";
     178      //
     179      // toolStrip
     180      //
     181      this.toolStrip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     182                  | System.Windows.Forms.AnchorStyles.Right)));
     183      this.toolStrip.AutoSize = false;
     184      this.toolStrip.Dock = System.Windows.Forms.DockStyle.None;
     185      this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
     186      this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     187            this.analyzeRunsToolStripDropDownButton});
     188      this.toolStrip.Location = new System.Drawing.Point(30, 3);
     189      this.toolStrip.Name = "toolStrip";
     190      this.toolStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode;
     191      this.toolStrip.Size = new System.Drawing.Size(217, 24);
     192      this.toolStrip.TabIndex = 1;
     193      this.toolStrip.Text = "toolStrip1";
     194      //
     195      // analyzeRunsToolStripDropDownButton
     196      //
     197      this.analyzeRunsToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
     198      this.analyzeRunsToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
     199      this.analyzeRunsToolStripDropDownButton.Name = "analyzeRunsToolStripDropDownButton";
     200      this.analyzeRunsToolStripDropDownButton.Size = new System.Drawing.Size(45, 21);
     201      this.analyzeRunsToolStripDropDownButton.Text = "&Analyze Runs...";
     202      this.analyzeRunsToolStripDropDownButton.ToolTipText = "Show Run Analysis Views";
    172203      //
    173204      // RunCollectionView
     
    182213      this.detailsGroupBox.ResumeLayout(false);
    183214      this.itemsGroupBox.ResumeLayout(false);
     215      this.toolStrip.ResumeLayout(false);
     216      this.toolStrip.PerformLayout();
    184217      this.ResumeLayout(false);
    185218
     
    197230    protected ImageList imageList;
    198231    protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     232    protected ToolStrip toolStrip;
     233    protected ToolStripDropDownButton analyzeRunsToolStripDropDownButton;
    199234  }
    200235}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3505 r3507  
    2121
    2222using HeuristicLab.Collections;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Core.Views;
     
    2930using System.Drawing;
    3031using System.Collections.Generic;
     32using System.Linq;
    3133
    3234namespace HeuristicLab.Optimization.Views {
     
    7173    protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
    7274      foreach (IRun run in runs)
    73         run.Changed += new EventHandler(run_Changed);
     75        run.Changed += new EventHandler(Run_Changed);
    7476    }
    7577    protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
    7678      foreach (IRun run in runs)
    77         run.Changed -= new EventHandler(run_Changed);
     79        run.Changed -= new EventHandler(Run_Changed);
     80    }
     81
     82    protected override void OnInitialized(EventArgs e) {
     83      base.OnInitialized(e);
     84      var viewTypes = MainFormManager.GetViewTypes(typeof(RunCollection), true);
     85      foreach (Type viewType in viewTypes.OrderBy(x => ViewAttribute.GetViewName(x))) {
     86        if ((viewType != typeof(ItemCollectionView<IRun>)) && (viewType != typeof(ViewHost))) {
     87          ToolStripMenuItem menuItem = new ToolStripMenuItem();
     88          menuItem.Text = ViewAttribute.GetViewName(viewType);
     89          menuItem.Tag = viewType;
     90          menuItem.Click += new EventHandler(menuItem_Click);
     91          analyzeRunsToolStripDropDownButton.DropDownItems.Add(menuItem);
     92        }
     93      }
    7894    }
    7995
     
    92108    }
    93109
    94     private void run_Changed(object sender, EventArgs e) {
    95       IRun run = (IRun)sender;
    96       foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) {
    97         if (run.Visible) {
    98           listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular);
    99           listViewItem.ForeColor = run.Color;
    100         } else {
    101           listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic);
    102           listViewItem.ForeColor = Color.LightGray;
    103         }
    104       }
    105     }
    106 
    107110    protected override void OnReadOnlyChanged() {
    108111      base.OnReadOnlyChanged();
     
    111114    private void SetEnabledStateOfControls() {
    112115      if (Content == null) {
     116        analyzeRunsToolStripDropDownButton.Enabled = false;
    113117        itemsListView.Enabled = false;
    114118        detailsGroupBox.Enabled = false;
     
    116120        removeButton.Enabled = false;
    117121      } else {
     122        analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0;
    118123        itemsListView.Enabled = true;
    119124        detailsGroupBox.Enabled = true;
     
    235240
    236241    #region Button Events
     242    protected virtual void menuItem_Click(object sender, EventArgs e) {
     243      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
     244      IContentView view = MainFormManager.CreateView((Type)menuItem.Tag, Content);
     245      if (view != null) {
     246        view.Locked = Locked;
     247        view.ReadOnly = ReadOnly;
     248        view.Show();
     249      }
     250    }
    237251    protected virtual void removeButton_Click(object sender, EventArgs e) {
    238252      if (itemsListView.SelectedItems.Count > 0) {
     
    252266        foreach (IRun item in e.Items)
    253267          AddListViewItem(CreateListViewItem(item));
     268        analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0;
    254269      }
    255270    }
     
    265280          }
    266281        }
     282        analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0;
    267283      }
    268284    }
     
    281297        foreach (IRun item in e.Items)
    282298          AddListViewItem(CreateListViewItem(item));
     299        analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0;
    283300      }
    284301    }
     
    304321      }
    305322    }
     323    protected virtual void Run_Changed(object sender, EventArgs e) {
     324      IRun run = (IRun)sender;
     325      foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) {
     326        if (run.Visible) {
     327          listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular);
     328          listViewItem.ForeColor = run.Color;
     329        } else {
     330          listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic);
     331          listViewItem.ForeColor = Color.LightGray;
     332        }
     333      }
     334    }
    306335    #endregion
    307336  }
Note: See TracChangeset for help on using the changeset viewer.