/// <summary> /// Initializes a new instance of the <see cref="ItemReorderCompleteContext"/> class. /// </summary> public ItemReorderCompleteContext(object dataItem, IDataGroup dataGroup, object destinationItem, IDataGroup destinationGroup, ItemReorderPlacement placement) { this.Item = dataItem; this.Group = dataGroup; this.DestinationItem = destinationItem; this.DestinationGroup = destinationGroup; this.Placement = placement; }
public GroupService(GroupRepository groupRepository, UserRepository userRepository, MemberGroupRepository memberRepository, DataGroupRepository dataRepository) { _groupRepository = groupRepository; _userRepository = userRepository; _memberRepository = memberRepository; _dataRepository = dataRepository; }
public void CollapseGroup(IDataGroup group) { if (!this.IsDataReady) { return; } this.model.RowPool.Layout.Collapse(group); }
public void ExpandGroup(IDataGroup group) { if (!this.IsDataReady) { return; } this.ExpandRecursively(group); }
public bool GetIsExpanded(IDataGroup group) { if (!this.IsDataReady) { return(false); } return(!this.model.RowPool.Layout.IsCollapsed(group)); }
private void ExpandRecursively(IDataGroup group) { Stack <object> groups = new Stack <object>(); var currentGroup = group; // we need to expand the parent chain starting from top-level groups, that's why we put them in a Stack first while (currentGroup != null) { groups.Push(currentGroup); currentGroup = currentGroup.ParentGroup; } while (groups.Count > 0) { this.model.RowPool.Layout.Expand(groups.Pop()); } }
public IEnumerable GetAggregateValues(string propertyName, IDataGroup group) { if (!this.IsDataReady) { yield break; } for (int i = 0; i < this.model.AggregateDescriptors.Count; i++) { var propertyAggregate = this.model.AggregateDescriptors[i] as PropertyAggregateDescriptor; if (propertyAggregate == null) { continue; } yield return(this.GetAggregateValue(i, group)); } }
public object GetAggregateValue(int aggregateIndex, IDataGroup group) { if (!this.IsDataReady) { return(false); } var coordinate = this.model.CurrentDataProvider.Results.Root; if (group != null) { coordinate.RowGroup = group as IGroup; } var value = this.model.CurrentDataProvider.Results.GetAggregateResult(aggregateIndex, coordinate); if (value != null) { return(value.GetValue()); } return(null); }
void IDragDropElement.OnDragDropComplete(DragCompleteContext context) { var data = context.PayloadData as ReorderItemsDragOperation; if (data != null) { this.FinalizeReorder(context); var isExecuted = false; RadListViewItem destinationItem = null; ItemReorderPlacement placement = 0; if (data.InitialSourceIndex < data.CurrentSourceReorderIndex) { destinationItem = this.reorderCoordinator.Host.ElementAt(data.CurrentSourceReorderIndex - 1) as RadListViewItem; placement = ItemReorderPlacement.After; if (destinationItem == null) { destinationItem = this.reorderCoordinator.Host.ElementAt(data.CurrentSourceReorderIndex + 1) as RadListViewItem; placement = ItemReorderPlacement.Before; } } else if (data.InitialSourceIndex > data.CurrentSourceReorderIndex) { destinationItem = this.reorderCoordinator.Host.ElementAt(data.CurrentSourceReorderIndex + 1) as RadListViewItem; placement = ItemReorderPlacement.Before; if (destinationItem == null) { destinationItem = this.reorderCoordinator.Host.ElementAt(data.CurrentSourceReorderIndex - 1) as RadListViewItem; placement = ItemReorderPlacement.After; } } if (destinationItem != null) { var dataItem = data.Data; var destinationDataItem = destinationItem.DataContext; IDataGroup dataGroup = null; IDataGroup destinationDataGroup = null; if (this.listView.GroupDescriptors.Count > 0) { dataGroup = this.listView.Model.FindItemParentGroup(dataItem); destinationDataGroup = this.listView.Model.FindItemParentGroup(destinationDataItem); } var commandContext = new ItemReorderCompleteContext(dataItem, dataGroup, destinationDataItem, destinationDataGroup, placement); isExecuted = this.ListView.commandService.ExecuteCommand(CommandId.ItemReorderComplete, commandContext); } if (isExecuted) { // TODO: Data provider does not handle well reordering of items in groups. // Remove this workaround once we fix the reordering in the data provider. if (this.listView.GroupDescriptors.Count > 0) { this.listView.updateService.RegisterUpdate((int)UpdateFlags.AffectsData); } } else { this.reorderCoordinator.CancelReorderOperation(this, data.InitialSourceIndex); } } else { if (context.DragSuccessful) { double offset = 0; var dragMode = DragDrop.GetDragPositionMode(this); if (this.ListView.Orientation == Orientation.Horizontal) { switch (dragMode) { case DragPositionMode.RailXForward: offset = Math.Max(0, this.dragY); break; case DragPositionMode.RailXBackwards: offset = Math.Min(0, this.dragY); break; case DragPositionMode.RailX: offset = this.dragY; break; default: break; } } else { switch (dragMode) { case DragPositionMode.RailXForward: offset = Math.Max(0, this.dragX); break; case DragPositionMode.RailXBackwards: offset = Math.Min(0, this.dragX); break; case DragPositionMode.RailX: offset = this.dragX; break; default: break; } } var swipeContext = new ItemSwipeActionCompleteContext(this.DataContext, this, offset); bool isExecuted = this.ListView.commandService.ExecuteCommand(CommandId.ItemSwipeActionComplete, swipeContext); if (isExecuted) { this.UpdateActionContentClipping(swipeContext.FinalDragOffset); this.isDraggedForAction = true; this.ListView.swipedItem = this; } else { this.ClearActionContent(); } } else { this.ClearActionContent(); this.ListView.CleanupSwipedItem(); } } this.Opacity = 1; DragDrop.SetDragPositionMode(this, DragPositionMode.Free); this.ListView.InvalidatePanelArrange(); }
public void CollapseGroup(IDataGroup group) { this.owner.Model.layoutController.Layout.Collapse(group); this.owner.updateService.RegisterUpdate((int)UpdateFlags.AllButData); }
public bool GetIsExpanded(IDataGroup group) { return(!this.owner.Model.layoutController.Layout.IsCollapsed(group)); }