Changeset 10106


Ignore:
Timestamp:
11/05/13 10:52:45 (6 years ago)
Author:
jkarder
Message:

#2116:

  • refactored outermost view host detection
  • fixed update logic of breadcrumb trail
  • fixed some views
Location:
branches/Breadcrumbs
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/Breadcrumbs/HeuristicLab.Clients.Access.Administration/3.3/Views/RoleView.cs

    r9456 r10106  
    4747
    4848    private void roleNameTextBox_TextChanged(object sender, System.EventArgs e) {
    49       if (Content.Name != roleNameTextBox.Text)
     49      if (Content != null && Content.Name != roleNameTextBox.Text)
    5050        Content.Name = roleNameTextBox.Text;
    5151    }
  • branches/Breadcrumbs/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.cs

    r9456 r10106  
    6969
    7070    private void groupNameTextBox_TextChanged(object sender, System.EventArgs e) {
    71       if (Content.Name != this.groupNameTextBox.Text)
     71      if (Content != null && Content.Name != this.groupNameTextBox.Text)
    7272        Content.Name = this.groupNameTextBox.Text;
    7373    }
  • branches/Breadcrumbs/HeuristicLab.Clients.Access.Administration/3.3/Views/UserView.cs

    r9456 r10106  
    7272
    7373    private void fullNameTextBox_TextChanged(object sender, System.EventArgs e) {
    74       if (Content.FullName != fullNameTextBox.Text)
     74      if (Content != null && Content.FullName != fullNameTextBox.Text)
    7575        Content.FullName = fullNameTextBox.Text;
    7676    }
    7777
    7878    private void userNameTextBox_TextChanged(object sender, System.EventArgs e) {
    79       if (Content.UserName != userNameTextBox.Text)
     79      if (Content != null && Content.UserName != userNameTextBox.Text)
    8080        Content.UserName = userNameTextBox.Text;
    8181    }
    8282
    8383    private void emailTextBox_TextChanged(object sender, System.EventArgs e) {
    84       if (Content.Email != emailTextBox.Text)
     84      if (Content != null && Content.Email != emailTextBox.Text)
    8585        Content.Email = emailTextBox.Text;
    8686    }
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemCollectionView.Designer.cs

    r10103 r10106  
    180180      this.viewHost.Caption = "View";
    181181      this.viewHost.Content = null;
    182       this.viewHost.IsValidOutermostViewhost = false;
    183182      this.viewHost.Location = new System.Drawing.Point(6, 19);
    184183      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemListView.Designer.cs

    r10103 r10106  
    193193      this.viewHost.Caption = "View";
    194194      this.viewHost.Content = null;
    195       this.viewHost.IsValidOutermostViewhost = false;
    196195      this.viewHost.Location = new System.Drawing.Point(6, 19);
    197196      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs

    r10103 r10106  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.ComponentModel;
    2524using System.Drawing;
    2625using System.Linq;
     
    4241      viewsLabel.Visible = false;
    4342      viewsLabelVisible = true;
    44       IsValidOutermostViewhost = true;
    4543
    4644      breadcrumbControl.ViewHost = this;
     
    6159
    6260    public bool HotlinkingEnabled { get; set; }
    63 
    64     [DefaultValue(true)]
    65     public bool IsValidOutermostViewhost { get; set; }
    6661
    6762    private IContentView cachedView;
     
    371366      if (!newCrumbs.Any()) return;
    372367      var ll = new LinkedList<IContent>();
    373       foreach (var c in oldCrumbs) {
    374         if (c != newCrumbs.First())
    375           ll.AddLast(c);
    376         else break;
     368      if (newCrumbs.Contains(oldCrumbs.LastOrDefault())) {
     369        foreach (var c in oldCrumbs) {
     370          if (c != newCrumbs.First())
     371            ll.AddLast(c);
     372          else break;
     373        }
    377374      }
    378375      foreach (var c in newCrumbs)
     
    382379
    383380    private void PerformOutermostViewHostDetection() {
    384       if (!IsValidOutermostViewhost) return;
    385       var mainForm = MainFormManager.GetMainForm<MainForm>();
    386       if (mainForm == null) return; // needed for designer
    387       var outermostViewHost = mainForm.GetOutermostControlOfType<ViewHost>(this);
    388       viewContextMenuStrip.ShowBreadcrumbsToolStripMenuItem.Checked = outermostViewHost == this;
     381      var parentContentViews = GetParentViewsOfType<ContentView>();
     382      viewContextMenuStrip.ShowBreadcrumbsToolStripMenuItem.Checked = !parentContentViews.Any();
    389383    }
    390384    #endregion
  • branches/Breadcrumbs/HeuristicLab.MainForm.WindowsForms/3.3/Views/View.cs

    r9920 r10106  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using System.Reflection;
     
    261262        ((Control)this).ResumeRepaint(refresh);
    262263    }
     264
     265    public IEnumerable<T> GetParentViewsOfType<T>() where T : View {
     266      for (var view = Parent; view != null; view = view.Parent)
     267        if (view is View) yield return view as T;
     268    }
    263269  }
    264270}
  • branches/Breadcrumbs/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.Designer.cs

    r10103 r10106  
    235235                  | System.Windows.Forms.AnchorStyles.Right)));
    236236      this.detailsViewHost.Content = null;
    237       this.detailsViewHost.IsValidOutermostViewhost = false;
    238237      this.detailsViewHost.Location = new System.Drawing.Point(3, 16);
    239238      this.detailsViewHost.Name = "detailsViewHost";
  • branches/Breadcrumbs/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.Designer.cs

    r10103 r10106  
    216216      this.viewHost.Caption = "View";
    217217      this.viewHost.Content = null;
    218       this.viewHost.IsValidOutermostViewhost = false;
    219218      this.viewHost.Location = new System.Drawing.Point(6, 19);
    220219      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.Optimization.Views/3.3/RunView.Designer.cs

    r10103 r10106  
    178178      this.viewHost.Content = null;
    179179      this.viewHost.Enabled = false;
    180       this.viewHost.IsValidOutermostViewhost = false;
    181180      this.viewHost.Location = new System.Drawing.Point(6, 19);
    182181      this.viewHost.Name = "viewHost";
Note: See TracChangeset for help on using the changeset viewer.