Class GraphController
Main MVC controller. The view type is based on an interface in function of platform independence.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.WinControls.RadDiagram.dll
Syntax
public sealed class GraphController : IControllerService, ISerializable
Constructors
GraphController(IGraphInternal, IContainerGeneratorInternal)
Initializes a new instance of the GraphController class.
Declaration
public GraphController(IGraphInternal graph, IContainerGeneratorInternal containerGenerator)
Parameters
IGraphInternal
graph
The graph internal. |
IContainerGeneratorInternal
containerGenerator
The container generator. |
Properties
ServiceLocator
Gets the service locator.
Declaration
public ServiceLocator ServiceLocator { get; }
Property Value
ServiceLocator
|
Methods
ActivateTool(MouseTool)
Activates the tool.
Declaration
public void ActivateTool(MouseTool mouseTool)
Parameters
MouseTool
mouseTool
The mouse tool. |
AddConnection(IConnection, Boolean)
Adds the connection.
Declaration
public void AddConnection(IConnection connection, bool isUndoable = true)
Parameters
IConnection
connection
The connection. |
System.Boolean
isUndoable
If set to |
AddShape(Object, Boolean)
Adds the shape.
Declaration
public IShape AddShape(object item, bool isUndoable = true)
Parameters
System.Object
item
The item. |
System.Boolean
isUndoable
If set to |
Returns
IShape
|
Exceptions
System.ArgumentNullException
If the item is null. |
AddShape(IShape, Boolean)
Adds the shape.
Declaration
public void AddShape(IShape shape, bool isUndoable = true)
Parameters
IShape
shape
The shape. |
System.Boolean
isUndoable
If set to |
AlignShapes(Alignment, IEnumerable<IShape>)
Aligns the shapes to the most left/top/right/bottom edge defined by the selection bounds.
Declaration
public void AlignShapes(Alignment alignment, IEnumerable<IShape> shapes)
Parameters
Alignment
alignment
Determines whether alignment should be calculated towards left/top/right/bottom edge. |
System.Collections.Generic.IEnumerable<IShape>
shapes
The shapes. |
BringForward(IEnumerable<IDiagramItem>, Boolean)
Brings the selected items forward.
Declaration
public void BringForward(IEnumerable<IDiagramItem> items, bool isUndoable = true)
Parameters
System.Collections.Generic.IEnumerable<IDiagramItem>
items
|
System.Boolean
isUndoable
|
BringToFront(IEnumerable<IDiagramItem>, Boolean)
Brings the selected items to front.
Declaration
public void BringToFront(IEnumerable<IDiagramItem> items, bool isUndoable = true)
Parameters
System.Collections.Generic.IEnumerable<IDiagramItem>
items
|
System.Boolean
isUndoable
|
ChangeTool(String)
Changes the tool.
Declaration
public void ChangeTool(string toolName)
Parameters
System.String
toolName
Label of the tool. |
Clear(Boolean)
Clears the diagram and resets the document.
Declaration
public void Clear(bool isItemsCollectionChanging = false)
Parameters
System.Boolean
isItemsCollectionChanging
|
Remarks
The diagram is not saved prior to this reset. You need to handle in the application the eventual necessity to save (or request the user) the diagram before this.
ClearConnections()
Clears the connections.
Declaration
public void ClearConnections()
ClearShapes()
Clears the shapes.
Declaration
public void ClearShapes()
Copy()
Creates a copy of the diagram in the clipboard.
Declaration
public string Copy()
Returns
System.String
|
CreateConnection(IShape, IShape, Boolean)
Creates the connection.
Declaration
public IConnection CreateConnection(IShape source, IShape target, bool isUndoable)
Parameters
IShape
source
The source. |
IShape
target
The target. |
System.Boolean
isUndoable
If set to |
Returns
IConnection
|
CreateConnectionInGraphSource(IShape, IShape)
Creates the connection in graph source.
Declaration
public ILink CreateConnectionInGraphSource(IShape source, IShape target)
Parameters
IShape
source
The source. |
IShape
target
The target. |
Returns
ILink
|
CreateShapeInGraphSource(IShape)
Creates the shape in graph source.
Declaration
public object CreateShapeInGraphSource(IShape shape)
Parameters
IShape
shape
The shape. |
Returns
System.Object
|
CutItems()
Cuts the items.
Declaration
public string CutItems()
Returns
System.String
|
DeleteItems(IEnumerable<IDiagramItem>, Boolean)
Deletes the items.
Declaration
public void DeleteItems(IEnumerable<IDiagramItem> itemsToDelete, bool isUndoable)
Parameters
System.Collections.Generic.IEnumerable<IDiagramItem>
itemsToDelete
The items to delete. |
System.Boolean
isUndoable
If set to |
DeselectItem(IDiagramItem)
Deselects a specific item.
Declaration
public void DeselectItem(IDiagramItem deselectedItem)
Parameters
IDiagramItem
deselectedItem
|
Deserialize(SerializationInfo)
Deserializes the specified info.
Declaration
public void Deserialize(SerializationInfo info)
Parameters
SerializationInfo
info
The info. |
Implements
ForceRealization()
Forces the realization.
Declaration
public void ForceRealization()
Group(String, Boolean, IGroupable[])
Groups the selected shapes.
Declaration
public IGroup Group(string name = null, bool isUndoable = false, params IGroupable[] items)
Parameters
System.String
name
The name. |
System.Boolean
isUndoable
If set to |
IGroupable[]
items
The items. |
Returns
IGroup
|
IsInViewport(IDiagramItem)
Checks if the diagram item is in the viewport.
Declaration
public bool IsInViewport(IDiagramItem item)
Parameters
IDiagramItem
item
|
Returns
System.Boolean
|
KeyDown(KeyArgs)
Called when key down event is fired.
Declaration
public bool KeyDown(KeyArgs e)
Parameters
KeyArgs
e
The key args. |
Returns
System.Boolean
|
KeyUp(KeyArgs)
Called when key up event is fired.
Declaration
public bool KeyUp(KeyArgs e)
Parameters
KeyArgs
e
The key args. |
Returns
System.Boolean
|
Layout(LayoutType, Object)
Organizes the diagram using the specified layout.
Declaration
public void Layout(LayoutType type = LayoutType.Sugiyama, object settings = null)
Parameters
LayoutType
type
The layout type to apply. |
System.Object
settings
The settings specific to the layout type. |
See Also
Load(String)
Loads the serialized diagram.
Declaration
public void Load(string serializationValue)
Parameters
System.String
serializationValue
A string supposedly containing some XML representing a serialized diagram. |
MergeItems(IEnumerable<IDiagramItem>, String, Boolean, Point, Size)
Merges the items in the diagram.
Declaration
public IEnumerable<IDiagramItem> MergeItems(IEnumerable<IDiagramItem> items, string originId, bool usePosition = false, Point position = default(Point), Size size = default(Size))
Parameters
System.Collections.Generic.IEnumerable<IDiagramItem>
items
The items. |
System.String
originId
The origin id. |
System.Boolean
usePosition
If set to |
Point
position
The position. |
Size
size
The size. |
Returns
System.Collections.Generic.IEnumerable<IDiagramItem>
|
MouseDoubleClick(PointerArgs)
Handles the mouse double click event.
Declaration
public void MouseDoubleClick(PointerArgs e)
Parameters
PointerArgs
e
The e. |
MouseDown(PointerArgs)
Called when the left mouse button is down.
Declaration
public void MouseDown(PointerArgs e)
Parameters
PointerArgs
e
The e. |
MouseMove(PointerArgs)
Called when the mouse moves.
Declaration
public void MouseMove(PointerArgs e)
Parameters
PointerArgs
e
The e. |
MouseUp(PointerArgs)
Called when the mouse left button is up.
Declaration
public bool MouseUp(PointerArgs e)
Parameters
PointerArgs
e
The e. |
Returns
System.Boolean
|
Nudge(Point)
Nudges (i.e. a small amount of translation) the selected items with the specified amount.
Declaration
public void Nudge(Point amount)
Parameters
Point
amount
The amount defined as a point (vector). |
Remarks
This is an undoable action and plugs into the same mechanism as the DraggingTool.
OnGraphSourceChanged(IGraphSource)
Called when graph source changes.
Declaration
public void OnGraphSourceChanged(IGraphSource source)
Parameters
IGraphSource
source
The source. |
OnItemsChanged(NotifyCollectionChangedEventArgs)
Called when Items collection changes.
Declaration
public void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
System.Collections.Specialized.NotifyCollectionChangedEventArgs
e
The System.Collections.Specialized.NotifyCollectionChangedEventArgs instance containing the event data. |
OnViewportChanged()
Called when the bounds have changed.
Declaration
public void OnViewportChanged()
Paste(String)
Pastes a diagram, serialized in the clipboard.
Declaration
public IEnumerable<IDiagramItem> Paste(string pasteText)
Parameters
System.String
pasteText
|
Returns
System.Collections.Generic.IEnumerable<IDiagramItem>
|
RemoveConnection(IConnection, Boolean)
Removes the connection.
Declaration
public void RemoveConnection(IConnection connection, bool isUndoable = false)
Parameters
IConnection
connection
The connection. |
System.Boolean
isUndoable
If set to |
RemoveShape(IShape, Boolean)
Removes the shape from the diagram.
Declaration
public void RemoveShape(IShape shape, bool isUndoable = false)
Parameters
IShape
shape
The shape to be removed. |
System.Boolean
isUndoable
If set to |
Save()
Returns the serialized diagram as an XML-string.
Declaration
public string Save()
Returns
System.String
|
SelectItem(IDiagramItem, Boolean)
Selects a specific item.
Declaration
public void SelectItem(IDiagramItem selectedItem, bool addToExistingSelection = false)
Parameters
IDiagramItem
selectedItem
|
System.Boolean
addToExistingSelection
|
SendBackward(IEnumerable<IDiagramItem>, Boolean)
Sends selected items backward.
Declaration
public void SendBackward(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)
Parameters
System.Collections.Generic.IEnumerable<IDiagramItem>
itemsToSend
|
System.Boolean
isUndoable
|
SendToBack(IEnumerable<IDiagramItem>, Boolean)
Sends selected items to back.
Declaration
public void SendToBack(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)
Parameters
System.Collections.Generic.IEnumerable<IDiagramItem>
itemsToSend
|
System.Boolean
isUndoable
|
Serialize()
Serializes this instance.
Declaration
public SerializationInfo Serialize()
Returns
SerializationInfo
|
Implements
SnapShapes(IEnumerable<IShape>)
Snaps the items based on the snap value. The action is enclosed in a undoable command and supports undo/redo.
Declaration
public void SnapShapes(IEnumerable<IShape> shapes)
Parameters
System.Collections.Generic.IEnumerable<IShape>
shapes
|
Ungroup(Boolean, IGroup[])
Ungroups the specified items.
Declaration
public void Ungroup(bool isUndoable = false, params IGroup[] groups)
Parameters
System.Boolean
isUndoable
|
IGroup[]
groups
|
Explicit Interface Implementations
IControllerService.BeginConnectionCreation(IConnection)
Begins the connection creation.
Declaration
ICommand IControllerService.BeginConnectionCreation(IConnection connection)
Parameters
IConnection
connection
The connection. |
Returns
ICommand
|
Implements
IControllerService.BeginShapeCreation(IShape)
Begins the shape creation.
Declaration
ICommand IControllerService.BeginShapeCreation(IShape shape)
Parameters
IShape
shape
The shape. |
Returns
ICommand
|
Implements
IControllerService.CompleteConnectionCreation(IConnection)
Completes the connection creation.
Declaration
ICommand IControllerService.CompleteConnectionCreation(IConnection connection)
Parameters
IConnection
connection
The connection. |
Returns
ICommand
|
Implements
IControllerService.CompleteShapeCreation(IShape)
Completes the shape creation.
Declaration
ICommand IControllerService.CompleteShapeCreation(IShape shape)
Parameters
IShape
shape
The shape. |
Returns
ICommand
|
Implements
IControllerService.CreateConnection(IShape, IShape)
Creates the undoable connection.
Declaration
IConnection IControllerService.CreateConnection(IShape source, IShape target)
Parameters
IShape
source
The source. |
IShape
target
The target. |
Returns
IConnection
|
Implements
IControllerService.CreateConnection(Point, Point)
Creates the undoable connection.
Declaration
IConnection IControllerService.CreateConnection(Point startPoint, Point endPoint)
Parameters
Point
startPoint
The start point. |
Point
endPoint
The end point. |
Returns
IConnection
|
Implements
IControllerService.CreateGeometryShape(ref ICommand)
Creates an undoable geometry shape.
Declaration
IGeometryShape IControllerService.CreateGeometryShape(ref ICommand command)
Parameters
ICommand
command
|
Returns
IGeometryShape
|
Implements
IControllerService.CreateTextShape()
Creates an undoable geometry shape.
Declaration
ITextShape IControllerService.CreateTextShape()
Returns
ITextShape
|