protected override ElementLink CreateElementLink(EntityElement source, SelectedCompartmentPartType sourcePartType, Property sourceEntry, EntityElement target, SelectedCompartmentPartType targetPartType, Property targetEntry) { EntityHasRelationShips result; result = new EntityHasRelationShips(source, target); if (sourcePartType == SelectedCompartmentPartType.Head) { result.fromProperty = Guid.Empty; result.fromPropertyName = string.Empty; } else { result.fromProperty = sourceEntry.Guid; result.fromPropertyName = sourceEntry.EntityElement.Name + "_" + sourceEntry.Name; } if (targetPartType == SelectedCompartmentPartType.Head) { result.toProperty = Guid.Empty; result.toPropertyName = string.Empty; } else { result.toProperty = targetEntry.Guid; result.toPropertyName = targetEntry.EntityElement.Name + "_" + targetEntry.Name; } return(result); }
/// <summary> /// Test whether a given model element is acceptable to this ConnectionBuilder as the target of a connection /// </summary> /// <param name="targetElement">The model element to use as the target of the connection</param> /// <param name="targetPartType">The type of the target. (head or entry)</param> /// <param name="targetEntry">The model elment to use as the target entry of the connection</param> /// <returns>Whether the elements can be used as the source and target of a connection</returns> protected virtual bool CanAcceptAsCompartmentTarget(TARGET_ELEMENT candidate, SelectedCompartmentPartType partType, TARGET_COMPARTMENT_ENTRY candidateEntry) { return(true); }
/// <summary> /// Make a connection between the given pair of source and target elements /// </summary> /// <returns>A link representing the created connection</returns> /// <remarks>This method is only called if both, source and targent, are compartment shapes.</remarks> /// <param name="source">The model element to use as the source of the connection</param> /// <param name="sourcePartType">The type of the source. (head or entry)</param> /// <param name="sourceEntry">The model element to use as the source entry of the conneciton</param> /// <param name="target">The model element to use as the target of the connection</param> /// <param name="targetPartType">The type of the target. (head or entry)</param> /// <param name="targetEntry">The model elment to use as the target entry of the connection</param> /// <returns>A link representing the created connection</returns> protected abstract ElementLink CreateElementLink(SOURCE_ELEMENT source, SelectedCompartmentPartType sourcePartType, SOURCE_COMPARTMENT_ENTRY sourceEntry, TARGET_ELEMENT target, SelectedCompartmentPartType targetPartType, TARGET_COMPARTMENT_ENTRY targetEntry);
/// <summary> /// Test whether a given model element is acceptable to this ConnectionBuilder as the source of a connection. /// </summary> /// <param name="candidate">The model element to test.</param> /// <param name="partType">The type of the source. (head or entry)</param> /// <param name="candidateEntry">The model element to use as the source entry of the conneciton</param> /// <returns>Whether the element can be used as the source of a connection.</returns> protected virtual bool CanAcceptAsCompartmentSource(SOURCE_ELEMENT candidate, SelectedCompartmentPartType partType, SOURCE_COMPARTMENT_ENTRY candidateEntry) { return(true); }
/// <summary> /// Test whether a given pair of model elements are acceptable to this ConnectionBuilder as the source and target of a connection /// </summary> /// <remarks>This method is only called if both, source and targent, are compartment shapes.</remarks> /// <param name="sourceElement">The model element to use as the source of the connection</param> /// <param name="sourcePartType">The type of the source. (head or entry)</param> /// <param name="sourceEntry">The model element to use as the source entry of the conneciton</param> /// <param name="targetElement">The model element to use as the target of the connection</param> /// <param name="targetPartType">The type of the target. (head or entry)</param> /// <param name="targetEntry">The model elment to use as the target entry of the connection</param> /// <returns>Whether the elements can be used as the source and target of a connection</returns> protected virtual bool CanAcceptAsCompartmentSourceAndTarget(SOURCE_ELEMENT sourceElement, SelectedCompartmentPartType sourcePartType, SOURCE_COMPARTMENT_ENTRY sourceEntry, TARGET_ELEMENT targetElement, SelectedCompartmentPartType targetPartType, TARGET_COMPARTMENT_ENTRY targetEntry) { return(true); }