Changeset 2727


Ignore:
Timestamp:
01/30/10 05:05:19 (10 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on content definitions of views
  • corrected bug in cloning of CombinedOperator
Location:
trunk/sources
Files:
28 edited

Legend:

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

    r2713 r2727  
    3636  /// </summary>
    3737  [Content(typeof(Engine), true)]
     38  [Content(typeof(IEngine), false)]
    3839  public partial class EngineView : ItemView {
    3940    private int executionTimeCounter;
     
    4344    /// </summary>
    4445    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="EditorBase"/>.</remarks>
    45     public new Engine Content {
    46       get { return (Engine)base.Content; }
     46    public new IEngine Content {
     47      get { return (IEngine)base.Content; }
    4748      set { base.Content = value; }
    4849    }
     
    5455      InitializeComponent();
    5556    }
    56     public EngineView(Engine engine)
     57    public EngineView(IEngine content)
    5758      : this() {
    58       Content = engine;
     59      Content = content;
    5960    }
    6061
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r2713 r2727  
    3333
    3434namespace HeuristicLab.Core.Views {
     35  [Content(typeof(ItemCollection<>), true)]
     36  [Content(typeof(IObservableCollection<>), false)]
    3537  public partial class ItemCollectionView<T> : ContentView where T : class, IItem {
    3638    public new IObservableCollection<T> Content {
     
    4648      InitializeComponent();
    4749      Caption = "Item Collection";
     50    }
     51    public ItemCollectionView(IObservableCollection<T> content)
     52      : this() {
     53      Content = content;
    4854    }
    4955
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r2713 r2727  
    3636  /// The visual representation of all variables in a specified scope.
    3737  /// </summary>
     38  [Content(typeof(ItemList<>), true)]
     39  [Content(typeof(IObservableList<>), false)]
    3840  public partial class ItemListView<T> : ContentView where T : class, IItem {
    3941    /// <summary>
     
    5759      InitializeComponent();
    5860      Caption = "Item List";
     61    }
     62    public ItemListView(IObservableList<T> content)
     63      : this() {
     64      Content = content;
    5965    }
    6066
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemSetView.cs

    r2713 r2727  
    3232
    3333namespace HeuristicLab.Core.Views {
     34  [Content(typeof(ItemSet<>), true)]
     35  [Content(typeof(IObservableSet<>), false)]
    3436  public partial class ItemSetView<T> : ItemCollectionView<T> where T : class, IItem {
    3537    public new IObservableSet<T> Content {
     
    4749      InitializeComponent();
    4850      Caption = "Item Set";
     51    }
     52    public ItemSetView(IObservableSet<T> content)
     53      : this() {
     54      Content = content;
    4955    }
    5056
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemView.cs

    r2713 r2727  
    2828using System.Xml;
    2929using System.Windows.Forms;
     30using HeuristicLab.MainForm;
    3031using HeuristicLab.MainForm.WindowsForms;
    3132
     
    3435  /// Base class for all visual representations.
    3536  /// </summary>
     37  [Content(typeof(Item), false)]
     38  [Content(typeof(IItem), false)]
    3639  public partial class ItemView : ContentView {
    3740    public new IItem Content {
     
    4649      InitializeComponent();
    4750      Caption = "View";
     51    }
     52    public ItemView(IItem content)
     53      : this() {
     54      Content = content;
    4855    }
    4956
  • trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemCollectionView.cs

    r2713 r2727  
    3232
    3333namespace HeuristicLab.Core.Views {
     34  [Content(typeof(NamedItemCollection<>), true)]
    3435  public partial class NamedItemCollectionView<T> : ItemCollectionView<T> where T : class, INamedItem {
    3536    public new IObservableKeyedCollection<string, T> Content {
     
    4748      InitializeComponent();
    4849      Caption = "Named Item Collection";
     50    }
     51    public NamedItemCollectionView(IObservableKeyedCollection<string, T> content)
     52      : this() {
     53      Content = content;
    4954    }
    5055
  • trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs

    r2713 r2727  
    3434  /// </summary>
    3535  [Content(typeof(NamedItem), true)]
     36  [Content(typeof(INamedItem), false)]
    3637  public partial class NamedItemView : ItemView {
    37     public new NamedItem Content {
    38       get { return (NamedItem)base.Content; }
     38    public new INamedItem Content {
     39      get { return (INamedItem)base.Content; }
    3940      set { base.Content = value; }
    4041    }
     
    4647      errorProvider.SetIconPadding(nameTextBox, 2);
    4748    }
    48     public NamedItemView(NamedItem namedItem)
     49    public NamedItemView(INamedItem content)
    4950      : this() {
    50       Content = namedItem;
     51      Content = content;
    5152    }
    5253
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorCollectionView.cs

    r2713 r2727  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(OperatorCollection), true)]
    14   [Content(typeof(IObservableCollection<IOperator>), true)]
     14  [Content(typeof(IObservableCollection<IOperator>), false)]
    1515  public partial class OperatorCollectionView : ItemCollectionView<IOperator> {
    1616    protected TypeSelectorDialog typeSelectorDialog;
     
    3030    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    3131    /// <param name="scope">The scope whose variables should be represented visually.</param>
    32     public OperatorCollectionView(IObservableCollection<IOperator> operatorCollection)
     32    public OperatorCollectionView(IObservableCollection<IOperator> content)
    3333      : this() {
    34       Content = operatorCollection;
     34      Content = content;
    3535    }
    3636
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorGraphView.cs

    r2713 r2727  
    6161    /// <remarks>Calls <see cref="OperatorGraphView()"/>.</remarks>
    6262    /// <param name="operatorGraph">The operator graph to represent visually.</param>
    63     public OperatorGraphView(OperatorGraph operatorGraph)
     63    public OperatorGraphView(OperatorGraph content)
    6464      : this() {
    65       Content = operatorGraph;
     65      Content = content;
    6666    }
    6767
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorListView.cs

    r2713 r2727  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(OperatorList), true)]
    14   [Content(typeof(IObservableList<IOperator>), true)]
     14  [Content(typeof(IObservableList<IOperator>), false)]
    1515  public partial class OperatorListView : ItemListView<IOperator> {
    1616    protected TypeSelectorDialog typeSelectorDialog;
     
    3030    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    3131    /// <param name="scope">The scope whose variables should be represented visually.</param>
    32     public OperatorListView(IObservableList<IOperator> operatorList)
     32    public OperatorListView(IObservableList<IOperator> content)
    3333      : this() {
    34       Content = operatorList;
     34      Content = content;
    3535    }
    3636
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorSetView.cs

    r2713 r2727  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(OperatorSet), true)]
    14   [Content(typeof(IObservableSet<IOperator>), true)]
     14  [Content(typeof(IObservableSet<IOperator>), false)]
    1515  public partial class OperatorSetView : ItemSetView<IOperator> {
    1616    protected TypeSelectorDialog typeSelectorDialog;
     
    3030    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    3131    /// <param name="scope">The scope whose variables should be represented visually.</param>
    32     public OperatorSetView(IObservableSet<IOperator> operatorSet)
     32    public OperatorSetView(IObservableSet<IOperator> content)
    3333      : this() {
    34       Content = operatorSet;
     34      Content = content;
    3535    }
    3636
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorTreeView.cs

    r2713 r2727  
    6969    /// <remarks>Calls <see cref="OperatorGraphView()"/>.</remarks>
    7070    /// <param name="operatorGraph">The operator graph to represent visually.</param>
    71     public OperatorTreeView(IOperator op)
     71    public OperatorTreeView(IOperator content)
    7272      : this() {
    73       Content = op;
     73      Content = content;
    7474    }
    7575
  • trunk/sources/HeuristicLab.Core.Views/3.3/ParameterCollectionView.cs

    r2713 r2727  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(ParameterCollection), true)]
    14   [Content(typeof(IObservableKeyedCollection<string, IParameter>), true)]
     14  [Content(typeof(IObservableKeyedCollection<string, IParameter>), false)]
    1515  public partial class ParameterCollectionView : NamedItemCollectionView<IParameter> {
    1616    protected CreateParameterDialog createParameterDialog;
     
    2929    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    3030    /// <param name="scope">The scope whose variables should be represented visually.</param>
    31     public ParameterCollectionView(IObservableKeyedCollection<string, IParameter> parameterCollection)
     31    public ParameterCollectionView(IObservableKeyedCollection<string, IParameter> content)
    3232      : this() {
    33       Content = parameterCollection;
     33      Content = content;
    3434    }
    3535
  • trunk/sources/HeuristicLab.Core.Views/3.3/ScopeListView.cs

    r2713 r2727  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(ScopeList), true)]
    14   [Content(typeof(IObservableList<IScope>), true)]
     14  [Content(typeof(IObservableList<IScope>), false)]
    1515  public partial class ScopeListView : ItemListView<IScope> {
    1616    /// <summary>
     
    2828    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    2929    /// <param name="scope">The scope whose variables should be represented visually.</param>
    30     public ScopeListView(IObservableList<IScope> scopeList)
     30    public ScopeListView(IObservableList<IScope> content)
    3131      : this() {
    32       Content = scopeList;
     32      Content = content;
    3333    }
    3434  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs

    r2713 r2727  
    3737  /// </summary>
    3838  [Content(typeof(Scope), true)]
     39  [Content(typeof(IScope), false)]
    3940  public sealed partial class ScopeView : ItemView {
    4041    private Dictionary<IScope, TreeNode> scopeNodeTable;
     
    6768    /// <remarks>Calls <see cref="ScopeView()"/>.</remarks>
    6869    /// <param name="scope">The scope to represent visually.</param>
    69     public ScopeView(IScope scope)
     70    public ScopeView(IScope content)
    7071      : this() {
    71       Content = scope;
     72      Content = content;
    7273    }
    7374
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableCollectionView.cs

    r2713 r2727  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(VariableCollection), true)]
    14   [Content(typeof(IObservableKeyedCollection<string, IVariable>), true)]
     14  [Content(typeof(IObservableKeyedCollection<string, IVariable>), false)]
    1515  public partial class VariableCollectionView : NamedItemCollectionView<IVariable> {
    1616    /// <summary>
     
    2828    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    2929    /// <param name="scope">The scope whose variables should be represented visually.</param>
    30     public VariableCollectionView(IObservableKeyedCollection<string, IVariable> variableCollection)
     30    public VariableCollectionView(IObservableKeyedCollection<string, IVariable> content)
    3131      : this() {
    32       Content = variableCollection;
     32      Content = content;
    3333    }
    3434
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs

    r2713 r2727  
    3434  /// </summary>
    3535  [Content(typeof(Variable), true)]
     36  [Content(typeof(IVariable), false)]
    3637  public partial class VariableView : NamedItemView {
    3738    protected TypeSelectorDialog typeSelectorDialog;
     
    4243    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
    4344    /// No own data storage present.</remarks>
    44     public new Variable Content {
    45       get { return (Variable)base.Content; }
     45    public new IVariable Content {
     46      get { return (IVariable)base.Content; }
    4647      set { base.Content = value; }
    4748    }
     
    5960    /// <remarks>Calls <see cref="VariableView()"/>.</remarks>
    6061    /// <param name="variable">The variable to represent visually.</param>
    61     public VariableView(Variable variable)
     62    public VariableView(IVariable content)
    6263      : this() {
    63       Content = variable;
     64      Content = content;
    6465    }
    6566
  • trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.cs

    r2713 r2727  
    8585
    8686        Control view = (Control)MainFormManager.CreateDefaultView(Content);
     87        if ((view == null) && (contextMenuStrip.Items.Count > 0))  // create first available view if default view is not available
     88          view = (Control)MainFormManager.CreateView((Type)contextMenuStrip.Items[0].Tag, Content);
    8789        if (view != null) {
    8890          viewPanel.Controls.Add(view);
  • trunk/sources/HeuristicLab.Data.Views/3.3/BoolDataView.cs

    r2713 r2727  
    4343      Caption = "BoolData View";
    4444    }
    45     public BoolDataView(BoolData boolData)
     45    public BoolDataView(BoolData content)
    4646      : this() {
    47       Content = boolData;
     47      Content = content;
    4848    }
    4949
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleDataView.cs

    r2713 r2727  
    4646      errorProvider.SetIconPadding(valueTextBox, 2);
    4747    }
    48     public StringConvertibleDataView(IStringConvertibleData stringConvertibleData)
     48    public StringConvertibleDataView(IStringConvertibleData content)
    4949      : this() {
    50       Content = stringConvertibleData;
     50      Content = content;
    5151    }
    5252
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixDataView.cs

    r2713 r2727  
    4949      errorProvider.SetIconPadding(columnsTextBox, 2);
    5050    }
    51     public StringConvertibleMatrixDataView(IStringConvertibleMatrixData stringConvertibleArrayData)
     51    public StringConvertibleMatrixDataView(IStringConvertibleMatrixData content)
    5252      : this() {
    53       Content = stringConvertibleArrayData;
     53      Content = content;
    5454    }
    5555
  • trunk/sources/HeuristicLab.Data/3.3/StringArrayData.cs

    r2694 r2727  
    3131namespace HeuristicLab.Data {
    3232  [Item("StringArrayData", "Represents an array of strings.")]
     33  [Creatable("Test")]
    3334  public sealed class StringArrayData : Item, IEnumerable, IStringConvertibleMatrixData {
    3435    [Storable]
  • trunk/sources/HeuristicLab.Data/3.3/StringMatrixData.cs

    r2694 r2727  
    3131namespace HeuristicLab.Data {
    3232  [Item("StringMatrixData", "Represents a matrix of strings.")]
     33  [Creatable("Test")]
    3334  public sealed class StringMatrixData : Item, IEnumerable, IStringConvertibleMatrixData {
    3435    [Storable]
  • trunk/sources/HeuristicLab.Operators.Views/3.3/CombinedOperatorView.cs

    r2713 r2727  
    5252    /// </summary>
    5353    /// <param name="item">The item that should be displayed.</param>
    54     public CombinedOperatorView(CombinedOperator combinedOperator)
     54    public CombinedOperatorView(CombinedOperator content)
    5555      : this() {
    56       Content = combinedOperator;
     56      Content = content;
    5757    }
    5858
  • trunk/sources/HeuristicLab.Operators.Views/3.3/OperatorView.cs

    r2713 r2727  
    3636  /// </summary>
    3737  [Content(typeof(Operator), true)]
     38  [Content(typeof(IOperator), false)]
    3839  public partial class OperatorView : NamedItemView {
    39     public new Operator Content {
    40       get { return (Operator)base.Content; }
     40    public new IOperator Content {
     41      get { return (IOperator)base.Content; }
    4142      set { base.Content = value; }
    4243    }
     
    5253    /// </summary>
    5354    /// <param name="item">The item that should be displayed.</param>
    54     public OperatorView(Operator op)
     55    public OperatorView(IOperator content)
    5556      : this() {
    56       Content = op;
     57      Content = content;
    5758    }
    5859
  • trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs

    r2684 r2727  
    6565      CombinedOperator clone = (CombinedOperator)base.Clone(cloner);
    6666      clone.operatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
    67       return base.Clone(cloner);
     67      return clone;
    6868    }
    6969
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ItemParameterView.cs

    r2715 r2727  
    6161    /// <remarks>Calls <see cref="VariableView()"/>.</remarks>
    6262    /// <param name="variable">The variable to represent visually.</param>
    63     public ItemParameterView(ItemParameter<T> parameter)
     63    public ItemParameterView(ItemParameter<T> content)
    6464      : this() {
    65       Content = parameter;
     65      Content = content;
    6666    }
    6767
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ParameterView.cs

    r2714 r2727  
    2727using System.Text;
    2828using System.Windows.Forms;
     29using HeuristicLab.Core;
    2930using HeuristicLab.Core.Views;
    3031using HeuristicLab.MainForm;
     
    3536  /// </summary>
    3637  [Content(typeof(Parameter), true)]
     38  [Content(typeof(IParameter), false)]
    3739  public partial class ParameterView : NamedItemView {
    3840    /// <summary>
     
    4143    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
    4244    /// No own data storage present.</remarks>
    43     public new Parameter Content {
    44       get { return (Parameter)base.Content; }
     45    public new IParameter Content {
     46      get { return (IParameter)base.Content; }
    4547      set { base.Content = value; }
    4648    }
     
    5860    /// <remarks>Calls <see cref="VariableView()"/>.</remarks>
    5961    /// <param name="variable">The variable to represent visually.</param>
    60     public ParameterView(Parameter parameter)
     62    public ParameterView(IParameter content)
    6163      : this() {
    62       Content = parameter;
     64      Content = content;
    6365    }
    6466
Note: See TracChangeset for help on using the changeset viewer.