Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/15 10:44:35 (10 years ago)
Author:
pfleck
Message:

#2379 Added tree view component in RecursiveDataItemView. Removed RecursiveDataItemListView view because tree view is moved to RecursiveDataItemView.

Location:
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/HeuristicLab.Optimization.BubbleChart-3.3.csproj

    r12379 r12381  
    8484  </ItemGroup>
    8585  <ItemGroup>
    86     <Compile Include="RecursiveDataItemListView.cs">
    87       <SubType>UserControl</SubType>
    88     </Compile>
    89     <Compile Include="RecursiveDataItemListView.Designer.cs">
    90       <DependentUpon>RecursiveDataItemListView.cs</DependentUpon>
    91     </Compile>
    9286    <Compile Include="RecursiveDataItemView.cs">
    9387      <SubType>UserControl</SubType>
  • branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/RecursiveDataItemView.Designer.cs

    r12379 r12381  
    4848      this.listView = new System.Windows.Forms.ListView();
    4949      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     50      this.nameColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     51      this.valueColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     52      this.dataGroupBox = new System.Windows.Forms.GroupBox();
     53      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
     54      this.dataChildrenSplitContainer = new System.Windows.Forms.SplitContainer();
     55      this.treeView = new System.Windows.Forms.TreeView();
    5056      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5157      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
     
    5359      this.splitContainer.Panel2.SuspendLayout();
    5460      this.splitContainer.SuspendLayout();
     61      this.dataGroupBox.SuspendLayout();
     62      this.detailsGroupBox.SuspendLayout();
     63      ((System.ComponentModel.ISupportInitialize)(this.dataChildrenSplitContainer)).BeginInit();
     64      this.dataChildrenSplitContainer.Panel1.SuspendLayout();
     65      this.dataChildrenSplitContainer.Panel2.SuspendLayout();
     66      this.dataChildrenSplitContainer.SuspendLayout();
    5567      this.SuspendLayout();
    5668      //
     
    5971      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    6072      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     73      this.nameTextBox.Size = new System.Drawing.Size(459, 20);
     74      //
     75      // infoLabel
     76      //
     77      this.infoLabel.Location = new System.Drawing.Point(523, 3);
    6178      //
    6279      // splitContainer
    6380      //
    64       this.splitContainer.Location = new System.Drawing.Point(3, 26);
     81      this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     82      this.splitContainer.Location = new System.Drawing.Point(3, 16);
    6583      this.splitContainer.Name = "splitContainer";
    6684      //
    6785      // splitContainer.Panel1
    6886      //
    69       this.splitContainer.Panel1.Controls.Add(this.listView);
     87      this.splitContainer.Panel1.Controls.Add(this.dataChildrenSplitContainer);
    7088      //
    7189      // splitContainer.Panel2
    7290      //
    73       this.splitContainer.Panel2.Controls.Add(this.viewHost);
    74       this.splitContainer.Size = new System.Drawing.Size(345, 261);
    75       this.splitContainer.SplitterDistance = 115;
     91      this.splitContainer.Panel2.Controls.Add(this.detailsGroupBox);
     92      this.splitContainer.Size = new System.Drawing.Size(527, 297);
     93      this.splitContainer.SplitterDistance = 170;
    7694      this.splitContainer.TabIndex = 3;
    7795      //
    7896      // listView
    7997      //
    80       this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
    81       this.listView.Location = new System.Drawing.Point(0, 0);
     98      this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     99            | System.Windows.Forms.AnchorStyles.Left)
     100            | System.Windows.Forms.AnchorStyles.Right)));
     101      this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     102            this.nameColumnHeader,
     103            this.valueColumnHeader});
     104      this.listView.FullRowSelect = true;
     105      this.listView.HideSelection = false;
     106      this.listView.Location = new System.Drawing.Point(3, 3);
    82107      this.listView.MultiSelect = false;
    83108      this.listView.Name = "listView";
    84       this.listView.Size = new System.Drawing.Size(115, 261);
     109      this.listView.Size = new System.Drawing.Size(160, 185);
     110      this.listView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    85111      this.listView.TabIndex = 0;
    86112      this.listView.UseCompatibleStateImageBehavior = false;
     113      this.listView.View = System.Windows.Forms.View.Details;
    87114      this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
    88115      //
    89116      // viewHost
    90117      //
     118      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     119            | System.Windows.Forms.AnchorStyles.Left)
     120            | System.Windows.Forms.AnchorStyles.Right)));
    91121      this.viewHost.Caption = "View";
    92122      this.viewHost.Content = null;
    93       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    94123      this.viewHost.Enabled = false;
    95       this.viewHost.Location = new System.Drawing.Point(0, 0);
     124      this.viewHost.Location = new System.Drawing.Point(6, 19);
    96125      this.viewHost.Name = "viewHost";
    97126      this.viewHost.ReadOnly = false;
    98       this.viewHost.Size = new System.Drawing.Size(226, 261);
     127      this.viewHost.Size = new System.Drawing.Size(334, 265);
    99128      this.viewHost.TabIndex = 0;
    100129      this.viewHost.ViewsLabelVisible = true;
    101130      this.viewHost.ViewType = null;
    102131      //
     132      // nameColumnHeader
     133      //
     134      this.nameColumnHeader.Text = "Name";
     135      //
     136      // valueColumnHeader
     137      //
     138      this.valueColumnHeader.Text = "Value";
     139      //
     140      // dataGroupBox
     141      //
     142      this.dataGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     143            | System.Windows.Forms.AnchorStyles.Left)
     144            | System.Windows.Forms.AnchorStyles.Right)));
     145      this.dataGroupBox.Controls.Add(this.splitContainer);
     146      this.dataGroupBox.Location = new System.Drawing.Point(6, 26);
     147      this.dataGroupBox.Name = "dataGroupBox";
     148      this.dataGroupBox.Size = new System.Drawing.Size(533, 316);
     149      this.dataGroupBox.TabIndex = 4;
     150      this.dataGroupBox.TabStop = false;
     151      this.dataGroupBox.Text = "Data && Children";
     152      //
     153      // detailsGroupBox
     154      //
     155      this.detailsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     156            | System.Windows.Forms.AnchorStyles.Left)
     157            | System.Windows.Forms.AnchorStyles.Right)));
     158      this.detailsGroupBox.Controls.Add(this.viewHost);
     159      this.detailsGroupBox.Location = new System.Drawing.Point(4, 4);
     160      this.detailsGroupBox.Name = "detailsGroupBox";
     161      this.detailsGroupBox.Size = new System.Drawing.Size(346, 290);
     162      this.detailsGroupBox.TabIndex = 1;
     163      this.detailsGroupBox.TabStop = false;
     164      this.detailsGroupBox.Text = "Details";
     165      //
     166      // dataChildrenSplitContainer
     167      //
     168      this.dataChildrenSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     169            | System.Windows.Forms.AnchorStyles.Left)
     170            | System.Windows.Forms.AnchorStyles.Right)));
     171      this.dataChildrenSplitContainer.Location = new System.Drawing.Point(4, 4);
     172      this.dataChildrenSplitContainer.Name = "dataChildrenSplitContainer";
     173      this.dataChildrenSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
     174      //
     175      // dataChildrenSplitContainer.Panel1
     176      //
     177      this.dataChildrenSplitContainer.Panel1.Controls.Add(this.listView);
     178      //
     179      // dataChildrenSplitContainer.Panel2
     180      //
     181      this.dataChildrenSplitContainer.Panel2.Controls.Add(this.treeView);
     182      this.dataChildrenSplitContainer.Size = new System.Drawing.Size(168, 290);
     183      this.dataChildrenSplitContainer.SplitterDistance = 191;
     184      this.dataChildrenSplitContainer.TabIndex = 1;
     185      //
     186      // treeView
     187      //
     188      this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     189            | System.Windows.Forms.AnchorStyles.Left)
     190            | System.Windows.Forms.AnchorStyles.Right)));
     191      this.treeView.Location = new System.Drawing.Point(3, 3);
     192      this.treeView.Name = "treeView";
     193      this.treeView.Size = new System.Drawing.Size(160, 89);
     194      this.treeView.TabIndex = 0;
     195      this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
     196      //
    103197      // RecursiveDataItemView
    104198      //
    105199      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    106200      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    107       this.Controls.Add(this.splitContainer);
     201      this.Controls.Add(this.dataGroupBox);
    108202      this.Name = "RecursiveDataItemView";
    109       this.Size = new System.Drawing.Size(351, 290);
     203      this.Size = new System.Drawing.Size(542, 345);
    110204      this.Controls.SetChildIndex(this.nameLabel, 0);
    111205      this.Controls.SetChildIndex(this.nameTextBox, 0);
    112206      this.Controls.SetChildIndex(this.infoLabel, 0);
    113       this.Controls.SetChildIndex(this.splitContainer, 0);
     207      this.Controls.SetChildIndex(this.dataGroupBox, 0);
    114208      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    115209      this.splitContainer.Panel1.ResumeLayout(false);
     
    117211      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    118212      this.splitContainer.ResumeLayout(false);
     213      this.dataGroupBox.ResumeLayout(false);
     214      this.detailsGroupBox.ResumeLayout(false);
     215      this.dataChildrenSplitContainer.Panel1.ResumeLayout(false);
     216      this.dataChildrenSplitContainer.Panel2.ResumeLayout(false);
     217      ((System.ComponentModel.ISupportInitialize)(this.dataChildrenSplitContainer)).EndInit();
     218      this.dataChildrenSplitContainer.ResumeLayout(false);
    119219      this.ResumeLayout(false);
    120220      this.PerformLayout();
     
    127227    private System.Windows.Forms.ListView listView;
    128228    private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     229    private System.Windows.Forms.ColumnHeader nameColumnHeader;
     230    private System.Windows.Forms.ColumnHeader valueColumnHeader;
     231    private System.Windows.Forms.GroupBox detailsGroupBox;
     232    private System.Windows.Forms.GroupBox dataGroupBox;
     233    private System.Windows.Forms.SplitContainer dataChildrenSplitContainer;
     234    private System.Windows.Forms.TreeView treeView;
    129235  }
    130236}
  • branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/RecursiveDataItemView.cs

    r12379 r12381  
    2828namespace HeuristicLab.Optimization.BubbleChart {
    2929  [View("RecursiveDataItem View")]
    30   [Content(typeof(RecursiveDataItem))]
     30  [Content(typeof(RecursiveDataItem), true)]
    3131  public partial class RecursiveDataItemView : NamedItemView {
    3232
     
    4141
    4242    protected override void OnContentChanged() {
    43       listView.Clear();
     43      base.OnContentChanged();
     44
     45      listView.Items.Clear();
     46      treeView.Nodes.Clear();
    4447      viewHost.Content = null;
    4548
     
    4750        foreach (var data in Content.Data) {
    4851          listView.Items.Add(CreateListViewItem(data));
     52        }
     53        for (int i = 0; i < listView.Columns.Count; i++)
     54          listView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     55        foreach (var dataItem in Content.Children) {
     56          treeView.Nodes.Add(CreateTreeNode(dataItem));
    4957        }
    5058      }
     
    5664
    5765    private ListViewItem CreateListViewItem(KeyValuePair<string, IItem> data) {
    58       return new ListViewItem(data.Key) {
     66      return new ListViewItem(new[] { data.Key, data.Value != null ? data.Value.ToString() : "-" }) {
    5967        Tag = data.Value
    6068      };
     69    }
     70    private TreeNode CreateTreeNode(RecursiveDataItem dataItem) {
     71      var node = new TreeNode(dataItem.Name) {
     72        Tag = dataItem
     73      };
     74      foreach (var child in dataItem.Children) {
     75        node.Nodes.Add(CreateTreeNode(child));
     76      }
     77      return node;
    6178    }
    6279
     
    6986      }
    7087    }
     88    private void treeView_AfterSelect(object sender, TreeViewEventArgs e) {
     89      var dataItem = (RecursiveDataItem)e.Node.Tag;
     90      viewHost.Content = dataItem;
     91    }
    7192  }
    7293}
Note: See TracChangeset for help on using the changeset viewer.