Ejemplo n.º 1
0
        private void OnChildGroupAdded(object sender, ListEventArgs <FilteredGroup <IImageSet> > e)
        {
            ImageSetTreeGroupItem newGroupItem = new ImageSetTreeGroupItem(e.Item, this, _tree.Binding);

            _tree.Items.Add(newGroupItem);
            OnUpdated();
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Constructor that allows a custom binding to be supplied.
		/// </summary>
		/// <param name="imageSets"></param>
		/// <param name="primaryStudyInstanceUid"></param>
		/// <param name="binding"></param>
		public ImageSetTree(ObservableList<IImageSet> imageSets, string primaryStudyInstanceUid, ImageSetTreeItemBinding binding)
		{
			_primaryStudyInstanceUid = primaryStudyInstanceUid;
			_imageSetGroups = new ImageSetGroups(imageSets);
			_internalTree = new ImageSetTreeGroupItem(_imageSetGroups.Root, new StudyDateComparer(), binding);
			UpdateInternalTreeRoot();
			_internalTree.Updated += OnInternalTreeUpdated;
		}
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor that allows a custom binding to be supplied.
 /// </summary>
 /// <param name="imageSets"></param>
 /// <param name="primaryStudyInstanceUid"></param>
 /// <param name="binding"></param>
 public ImageSetTree(ObservableList <IImageSet> imageSets, string primaryStudyInstanceUid, ImageSetTreeItemBinding binding)
 {
     _primaryStudyInstanceUid = primaryStudyInstanceUid;
     _imageSetGroups          = new ImageSetGroups(imageSets);
     _internalTree            = new ImageSetTreeGroupItem(_imageSetGroups.Root, new StudyDateComparer(), binding);
     UpdateInternalTreeRoot();
     _internalTree.Updated += OnInternalTreeUpdated;
 }
Ejemplo n.º 4
0
        private void OnChildGroupRemoved(object sender, ListEventArgs <FilteredGroup <IImageSet> > e)
        {
            ImageSetTreeGroupItem groupItem = FindGroupItem(e.Item);

            if (groupItem != null)
            {
                _tree.Items.Remove(groupItem);
                groupItem.Dispose();
                OnUpdated();
            }
        }
Ejemplo n.º 5
0
        private void ExpandTo(IImageSetTreeItem item)
        {
            ImageSetTreeGroupItem parent = item.Parent;

            while (parent != _internalTreeRoot)
            {
                parent.IsExpanded = true;
                parent            = parent.Parent;
            }

            _internalTreeRoot.IsExpanded = true;
        }
Ejemplo n.º 6
0
        private void OnChildGroupChanged(object sender, ListEventArgs <FilteredGroup <IImageSet> > e)
        {
            if (_changingGroupItem != null)
            {
                int replaceIndex = _tree.Items.IndexOf(_changingGroupItem);
                if (replaceIndex >= 0)
                {
                    _tree.Items[replaceIndex] = new ImageSetTreeGroupItem(e.Item, this, _tree.Binding);
                    OnUpdated();
                }

                _changingGroupItem.Dispose();
                _changingGroupItem = null;
            }
        }
Ejemplo n.º 7
0
        private ImageSetTreeGroupItem FindGroupItem(FilteredGroup <IImageSet> filteredGroup)
        {
            ImageSetTreeGroupItem groupItem = CollectionUtils.SelectFirst(_tree.Items,
                                                                          delegate(IImageSetTreeItem treeItem)
            {
                if (treeItem is ImageSetTreeGroupItem)
                {
                    return(((ImageSetTreeGroupItem)treeItem)._group == filteredGroup);
                }
                else
                {
                    return(false);
                }
            }) as ImageSetTreeGroupItem;

            return(groupItem);
        }
Ejemplo n.º 8
0
        private void UpdateInternalTreeRoot()
        {
            ImageSetTreeGroupItem treeRoot = _internalTree;

            while (treeRoot.GetItems().Count == 0)
            {
                ReadOnlyCollection <ImageSetTreeGroupItem> childGroupItems = treeRoot.GetGroupItems();
                int nonEmptyChildGroupItems = 0;
                foreach (ImageSetTreeGroupItem childGroupItem in childGroupItems)
                {
                    if (childGroupItem.GetAllItems().Count > 0)
                    {
                        ++nonEmptyChildGroupItems;
                    }
                }

                if (nonEmptyChildGroupItems == 1)
                {
                    treeRoot = childGroupItems[0];
                }
                else
                {
                    break;
                }
            }

            bool treeChanged = (_internalTreeRoot != treeRoot);

            _internalTreeRoot = treeRoot;
            UpdateSelection(false);
            ExpandToSelection();

            if (treeChanged)
            {
                OnTreeChanged();
            }
        }
Ejemplo n.º 9
0
		private ImageSetTreeGroupItem(FilteredGroup<IImageSet> group, ImageSetTreeGroupItem parent, ITreeItemBinding binding)
			: this(group, parent._imageSetComparer, binding)
		{
			_parent = parent;
		}
Ejemplo n.º 10
0
		private void UpdateInternalTreeRoot()
		{
			ImageSetTreeGroupItem treeRoot = _internalTree;

			while (treeRoot.GetItems().Count == 0)
			{
				ReadOnlyCollection<ImageSetTreeGroupItem> childGroupItems = treeRoot.GetGroupItems();
				int nonEmptyChildGroupItems = 0;
				foreach (ImageSetTreeGroupItem childGroupItem in childGroupItems)
				{
					if (childGroupItem.GetAllItems().Count > 0)
						++nonEmptyChildGroupItems;
				}

				if (nonEmptyChildGroupItems == 1)
					treeRoot = childGroupItems[0];
				else
					break;
			}

			bool treeChanged = (_internalTreeRoot != treeRoot);

			_internalTreeRoot = treeRoot;
			UpdateSelection(false);
			ExpandToSelection();

			if (treeChanged)
				OnTreeChanged();
		}
Ejemplo n.º 11
0
 private void OnChildGroupChanging(object sender, ListEventArgs <FilteredGroup <IImageSet> > e)
 {
     _changingGroupItem = FindGroupItem(e.Item);
 }
Ejemplo n.º 12
0
		private void OnChildGroupAdded(object sender, ListEventArgs<FilteredGroup<IImageSet>> e)
		{
			ImageSetTreeGroupItem newGroupItem = new ImageSetTreeGroupItem(e.Item, this, _tree.Binding);
			_tree.Items.Add(newGroupItem);
			OnUpdated();
		}
Ejemplo n.º 13
0
		private void OnChildGroupChanging(object sender, ListEventArgs<FilteredGroup<IImageSet>> e)
		{
			_changingGroupItem = FindGroupItem(e.Item);
		}
Ejemplo n.º 14
0
		private void OnChildGroupChanged(object sender, ListEventArgs<FilteredGroup<IImageSet>> e)
		{
			if (_changingGroupItem != null)
			{
				int replaceIndex = _tree.Items.IndexOf(_changingGroupItem);
				if (replaceIndex >= 0)
				{
					_tree.Items[replaceIndex] = new ImageSetTreeGroupItem(e.Item, this, _tree.Binding);
					OnUpdated();
				}

				_changingGroupItem.Dispose();
				_changingGroupItem = null;
			}
		}
Ejemplo n.º 15
0
 private ImageSetTreeGroupItem(FilteredGroup <IImageSet> group, ImageSetTreeGroupItem parent, ITreeItemBinding binding)
     : this(group, parent._imageSetComparer, binding)
 {
     _parent = parent;
 }
Ejemplo n.º 16
0
 internal ImageSetTreeItem(IImageSet imageSet, ImageSetTreeGroupItem parent)
 {
     _imageSet = imageSet;
     _parent   = parent;
 }
Ejemplo n.º 17
0
		internal ImageSetTreeItem(IImageSet imageSet, ImageSetTreeGroupItem parent)
		{
			_imageSet = imageSet;
			_parent = parent;
		}