Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/28/13 17:50:31 (9 years ago)
Author:
jkarder
Message:

#2116:

  • added hotlinking functionality
  • added methods for outermost view host detection and manipulation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ParameterCollectionView.cs

    r10087 r10089  
    147147      }
    148148    }
    149     protected override void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    150       base.itemsListView_SelectedIndexChanged(sender, e);
    151       SetEnabledStateOfControls();
     149    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
     150      removeButton.Enabled = Content != null && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
     151      AdjustListViewColumnSizes();
     152      if (itemsListView.SelectedItems.Count == 1) {
     153        var item = (IParameter)itemsListView.SelectedItems[0].Tag;
     154        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     155        var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
     156        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
     157          var oldCrumbs = outermostViewHost.Breadcrumbs;
     158          var newCrumbs = BuildBreadcrumbTrail();
     159          mainForm.ShowContentInSpecificViewHost(item, outermostViewHost);
     160          outermostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
     161          outermostViewHost.ActiveView.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
     162          outermostViewHost.ActiveView.Locked = Locked;
     163        } else {
     164          if (showDetailsCheckBox.Checked) {
     165            detailsGroupBox.Enabled = true;
     166            viewHost.Content = item;
     167          } else {
     168            viewHost.Content = null;
     169            detailsGroupBox.Enabled = false;
     170          }
     171        }
     172      }
    152173    }
    153174    protected override void itemsListView_DoubleClick(object sender, EventArgs e) {
    154175      if (itemsListView.SelectedItems.Count == 1) {
    155         var item = itemsListView.SelectedItems[0].Tag as IParameter;
    156         if (item != null) {
    157           ViewHost outmostViewHost = null;
    158           for (var control = Parent; control != null; control = control.Parent) {
    159             var vh = control as ViewHost;
    160             if (vh != null) outmostViewHost = vh;
    161           }
    162           if (outmostViewHost != null) {
    163             var oldCrumbs = outmostViewHost.Breadcrumbs;
    164             var newCrumbs = BuildBreadcrumbTrail();
    165             outmostViewHost.Content = null;
    166             var viewType = MainFormManager.GetDefaultViewType(item.GetType());
    167             outmostViewHost.ViewType = viewType;
    168             outmostViewHost.Content = item;
    169             outmostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
    170             outmostViewHost.ActiveView.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
    171             outmostViewHost.ActiveView.Locked = Locked;
    172           }
    173         }
     176        var item = (IParameter)itemsListView.SelectedItems[0].Tag;
     177        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     178        var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
     179        var oldCrumbs = outermostViewHost.Breadcrumbs;
     180        var newCrumbs = BuildBreadcrumbTrail();
     181        mainForm.ShowContentInSpecificViewHost(item, outermostViewHost);
     182        outermostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
     183        outermostViewHost.ActiveView.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
     184        outermostViewHost.ActiveView.Locked = Locked;
    174185      }
    175186    }
Note: See TracChangeset for help on using the changeset viewer.