Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4841


Ignore:
Timestamp:
11/18/10 21:01:20 (14 years ago)
Author:
swinkler
Message:

Simplified management of formatters in view for display of symbolic expression trees as strings. (#1270)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.Extensions/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs

    r4840 r4841  
    3030  [Content(typeof(SymbolicExpressionTree), false)]
    3131  public partial class SymbolicExpressionView : AsynchronousContentView {
    32     private ISymbolicExpressionTreeStringFormatter treeFormatter;
     32
    3333    List<ISymbolicExpressionTreeStringFormatter> treeFormattersList = new List<ISymbolicExpressionTreeStringFormatter>();
    3434
     
    4747        if (formatters.Current is SymbolicExpressionTreeStringFormatter)
    4848          selectedIndex = treeFormattersList.Count;
    49         treeFormattersList.Add(formatters.Current.Clone() as ISymbolicExpressionTreeStringFormatter);
    50         formattersComboBox.Items.Add(treeFormattersList[treeFormattersList.Count - 1].Name);
     49        ISymbolicExpressionTreeStringFormatter formatter = formatters.Current.Clone() as ISymbolicExpressionTreeStringFormatter;
     50        treeFormattersList.Add(formatter);
     51        formattersComboBox.Items.Add(formatter.Name);
    5152        formatters.MoveNext();
    5253      }
    5354      formattersComboBox.SelectedIndex = selectedIndex;
    54       //treeFormatter = new SymbolicExpressionTreeStringFormatter();
    5555    }
    5656
     
    6060        textBox.Text = string.Empty;
    6161      else
    62         textBox.Text = treeFormatter.Format(Content);
     62        textBox.Text = treeFormattersList[formattersComboBox.SelectedIndex].Format(Content);
    6363    }
    6464
     
    7070
    7171    private void formattersComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    72       treeFormatter = treeFormattersList[formattersComboBox.SelectedIndex];
    7372      OnContentChanged();
    7473    }
Note: See TracChangeset for help on using the changeset viewer.