Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/10 12:37:59 (15 years ago)
Author:
mkommend
Message:

added parameters, corrected drag and drop position (ticket #867)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/OperatorShapeInfo.cs

    r2868 r2934  
    2828using Netron.Diagramming.Core;
    2929using System.Windows.Forms;
     30using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3031
    3132namespace HeuristicLab.Operators.Views.GraphVisualization {
    32   internal class OperatorShapeInfo : ShapeInfo {
     33  internal class OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo {
     34    [Storable]
     35    private List<string> connectorNames;
     36    [Storable]
     37    private List<string> labels;
    3338
    34     private List<string> connectorNames;
    3539    public OperatorShapeInfo()
    3640      : base(typeof(OperatorShape)) {
    3741      this.connectorNames = new List<string>();
     42      this.labels = new List<string>();
    3843    }
    3944
     
    4449    }
    4550
    46     public override void AddConnector(string connectorName) {
     51    public OperatorShapeInfo(IEnumerable<string> connectorNames, IEnumerable<string> labels)
     52      : this(connectorNames) {
     53      foreach (string label in labels)
     54        this.labels.Add(label);
     55    }
     56
     57    public void AddConnector(string connectorName) {
    4758      if (!this.connectorNames.Contains(connectorName) && connectorName != "Successor") {
    4859        this.connectorNames.Add(connectorName);
     
    5162    }
    5263
    53     public override void RemoveConnector(string connectorName) {
     64    public void RemoveConnector(string connectorName) {
    5465      if (this.connectorNames.Contains(connectorName)) {
    5566        this.connectorNames.Remove(connectorName);
     
    5869    }
    5970
     71    public void UpdateLabels(IEnumerable<string> labels) {
     72      this.labels = new List<string>(labels);
     73      this.OnChanged();
     74    }
     75
     76    [Storable]
     77    private bool collapsed;
     78    public bool Collapsed {
     79      get { return this.collapsed; }
     80      set {
     81        if (this.collapsed != value) {
     82          this.collapsed = value;
     83          this.OnChanged();
     84        }
     85      }
     86    }
     87
     88    [Storable]
    6089    private string title;
    6190    public string Title {
     
    6998    }
    7099
    71     private string text;
    72     public string Text {
    73       get { return this.text; }
     100    [Storable]
     101    private Color color;
     102    public Color Color {
     103      get { return this.color; }
    74104      set {
    75         if (this.text != value) {
    76           this.text = value;
     105        if (this.color != value) {
     106          this.color = value;
    77107          this.OnChanged();
    78108        }
     
    80110    }
    81111
    82     private Color headColor;
    83     public Color HeadColor {
    84       get { return this.headColor; }
     112    [Storable]
     113    private Bitmap icon;
     114    public Bitmap Icon {
     115      get { return this.icon; }
    85116      set {
    86         if (this.headColor != value) {
    87           this.headColor = value;
     117        if (this.icon != value) {
     118          this.icon = value;
    88119          this.OnChanged();
    89120        }
     
    94125      OperatorShape shape = (OperatorShape)base.CreateShape();
    95126      shape.Title = this.Title;
    96       shape.SubTitle = this.Text;
    97       shape.HeadColor = this.HeadColor;
     127      shape.Color = this.Color;
     128      shape.Icon = this.Icon;
     129      shape.Collapsed = this.Collapsed;
    98130      foreach (string connectorName in this.connectorNames)
    99131        shape.AddConnector(connectorName);
     132
     133      shape.UpdateLabels(this.labels);
    100134      return shape;
    101135    }
     
    104138      base.UpdateShape(shape);
    105139      OperatorShape operatorShape = shape as OperatorShape;
    106 
    107140      if (operatorShape != null) {
    108141        operatorShape.Title = this.Title;
    109         operatorShape.SubTitle = this.Text;
    110         operatorShape.HeadColor = this.HeadColor;
     142        operatorShape.Color = this.Color;
     143        operatorShape.Collapsed = this.Collapsed;
    111144
    112145        int i = 0;
     
    121154          j++;
    122155        }
    123         //remove old connectors
     156        //remove remaining old connectors
    124157        for (; j < oldConnectorNames.Count; j++)
    125158          operatorShape.RemoveConnector(oldConnectorNames[j]);
     
    128161        for (; i < this.connectorNames.Count; i++)
    129162          operatorShape.AddConnector(this.connectorNames[i]);
     163
     164        operatorShape.UpdateLabels(this.labels);
    130165      }
    131166    }
Note: See TracChangeset for help on using the changeset viewer.