Class ElementDescriptor<T>
Denotes a descriptor for elements in the diagram
public abstract class ElementDescriptor<T> : DescriptorBase
Type Parameters
T
The semantic type of elements described by this descriptor
- Inheritance
-
ElementDescriptor<T>
- Derived
- Inherited Members
Constructors
ElementDescriptor()
Creates a new instance
protected ElementDescriptor()
Properties
CanCreateElement
True, if an instance of this element type can be created, otherwise False
public virtual bool CanCreateElement { get; }
Property Value
ElementTypeId
Gets the element type id for elements created by this descriptor
public string ElementTypeId { get; }
Property Value
Methods
CreateElement(string, object)
Creates a new element
public virtual T CreateElement(string profile, object parent)
Parameters
Returns
- T
A new element
CreateGraph(object, IDiagram, ISkeletonTrace)
Creates the graph for the given semantic root element
protected override GGraph CreateGraph(object semanticRoot, IDiagram diagram, ISkeletonTrace trace)
Parameters
semanticRoot
objectThe semantic root element
diagram
IDiagramThe notation diagram
trace
ISkeletonTraceA skeleton trace
Returns
- GGraph
The Graph instance
CssClass(Expression<Func<T, string>>)
Sets the CSS class applicable to this element
protected void CssClass(Expression<Func<T, string>> selector)
Parameters
selector
Expression<Func<T, string>>A selector expression which CSS class is applicable
Remarks
This method is intended to be used inside of DefineLayout()
CssClass(string, Expression<Func<T, bool>>)
Sets the CSS classes applicable to this element
protected void CssClass(string cssClass, Expression<Func<T, bool>> guard = null)
Parameters
cssClass
stringThe CSS class
guard
Expression<Func<T, bool>>A guard predicate or null, if the CSS class should be assigned unconditionally
Remarks
This method is intended to be used inside of DefineLayout()
Forward(string, Expression<Func<T, object>>)
Forwards the given value to the generated GElement
protected void Forward(string key, Expression<Func<T, object>> selector)
Parameters
key
stringThe property key
selector
Expression<Func<T, object>>An expression calculating the actual value for the included property
Remarks
This method is intended to be used inside of DefineLayout()
Forward(string, object)
Forwards the given value to the generated GElement
protected void Forward(string key, object value)
Parameters
Remarks
This method is intended to be used inside of DefineLayout()
GetElementName(T)
Calculates a human-readable name for the given element
public virtual string GetElementName(T element)
Parameters
element
Tthe element
Returns
- string
A human-readable name
Operation(string, Action<T, IGlspSession>, string)
Defines an operation applicable for elements described by this instance
protected IChildSyntax Operation(string toolName, Action<T, IGlspSession> operation, string key = null)
Parameters
toolName
stringThe name of the tool
operation
Action<T, IGlspSession>The operation
key
stringThe key that should be used communicating the operation to the client
Returns
- IChildSyntax
A syntax element to refine the operation
Remarks
The key must be unique across all operations. If it is null, a key is inferred from the tool name.
Operation(string, Func<T, IGlspSession, Task>, string)
Defines an operation applicable for elements described by this instance
protected IChildSyntax Operation(string toolName, Func<T, IGlspSession, Task> operation, string key = null)
Parameters
toolName
stringThe name of the tool
operation
Func<T, IGlspSession, Task>The operation
key
stringThe key that should be used communicating the operation to the client
Returns
- IChildSyntax
A syntax element to refine the operation
Remarks
The key must be unique across all operations. If it is null, a key is inferred from the tool name.
Profile(string)
Declares a profile with a given name
protected void Profile(string profileName)
Parameters
profileName
stringthe name of the profile
Profile(string, Func<T>)
Declares a profile with a given name
protected void Profile(string profileName, Func<T> creator)
Parameters
profileName
stringthe name of the profile
creator
Func<T>A function used to create elements with this profile. If null, the default method CreateElement is used.
Refine<TOther>(ElementDescriptor<TOther>)
Refines the given other node descriptor
protected void Refine<TOther>(ElementDescriptor<TOther> other)
Parameters
other
ElementDescriptor<TOther>The refined node descriptor
Type Parameters
TOther
The semantic type of elements described by the other node descriptor
Remarks
This method is intended to be used inside of DefineLayout()
RenderPopup(T, Bounds)
Renders a popup
public virtual string RenderPopup(T element, Bounds dimension)
Parameters
element
TThe element for which a popup should be rendered
dimension
BoundsThe dimension of the popup
Returns
- string
A HTML string rendering the popup
SelectionIncludes(Func<T, IEnumerable<IModelElement>>)
Specifies that when an element is selected, the selection should also include a collection of other model elements
protected void SelectionIncludes(Func<T, IEnumerable<IModelElement>> selector)
Parameters
selector
Func<T, IEnumerable<IModelElement>>A function that selects model elements that should also be selected
Remarks
This method is intended to be used inside of DefineLayout()
ToolLabel(string)
Gets the label used for the tool palette
public virtual string ToolLabel(string profile)
Parameters
profile
stringThe profile
Returns
- string
The text used for tools
Type(string)
Sets the GLSP type created for this node
protected void Type(string type)
Parameters
type
stringThe type
Remarks
This method is intended to be used inside of DefineLayout()