Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11412


Ignore:
Timestamp:
10/03/14 02:20:19 (10 years ago)
Author:
swagner
Message:

#2205: Worked on optimization networks

Location:
branches/OptimizationNetworks
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/AlgorithmNodeView.cs

    r11409 r11412  
    2727
    2828namespace HeuristicLab.Optimization.Networks.Views {
    29   [View("Algorithm Node View")]
     29  [View("AlgorithmNode View")]
    3030  [Content(typeof(AlgorithmNode), true)]
    3131  [Content(typeof(IAlgorithmNode), false)]
     
    7373    protected override void SetEnabledStateOfControls() {
    7474      base.SetEnabledStateOfControls();
    75       portCollectionView.Enabled = Content != null;
     75      portCollectionView.Enabled = Content != null && !ReadOnly;
    7676      setAlgorithmButton.Enabled = Content != null && !ReadOnly;
    7777      clearAlgorithmButton.Enabled = Content != null && Content.Algorithm != null && !ReadOnly;
     
    116116        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
    117117      }
    118 
    119118    }
    120119    protected virtual void algorithmPanel_DragDrop(object sender, DragEventArgs e) {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/HeuristicLab.Optimization.Networks.Views-3.3.csproj

    r11409 r11412  
    4949  </ItemGroup>
    5050  <ItemGroup>
     51    <Compile Include="VariablesNodeView.cs">
     52      <SubType>UserControl</SubType>
     53    </Compile>
     54    <Compile Include="VariablesNodeView.Designer.cs">
     55      <DependentUpon>VariablesNodeView.cs</DependentUpon>
     56    </Compile>
    5157    <Compile Include="AlgorithmNodeView.cs">
    5258      <SubType>UserControl</SubType>
     
    5460    <Compile Include="AlgorithmNodeView.Designer.cs">
    5561      <DependentUpon>AlgorithmNodeView.cs</DependentUpon>
     62    </Compile>
     63    <Compile Include="InputPortView.cs">
     64      <SubType>UserControl</SubType>
     65    </Compile>
     66    <Compile Include="InputPortView.Designer.cs">
     67      <DependentUpon>InputPortView.cs</DependentUpon>
    5668    </Compile>
    5769    <Compile Include="PortView.cs">
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/PortView.Designer.cs

    r11409 r11412  
    2121
    2222namespace HeuristicLab.Optimization.Networks.Views {
    23   partial class PortView<T> {
     23  partial class PortView {
    2424    /// <summary>
    2525    /// Required designer variable.
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/PortView.cs

    r11409 r11412  
    2020#endregion
    2121
    22 using HeuristicLab.Core;
     22using HeuristicLab.Common;
    2323using HeuristicLab.Core.Views;
    2424using HeuristicLab.MainForm;
     
    3030  [Content(typeof(Port<>), true)]
    3131  [Content(typeof(IPort<>), false)]
    32   public partial class PortView<T> : NamedItemView where T : class, IItem {
    33     public new IPort<T> Content {
    34       get { return (IPort<T>)base.Content; }
     32  [Content(typeof(IPort), false)]
     33  public partial class PortView : NamedItemView {
     34    public new IPort Content {
     35      get { return (IPort)base.Content; }
    3536      set { base.Content = value; }
    3637    }
     
    5657      } else {
    5758        valueViewHost.ViewType = null;
    58         valueViewHost.Content = Content.Value;
     59        valueViewHost.Content = Content.Value as IContent;
    5960      }
    6061    }
     
    6263    protected override void SetEnabledStateOfControls() {
    6364      base.SetEnabledStateOfControls();
    64       valueGroupBox.Enabled = Content != null;
     65      valueGroupBox.Enabled = (Content as IContent) != null;
    6566    }
    6667    protected virtual void Content_ValueChanged(object sender, System.EventArgs e) {
     
    6970      else {
    7071        valueViewHost.ViewType = null;
    71         valueViewHost.Content = Content.Value;
     72        valueViewHost.Content = Content.Value as IContent;
    7273
    7374      }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/AlgorithmNode.cs

    r11409 r11412  
    8383        if (algorithm.Parameters.TryGetValue(port.Name, out param)) {
    8484          IValueParameter p = param as IValueParameter;
    85           if (p != null) {
     85          if ((p != null) && (port.Value != null)) {
    8686            p.Value = (IItem)port.Value;
    8787          }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj

    r11406 r11412  
    4848  </ItemGroup>
    4949  <ItemGroup>
     50    <Compile Include="IVariablesNode.cs" />
     51    <Compile Include="VariablesNode.cs" />
    5052    <Compile Include="EventArgs.cs" />
    5153    <Compile Include="IInputOutputPort.cs" />
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IInputOutputPort.cs

    r11406 r11412  
    2626  public interface IInputOutputPort : IPort {
    2727    IOutputInputPort OutputInputPort { get; }
     28
     29    event EventHandler OutputInputPortChanged;
    2830  }
    2931
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IInputPort.cs

    r11401 r11412  
    2020#endregion
    2121
     22using HeuristicLab.Core;
    2223using System;
    23 using HeuristicLab.Core;
    2424
    2525namespace HeuristicLab.Optimization.Networks {
    2626  public interface IInputPort : IPort {
    27     IOutputPort OutputPort { get; }
     27    IOutputPort OutputPort { get; set; }
     28
     29    event EventHandler OutputPortChanged;
    2830  }
    2931
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/InputOutputPort.cs

    r11406 r11412  
    8282
    8383    protected void RegisterOutputInputPortEvents() {
    84       outputInputPort.ValueSent += OutputInputPort_ValueSent;
     84      if (outputInputPort != null) {
     85        outputInputPort.ValueSent += OutputInputPort_ValueSent;
     86      }
    8587    }
    8688    protected void DeregisterOutputInputPortEvents() {
    87       outputInputPort.ValueSent -= OutputInputPort_ValueSent;
     89      if (outputInputPort != null) {
     90        outputInputPort.ValueSent -= OutputInputPort_ValueSent;
     91      }
    8892    }
    8993    protected void OutputInputPort_ValueSent(object sender, OutputInputPortEventArgs<TIn, TOut> e) {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/InputPort.cs

    r11409 r11412  
    4949    IOutputPort IInputPort.OutputPort {
    5050      get { return outputPort; }
     51      set {
     52        var val = value as IOutputPort<T>;
     53        if ((value != null) && (val == null))
     54          throw new InvalidOperationException(
     55            string.Format("Type mismatch. OutputPort is not a \"{0}\".",
     56                          typeof(IOutputPort<T>).GetPrettyName())
     57          );
     58        OutputPort = val;
     59      }
    5160    }
    5261
     
    7786
    7887    protected void RegisterOutputPortEvents() {
    79       outputPort.ValueChanged += OutputPort_ValueChanged;
    80      
     88      if (outputPort != null) {
     89        outputPort.ValueChanged += OutputPort_ValueChanged;
     90      }
    8191    }
    8292    protected void DeregisterOutputPortEvents() {
    83       outputPort.ValueChanged -= OutputPort_ValueChanged;
     93      if (outputPort != null) {
     94        outputPort.ValueChanged -= OutputPort_ValueChanged;
     95      }
    8496    }
    8597    protected void OutputPort_ValueChanged(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.