Class ElementDescriptor<T>
Denotes a descriptor for elements in the diagram
public abstract class ElementDescriptor<T> : DescriptorBase
Type Parameters
TThe 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
semanticRootobjectThe semantic root element
diagramIDiagramThe notation diagram
traceISkeletonTraceA 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
selectorExpression<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
cssClassstringThe CSS class
guardExpression<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
keystringThe property key
selectorExpression<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
elementTthe 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
toolNamestringThe name of the tool
operationAction<T, IGlspSession>The operation
keystringThe 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
toolNamestringThe name of the tool
operationFunc<T, IGlspSession, Task>The operation
keystringThe 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
profileNamestringthe name of the profile
Profile(string, Func<T>)
Declares a profile with a given name
protected void Profile(string profileName, Func<T> creator)
Parameters
profileNamestringthe name of the profile
creatorFunc<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
otherElementDescriptor<TOther>The refined node descriptor
Type Parameters
TOtherThe 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
elementTThe element for which a popup should be rendered
dimensionBoundsThe dimension of the popup
Returns
- string
A HTML string rendering the popup
SelectionIncludes(Func<T, IModelElement>)
Specifies that when an element is selected, the selection should also include a collection of other model elements
protected void SelectionIncludes(Func<T, IModelElement> selector)
Parameters
selectorFunc<T, IModelElement>A function that selects model elements that should also be selected
Remarks
This method is intended to be used inside of DefineLayout()
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
selectorFunc<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
profilestringThe profile
Returns
- string
The text used for tools
Type(string)
Sets the GLSP type created for this node
protected void Type(string type)
Parameters
typestringThe type
Remarks
This method is intended to be used inside of DefineLayout()