- Timestamp:
- 01/29/10 01:44:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs
r2694 r2713 42 42 /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>. 43 43 /// No own data storage present.</remarks> 44 public Variable Variable{45 get { return (Variable) Item; }46 set { base. Item= value; }44 public new Variable Content { 45 get { return (Variable)base.Content; } 46 set { base.Content = value; } 47 47 } 48 48 … … 61 61 public VariableView(Variable variable) 62 62 : this() { 63 Variable= variable;63 Content = variable; 64 64 } 65 65 … … 68 68 /// </summary> 69 69 /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks> 70 protected override void Deregister ObjectEvents() {71 Variable.ValueChanged -= new EventHandler(Variable_ValueChanged);72 base.Deregister ObjectEvents();70 protected override void DeregisterContentEvents() { 71 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 72 base.DeregisterContentEvents(); 73 73 } 74 74 … … 77 77 /// </summary> 78 78 /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks> 79 protected override void Register ObjectEvents() {80 base.Register ObjectEvents();81 Variable.ValueChanged += new EventHandler(Variable_ValueChanged);79 protected override void RegisterContentEvents() { 80 base.RegisterContentEvents(); 81 Content.ValueChanged += new EventHandler(Content_ValueChanged); 82 82 } 83 83 84 protected override void On ObjectChanged() {85 base.On ObjectChanged();86 if ( Variable== null) {84 protected override void OnContentChanged() { 85 base.OnContentChanged(); 86 if (Content == null) { 87 87 Caption = "Variable"; 88 88 dataTypeTextBox.Text = "-"; … … 91 91 clearValueButton.Enabled = false; 92 92 valueGroupBox.Enabled = false; 93 viewHost. Object = null;93 viewHost.Content = null; 94 94 } else { 95 Caption = Variable.Name + " (" + Variable.GetType().Name + ")";96 dataTypeTextBox.Text = Variable.Value == null ? "-" : Variable.Value.GetType().FullName;97 dataTypeTextBox.Enabled = Variable.Value != null;98 setValueButton.Enabled = Variable.Value == null;99 clearValueButton.Enabled = Variable.Value != null;95 Caption = Content.Name + " (" + Content.GetType().Name + ")"; 96 dataTypeTextBox.Text = Content.Value == null ? "-" : Content.Value.GetType().FullName; 97 dataTypeTextBox.Enabled = Content.Value != null; 98 setValueButton.Enabled = Content.Value == null; 99 clearValueButton.Enabled = Content.Value != null; 100 100 valueGroupBox.Enabled = true; 101 viewHost. Object = Variable.Value;101 viewHost.Content = Content.Value; 102 102 } 103 103 } 104 104 105 protected virtual void Variable_ValueChanged(object sender, EventArgs e) {105 protected virtual void Content_ValueChanged(object sender, EventArgs e) { 106 106 if (InvokeRequired) 107 Invoke(new EventHandler( Variable_ValueChanged), sender, e);107 Invoke(new EventHandler(Content_ValueChanged), sender, e); 108 108 else { 109 dataTypeTextBox.Text = Variable.Value == null ? "-" : Variable.Value.GetType().FullName;110 dataTypeTextBox.Enabled = Variable.Value != null;111 setValueButton.Enabled = Variable.Value == null;112 clearValueButton.Enabled = Variable.Value != null;113 viewHost. Object = Variable.Value;109 dataTypeTextBox.Text = Content.Value == null ? "-" : Content.Value.GetType().FullName; 110 dataTypeTextBox.Enabled = Content.Value != null; 111 setValueButton.Enabled = Content.Value == null; 112 clearValueButton.Enabled = Content.Value != null; 113 viewHost.Content = Content.Value; 114 114 } 115 115 } … … 122 122 } 123 123 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 124 Variable.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();124 Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 125 125 } 126 126 } 127 127 protected virtual void clearValueButton_Click(object sender, EventArgs e) { 128 Variable.Value = null;128 Content.Value = null; 129 129 } 130 130 protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) { … … 143 143 IItem item = e.Data.GetData("Value") as IItem; 144 144 if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) item = (IItem)item.Clone(); 145 Variable.Value = item;145 Content.Value = item; 146 146 } 147 147 }
Note: See TracChangeset
for help on using the changeset viewer.