Changeset 3614
- Timestamp:
- 05/05/10 00:10:13 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 15 added
- 7 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r3437 r3614 100 100 <DependentUpon>BatchRunView.cs</DependentUpon> 101 101 </Compile> 102 <Compile Include="RunCollectioComparisonConstraintView.cs"> 103 <SubType>UserControl</SubType> 104 </Compile> 105 <Compile Include="RunCollectioComparisonConstraintView.Designer.cs"> 106 <DependentUpon>RunCollectioComparisonConstraintView.cs</DependentUpon> 107 </Compile> 108 <Compile Include="RunCollectionTypeCompatibilityConstraintView.cs"> 109 <SubType>UserControl</SubType> 110 </Compile> 111 <Compile Include="RunCollectionTypeCompatibilityConstraintView.Designer.cs"> 112 <DependentUpon>RunCollectionTypeCompatibilityConstraintView.cs</DependentUpon> 113 </Compile> 114 <Compile Include="RunCollectionConstraintCollectionView.cs"> 115 <SubType>UserControl</SubType> 116 </Compile> 117 <Compile Include="RunCollectionConstraintCollectionView.Designer.cs"> 118 <DependentUpon>RunCollectionConstraintCollectionView.cs</DependentUpon> 119 </Compile> 120 <Compile Include="RunCollectionConstraintView.cs"> 121 <SubType>UserControl</SubType> 122 </Compile> 123 <Compile Include="RunCollectionConstraintView.Designer.cs"> 124 <DependentUpon>RunCollectionConstraintView.cs</DependentUpon> 125 </Compile> 102 126 <Compile Include="OptimizerListView.cs"> 103 127 <SubType>UserControl</SubType> … … 117 141 <Compile Include="RunCollectionBubbleChartView.Designer.cs"> 118 142 <DependentUpon>RunCollectionBubbleChartView.cs</DependentUpon> 143 </Compile> 144 <Compile Include="RunCollectionEqualityConstraintView.cs"> 145 <SubType>UserControl</SubType> 146 </Compile> 147 <Compile Include="RunCollectionEqualityConstraintView.Designer.cs"> 148 <DependentUpon>RunCollectionEqualityConstraintView.cs</DependentUpon> 119 149 </Compile> 120 150 <Compile Include="RunCollectionTabularView.cs"> … … 222 252 <Name>HeuristicLab.PluginInfrastructure</Name> 223 253 </ProjectReference> 254 </ItemGroup> 255 <ItemGroup> 256 <EmbeddedResource Include="RunCollectioComparisonConstraintView.resx"> 257 <DependentUpon>RunCollectioComparisonConstraintView.cs</DependentUpon> 258 </EmbeddedResource> 224 259 </ItemGroup> 225 260 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r3566 r3614 63 63 this.isSelecting = false; 64 64 65 66 65 this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; 67 66 this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; … … 122 121 private void run_Changed(object sender, EventArgs e) { 123 122 IRun run = (IRun)sender; 123 UpdateRun(run); 124 } 125 126 private void UpdateRun(IRun run) { 124 127 DataPoint point = this.chart.Series[0].Points.Where(p => p.Tag == run).SingleOrDefault(); 125 128 if (point != null) { … … 129 132 } else 130 133 AddDataPoint(run); 134 135 if (this.chart.Series[0].Points.Count == 0) 136 noRunsLabel.Visible = true; 137 else 138 noRunsLabel.Visible = false; 131 139 } 132 140 … … 136 144 UpdateComboBoxes(); 137 145 UpdateDataPoints(); 146 foreach(IRun run in Content) 147 UpdateRun(run); 138 148 } 139 149 private void Content_ColumnNamesChanged(object sender, EventArgs e) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionConstraintCollectionView.cs
r3604 r3614 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.MainForm; 26 using HeuristicLab.Optimization; 27 using System.Drawing; 26 28 27 29 namespace HeuristicLab.Core.Views { 28 30 [View("ConstraintCollection View")] 29 [Content(typeof( ConstraintCollection), true)]30 [Content(typeof(IItemCollection<I Constraint>), false)]31 public partial class ConstraintCollectionView : ItemCollectionView<IConstraint> {31 [Content(typeof(RunCollectionConstraintCollection), true)] 32 [Content(typeof(IItemCollection<IRunCollectionConstraint>), false)] 33 public partial class RunCollectionConstraintCollectionView : ItemCollectionView<IRunCollectionConstraint> { 32 34 protected CreateParameterDialog createParameterDialog; 33 35 /// <summary> 34 36 /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View". 35 37 /// </summary> 36 public ConstraintCollectionView() {38 public RunCollectionConstraintCollectionView() { 37 39 InitializeComponent(); 38 Caption = " ConstraintCollection";39 itemsGroupBox.Text = " Constraints";40 Caption = "RunCollectionConstraintCollection"; 41 itemsGroupBox.Text = "RunCollection Constraints"; 40 42 } 41 43 42 protected override I Constraint CreateItem() {44 protected override IRunCollectionConstraint CreateItem() { 43 45 if (typeSelectorDialog == null) { 44 46 typeSelectorDialog = new TypeSelectorDialog(); 45 typeSelectorDialog.Caption = "Select Operator";46 typeSelectorDialog.TypeSelector.Caption = "Available Operators";47 typeSelectorDialog.TypeSelector.Configure(typeof(I Constraint), false, true);47 typeSelectorDialog.Caption = "Select RunCollection Constraint"; 48 typeSelectorDialog.TypeSelector.Caption = "Available Constraints"; 49 typeSelectorDialog.TypeSelector.Configure(typeof(IRunCollectionConstraint), false, true); 48 50 } 49 51 50 52 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 51 53 try { 52 return (I Constraint)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();54 return (IRunCollectionConstraint)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 53 55 } 54 56 catch (Exception ex) { … … 58 60 return null; 59 61 } 62 63 protected override void RegisterContentEvents() { 64 base.RegisterContentEvents(); 65 foreach (IRunCollectionConstraint constraint in Content) 66 constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged); 67 } 68 protected override void DeregisterContentEvents() { 69 base.DeregisterContentEvents(); 70 foreach (IRunCollectionConstraint constraint in Content) 71 constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged); 72 } 73 protected override void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 74 base.Content_ItemsAdded(sender, e); 75 foreach (IRunCollectionConstraint constraint in e.Items) 76 constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged); 77 } 78 protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 79 base.Content_ItemsRemoved(sender, e); 80 foreach (IRunCollectionConstraint constraint in e.Items) 81 constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged); 82 } 83 protected override void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 84 base.Content_CollectionReset(sender, e); 85 foreach (IRunCollectionConstraint constraint in e.OldItems) 86 constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged); 87 foreach (IRunCollectionConstraint constraint in e.Items) 88 constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged); 89 } 90 91 protected virtual void constraint_ActiveChanged(object sender, EventArgs e) { 92 IRunCollectionConstraint constraint = sender as IRunCollectionConstraint; 93 if (constraint != null) { 94 foreach (ListViewItem listViewItem in GetListViewItemsForItem(constraint)) { 95 if (constraint.Active) 96 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold); 97 else 98 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular); 99 } 100 } 101 } 102 103 60 104 } 61 105 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs
r3566 r3614 54 54 } 55 55 56 protected override void OnContentChanged() { 57 base.OnContentChanged(); 58 if (Content != null) { 59 foreach (IRun run in Content) 60 UpdateRun(run); 61 } 62 } 63 56 64 protected override void RegisterContentEvents() { 57 65 base.RegisterContentEvents(); … … 88 96 private void run_Changed(object sender, EventArgs e) { 89 97 IRun run = (IRun)sender; 98 UpdateRun(run); 99 } 100 101 private void UpdateRun(IRun run) { 90 102 int rowIndex = Content.ToList().IndexOf(run); 91 103 rowIndex = virtualRowIndizes[rowIndex]; … … 104 116 } 105 117 } 106 107 118 108 119 protected override int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs
r3507 r3614 54 54 private void InitializeComponent() { 55 55 this.components = new System.ComponentModel.Container(); 56 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionView)); 56 57 this.splitContainer = new System.Windows.Forms.SplitContainer(); 58 this.toolStrip = new System.Windows.Forms.ToolStrip(); 59 this.analyzeRunsToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); 57 60 this.itemsListView = new System.Windows.Forms.ListView(); 58 61 this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); … … 63 66 this.itemsGroupBox = new System.Windows.Forms.GroupBox(); 64 67 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(); 68 this.tabControl = new System.Windows.Forms.TabControl(); 69 this.runPage = new System.Windows.Forms.TabPage(); 70 this.constraintPage = new System.Windows.Forms.TabPage(); 71 this.runCollectionConstraintCollectionView = new HeuristicLab.Core.Views.RunCollectionConstraintCollectionView(); 67 72 this.splitContainer.Panel1.SuspendLayout(); 68 73 this.splitContainer.Panel2.SuspendLayout(); 69 74 this.splitContainer.SuspendLayout(); 75 this.toolStrip.SuspendLayout(); 70 76 this.detailsGroupBox.SuspendLayout(); 71 77 this.itemsGroupBox.SuspendLayout(); 72 this.toolStrip.SuspendLayout(); 78 this.tabControl.SuspendLayout(); 79 this.runPage.SuspendLayout(); 80 this.constraintPage.SuspendLayout(); 73 81 this.SuspendLayout(); 74 82 // … … 90 98 // 91 99 this.splitContainer.Panel2.Controls.Add(this.detailsGroupBox); 92 this.splitContainer.Size = new System.Drawing.Size(5 26, 364);100 this.splitContainer.Size = new System.Drawing.Size(512, 332); 93 101 this.splitContainer.SplitterDistance = 250; 94 102 this.splitContainer.TabIndex = 0; 103 // 104 // toolStrip 105 // 106 this.toolStrip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 107 | System.Windows.Forms.AnchorStyles.Right))); 108 this.toolStrip.AutoSize = false; 109 this.toolStrip.Dock = System.Windows.Forms.DockStyle.None; 110 this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; 111 this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 112 this.analyzeRunsToolStripDropDownButton}); 113 this.toolStrip.Location = new System.Drawing.Point(30, 3); 114 this.toolStrip.Name = "toolStrip"; 115 this.toolStrip.Size = new System.Drawing.Size(217, 24); 116 this.toolStrip.TabIndex = 1; 117 this.toolStrip.Text = "toolStrip1"; 118 // 119 // analyzeRunsToolStripDropDownButton 120 // 121 this.analyzeRunsToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 122 this.analyzeRunsToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; 123 this.analyzeRunsToolStripDropDownButton.Name = "analyzeRunsToolStripDropDownButton"; 124 this.analyzeRunsToolStripDropDownButton.Size = new System.Drawing.Size(99, 21); 125 this.analyzeRunsToolStripDropDownButton.Text = "&Analyze Runs..."; 126 this.analyzeRunsToolStripDropDownButton.ToolTipText = "Show Run Analysis Views"; 95 127 // 96 128 // itemsListView … … 107 139 this.itemsListView.Name = "itemsListView"; 108 140 this.itemsListView.ShowItemToolTips = true; 109 this.itemsListView.Size = new System.Drawing.Size(244, 327);141 this.itemsListView.Size = new System.Drawing.Size(244, 295); 110 142 this.itemsListView.SmallImageList = this.imageList; 111 143 this.itemsListView.TabIndex = 1; … … 147 179 this.detailsGroupBox.Location = new System.Drawing.Point(3, 27); 148 180 this.detailsGroupBox.Name = "detailsGroupBox"; 149 this.detailsGroupBox.Size = new System.Drawing.Size(2 66, 335);181 this.detailsGroupBox.Size = new System.Drawing.Size(252, 303); 150 182 this.detailsGroupBox.TabIndex = 0; 151 183 this.detailsGroupBox.TabStop = false; … … 162 194 this.viewHost.Name = "viewHost"; 163 195 this.viewHost.ReadOnly = false; 164 this.viewHost.Size = new System.Drawing.Size(2 54, 310);196 this.viewHost.Size = new System.Drawing.Size(240, 278); 165 197 this.viewHost.TabIndex = 0; 166 198 this.viewHost.ViewType = null; … … 170 202 this.itemsGroupBox.Controls.Add(this.splitContainer); 171 203 this.itemsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 172 this.itemsGroupBox.Location = new System.Drawing.Point( 0, 0);204 this.itemsGroupBox.Location = new System.Drawing.Point(3, 3); 173 205 this.itemsGroupBox.Name = "itemsGroupBox"; 174 this.itemsGroupBox.Size = new System.Drawing.Size(5 32, 383);206 this.itemsGroupBox.Size = new System.Drawing.Size(518, 351); 175 207 this.itemsGroupBox.TabIndex = 0; 176 208 this.itemsGroupBox.TabStop = false; 177 209 this.itemsGroupBox.Text = "Items"; 178 210 // 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"; 211 // tabControl 212 // 213 this.tabControl.Controls.Add(this.runPage); 214 this.tabControl.Controls.Add(this.constraintPage); 215 this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; 216 this.tabControl.Location = new System.Drawing.Point(0, 0); 217 this.tabControl.Name = "tabControl"; 218 this.tabControl.SelectedIndex = 0; 219 this.tabControl.Size = new System.Drawing.Size(532, 383); 220 this.tabControl.TabIndex = 1; 221 // 222 // runPage 223 // 224 this.runPage.Controls.Add(this.itemsGroupBox); 225 this.runPage.Location = new System.Drawing.Point(4, 22); 226 this.runPage.Name = "runPage"; 227 this.runPage.Padding = new System.Windows.Forms.Padding(3); 228 this.runPage.Size = new System.Drawing.Size(524, 357); 229 this.runPage.TabIndex = 0; 230 this.runPage.Text = "Runs"; 231 this.runPage.UseVisualStyleBackColor = true; 232 // 233 // constraintPage 234 // 235 this.constraintPage.Controls.Add(this.runCollectionConstraintCollectionView); 236 this.constraintPage.Location = new System.Drawing.Point(4, 22); 237 this.constraintPage.Name = "constraintPage"; 238 this.constraintPage.Padding = new System.Windows.Forms.Padding(3); 239 this.constraintPage.Size = new System.Drawing.Size(524, 357); 240 this.constraintPage.TabIndex = 1; 241 this.constraintPage.Text = "Filtering"; 242 this.constraintPage.UseVisualStyleBackColor = true; 243 // 244 // runCollectionConstraintCollectionView 245 // 246 this.runCollectionConstraintCollectionView.Caption = "Filter"; 247 this.runCollectionConstraintCollectionView.Content = null; 248 this.runCollectionConstraintCollectionView.Dock = System.Windows.Forms.DockStyle.Fill; 249 this.runCollectionConstraintCollectionView.Location = new System.Drawing.Point(3, 3); 250 this.runCollectionConstraintCollectionView.Name = "runCollectionConstraintCollectionView"; 251 this.runCollectionConstraintCollectionView.ReadOnly = false; 252 this.runCollectionConstraintCollectionView.Size = new System.Drawing.Size(518, 351); 253 this.runCollectionConstraintCollectionView.TabIndex = 0; 203 254 // 204 255 // RunCollectionView 205 256 // 206 257 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 207 this.Controls.Add(this. itemsGroupBox);258 this.Controls.Add(this.tabControl); 208 259 this.Name = "RunCollectionView"; 209 260 this.Size = new System.Drawing.Size(532, 383); … … 211 262 this.splitContainer.Panel2.ResumeLayout(false); 212 263 this.splitContainer.ResumeLayout(false); 264 this.toolStrip.ResumeLayout(false); 265 this.toolStrip.PerformLayout(); 213 266 this.detailsGroupBox.ResumeLayout(false); 214 267 this.itemsGroupBox.ResumeLayout(false); 215 this.toolStrip.ResumeLayout(false); 216 this.toolStrip.PerformLayout(); 268 this.tabControl.ResumeLayout(false); 269 this.runPage.ResumeLayout(false); 270 this.constraintPage.ResumeLayout(false); 217 271 this.ResumeLayout(false); 218 272 … … 232 286 protected ToolStrip toolStrip; 233 287 protected ToolStripDropDownButton analyzeRunsToolStripDropDownButton; 288 private TabControl tabControl; 289 private TabPage runPage; 290 private TabPage constraintPage; 291 private HeuristicLab.Core.Views.RunCollectionConstraintCollectionView runCollectionConstraintCollectionView; 234 292 } 235 293 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r3566 r3614 42 42 } 43 43 44 public RunCollection RunCollection { 45 get { return Content as RunCollection; } 46 } 47 44 48 public ListView ItemsListView { 45 49 get { return itemsListView; } … … 94 98 while (itemsListView.Items.Count > 0) RemoveListViewItem(itemsListView.Items[0]); 95 99 viewHost.Content = null; 100 runCollectionConstraintCollectionView.Content = null; 101 tabControl.TabPages.Remove(constraintPage); 96 102 97 103 if (Content != null) { 104 if (RunCollection != null) { 105 tabControl.TabPages.Add(constraintPage); 106 runCollectionConstraintCollectionView.Content = RunCollection.Constraints; 107 runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0; 108 } 98 109 Caption += " (" + Content.GetType().Name + ")"; 99 foreach (IRun item in Content) 110 foreach (IRun item in Content) { 100 111 AddListViewItem(CreateListViewItem(item)); 112 UpdateRun(item); 113 } 101 114 } 102 115 SetEnabledStateOfControls(); … … 110 123 if (Content == null) { 111 124 analyzeRunsToolStripDropDownButton.Enabled = false; 125 runCollectionConstraintCollectionView.ReadOnly = true; 112 126 itemsListView.Enabled = false; 113 127 detailsGroupBox.Enabled = false; … … 116 130 } else { 117 131 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 132 runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0; 118 133 itemsListView.Enabled = true; 119 134 detailsGroupBox.Enabled = true; … … 262 277 AddListViewItem(CreateListViewItem(item)); 263 278 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 279 runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0; 264 280 } 265 281 } … … 276 292 } 277 293 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 294 runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0; 278 295 } 279 296 } … … 293 310 AddListViewItem(CreateListViewItem(item)); 294 311 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 312 runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0; 295 313 } 296 314 } … … 318 336 protected virtual void Run_Changed(object sender, EventArgs e) { 319 337 IRun run = (IRun)sender; 338 UpdateRun(run); 339 } 340 341 protected virtual void UpdateRun(IRun run) { 320 342 foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) { 321 343 if (run.Visible) { -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r3601 r3614 87 87 <Compile Include="Algorithm.cs" /> 88 88 <Compile Include="BatchRun.cs" /> 89 <Compile Include="RunCollectionComparisonConstraint.cs" /> 90 <Compile Include="RunCollectionConstraintCollection.cs" /> 91 <Compile Include="RunCollectionTypeCompatiblityConstraint.cs" /> 92 <Compile Include="RunCollectionEqualityConstraint.cs" /> 89 93 <Compile Include="Interfaces\ISingleObjectiveReplacer.cs" /> 90 94 <Compile Include="Interfaces\IMigrator.cs" /> … … 97 101 <Compile Include="Interfaces\IStrategyParameterCreator.cs" /> 98 102 <Compile Include="Interfaces\IRun.cs" /> 103 <Compile Include="IRunCollectionConstraint.cs" /> 99 104 <Compile Include="OptimizerList.cs" /> 100 105 <Compile Include="Experiment.cs" /> -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r3492 r3614 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Collections; 29 30 30 31 namespace HeuristicLab.Optimization { … … 38 39 parameterNames = new List<string>(); 39 40 resultNames = new List<string>(); 40 } 41 42 protected static Type[] viewableDataTypes = new Type[]{typeof(BoolValue), typeof(DoubleValue), typeof(IntValue), 43 typeof(PercentValue), typeof(StringValue)}; 41 dataTypes = new Dictionary<string, HashSet<Type>>(); 42 constraints = new RunCollectionConstraintCollection(); 43 constraints.ItemsAdded += new CollectionItemsChangedEventHandler<IRunCollectionConstraint>(Constraints_ItemsAdded); 44 constraints.ItemsRemoved += new CollectionItemsChangedEventHandler<IRunCollectionConstraint>(Constraints_ItemsRemoved); 45 constraints.CollectionReset += new CollectionItemsChangedEventHandler<IRunCollectionConstraint>(Constraints_CollectionReset); 46 } 47 private Dictionary<string, HashSet<Type>> dataTypes; 48 public IEnumerable<Type> GetDataType(string columnName) { 49 if (!dataTypes.ContainsKey(columnName)) 50 return new Type[0]; 51 return dataTypes[columnName]; 52 } 53 private RunCollectionConstraintCollection constraints; 54 public RunCollectionConstraintCollection Constraints { 55 get { return constraints;} 56 } 44 57 45 58 protected override void OnCollectionReset(IEnumerable<IRun> items, IEnumerable<IRun> oldItems) { … … 90 103 return false; 91 104 if (!parameterNames.Contains(name)) { 92 // && viewableDataTypes.Any(x => x.IsAssignableFrom(value.GetType()))) {93 105 parameterNames.Add(name); 94 return true; 95 } 106 dataTypes[name] = new HashSet<Type>(); 107 dataTypes[name].Add(value.GetType()); 108 return true; 109 } 110 dataTypes[name].Add(value.GetType()); 96 111 return false; 97 112 } … … 100 115 return false; 101 116 if (!resultNames.Contains(name)) { 102 // && viewableDataTypes.Any(x => x.IsAssignableFrom(value.GetType()))) {103 117 resultNames.Add(name); 104 return true; 105 } 118 dataTypes[name] = new HashSet<Type>(); 119 dataTypes[name].Add(value.GetType()); 120 return true; 121 } 122 dataTypes[name].Add(value.GetType()); 106 123 return false; 107 124 } … … 221 238 public bool SetValue(string value, int rowIndex, int columnIndex) { throw new NotSupportedException(); } 222 239 #endregion 240 241 #region filtering 242 private void UpdateFiltering() { 243 list.ForEach(r => r.Visible = true); 244 foreach (IRunCollectionConstraint constraint in this.constraints) 245 constraint.Check(); 246 } 247 248 protected virtual void RegisterConstraintEvents(IEnumerable<IRunCollectionConstraint> constraints) { 249 foreach (IRunCollectionConstraint constraint in constraints) { 250 constraint.ActiveChanged += new EventHandler(Constraint_ActiveChanged); 251 constraint.ConstrainedValueChanged += new EventHandler(Constraint_ConstrainedValueChanged); 252 constraint.ConstraintOperationChanged += new EventHandler(Constraint_ConstraintOperationChanged); 253 constraint.ConstraintDataChanged += new EventHandler(Constraint_ConstraintDataChanged); 254 } 255 } 256 protected virtual void DeregisterConstraintEvents(IEnumerable<IRunCollectionConstraint> constraints) { 257 foreach (IRunCollectionConstraint constraint in constraints) { 258 constraint.ActiveChanged -= new EventHandler(Constraint_ActiveChanged); 259 constraint.ConstrainedValueChanged -= new EventHandler(Constraint_ConstrainedValueChanged); 260 constraint.ConstraintOperationChanged -= new EventHandler(Constraint_ConstraintOperationChanged); 261 constraint.ConstraintDataChanged -= new EventHandler(Constraint_ConstraintDataChanged); 262 } 263 } 264 265 protected virtual void Constraints_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 266 DeregisterConstraintEvents(e.OldItems); 267 RegisterConstraintEvents(e.Items); 268 this.UpdateFiltering(); 269 } 270 protected virtual void Constraints_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 271 RegisterConstraintEvents(e.Items); 272 foreach (IRunCollectionConstraint constraint in e.Items) 273 constraint.ConstrainedValue = this; 274 this.UpdateFiltering(); 275 } 276 protected virtual void Constraints_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 277 DeregisterConstraintEvents(e.Items); 278 this.UpdateFiltering(); 279 } 280 protected virtual void Constraint_ActiveChanged(object sender, EventArgs e) { 281 this.UpdateFiltering(); 282 } 283 protected virtual void Constraint_ConstrainedValueChanged(object sender, EventArgs e) { 284 //mkommend: this method is intentionally left empty, because the constrainedValue is set in the ItemsAdded method 285 } 286 protected virtual void Constraint_ConstraintOperationChanged(object sender, EventArgs e) { 287 this.UpdateFiltering(); 288 } 289 protected virtual void Constraint_ConstraintDataChanged(object sender, EventArgs e) { 290 this.UpdateFiltering(); 291 } 292 #endregion 223 293 } 224 294 }
Note: See TracChangeset
for help on using the changeset viewer.