Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/18/10 18:50:16 (13 years ago)
Author:
swinkler
Message:

Renamed solution in formatters branch; implemented view for display of symbolic expression trees as strings depending on the chosen formatter. (#1270)

File:
1 edited

Legend:

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

    r4803 r4840  
    2323using HeuristicLab.MainForm;
    2424using HeuristicLab.MainForm.WindowsForms;
     25using HeuristicLab.PluginInfrastructure;
     26using System.Collections.Generic;
    2527
    2628namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
     
    2830  [Content(typeof(SymbolicExpressionTree), false)]
    2931  public partial class SymbolicExpressionView : AsynchronousContentView {
    30     private SymbolicExpressionTreeStringFormatter treeFormatter;
     32    private ISymbolicExpressionTreeStringFormatter treeFormatter;
     33    List<ISymbolicExpressionTreeStringFormatter> treeFormattersList = new List<ISymbolicExpressionTreeStringFormatter>();
    3134
    3235    public new SymbolicExpressionTree Content {
     
    3740    public SymbolicExpressionView() {
    3841      InitializeComponent();
    39       treeFormatter = new SymbolicExpressionTreeStringFormatter();
     42      IEnumerator<ISymbolicExpressionTreeStringFormatter> formatters = ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeStringFormatter>().GetEnumerator();
     43      treeFormattersList = new List<ISymbolicExpressionTreeStringFormatter>();
     44      formatters.MoveNext();
     45      int selectedIndex = -1;
     46      while (formatters.Current != null) {
     47        if (formatters.Current is SymbolicExpressionTreeStringFormatter)
     48          selectedIndex = treeFormattersList.Count;
     49        treeFormattersList.Add(formatters.Current.Clone() as ISymbolicExpressionTreeStringFormatter);
     50        formattersComboBox.Items.Add(treeFormattersList[treeFormattersList.Count - 1].Name);
     51        formatters.MoveNext();
     52      }
     53      formattersComboBox.SelectedIndex = selectedIndex;
     54      //treeFormatter = new SymbolicExpressionTreeStringFormatter();
    4055    }
    4156
     
    5368      textBox.ReadOnly = ReadOnly;
    5469    }
     70
     71    private void formattersComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
     72      treeFormatter = treeFormattersList[formattersComboBox.SelectedIndex];
     73      OnContentChanged();
     74    }
    5575  }
    5676}
Note: See TracChangeset for help on using the changeset viewer.