-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21a0d98
commit 9df9fa2
Showing
22 changed files
with
764 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Intent.Metadata.Models; | ||
using Intent.Modules.Common; | ||
using Intent.RoslynWeaver.Attributes; | ||
|
||
[assembly: DefaultIntentManaged(Mode.Fully)] | ||
[assembly: IntentTemplate("Intent.ModuleBuilder.Templates.Api.ApiElementModel", Version = "1.0")] | ||
|
||
namespace Intent.Modelers.UI.Core.Api | ||
{ | ||
[IntentManaged(Mode.Fully, Signature = Mode.Fully)] | ||
public class ImageModel : IMetadataModel, IHasStereotypes, IHasName, IElementWrapper | ||
{ | ||
public const string SpecializationType = "Image"; | ||
public const string SpecializationTypeId = "329f635b-a55c-465f-b966-fe8411a5f57c"; | ||
protected readonly IElement _element; | ||
|
||
[IntentManaged(Mode.Fully)] | ||
public ImageModel(IElement element, string requiredType = SpecializationType) | ||
{ | ||
if (!requiredType.Equals(element.SpecializationType, StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
throw new Exception($"Cannot create a '{GetType().Name}' from element with specialization type '{element.SpecializationType}'. Must be of type '{SpecializationType}'"); | ||
} | ||
_element = element; | ||
} | ||
|
||
public string Id => _element.Id; | ||
|
||
public string Name => _element.Name; | ||
|
||
public string Comment => _element.Comment; | ||
|
||
public IEnumerable<IStereotype> Stereotypes => _element.Stereotypes; | ||
|
||
public string Value => _element.Value; | ||
|
||
public IElement InternalElement => _element; | ||
|
||
public override string ToString() | ||
{ | ||
return _element.ToString(); | ||
} | ||
|
||
public bool Equals(ImageModel other) | ||
{ | ||
return Equals(_element, other?._element); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((ImageModel)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return (_element != null ? _element.GetHashCode() : 0); | ||
} | ||
} | ||
|
||
[IntentManaged(Mode.Fully)] | ||
public static class ImageModelExtensions | ||
{ | ||
|
||
public static bool IsImageModel(this ICanBeReferencedType type) | ||
{ | ||
return type != null && type is IElement element && element.SpecializationTypeId == ImageModel.SpecializationTypeId; | ||
} | ||
|
||
public static ImageModel AsImageModel(this ICanBeReferencedType type) | ||
{ | ||
return type.IsImageModel() ? new ImageModel((IElement)type) : null; | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...data/Module Builder/Intent.Modelers.UI.Core/Elements/Element Settings/Image__69st43nl.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<class id="329f635b-a55c-465f-b966-fe8411a5f57c" type="Element Settings" typeId="727577aa-3e07-4b41-be7d-7359bb1e48c8"> | ||
<name>Image</name> | ||
<display>Image</display> | ||
<isAbstract>false</isAbstract> | ||
<genericTypes /> | ||
<isMapped>false</isMapped> | ||
<parentFolderId>3cd798f0-8cdf-42a4-b733-469632a86f27</parentFolderId> | ||
<packageId>a2a95421-3e55-43c7-96ad-355610b43c4d</packageId> | ||
<packageName>Intent.Modelers.UI.Core</packageName> | ||
<stereotypes> | ||
<stereotype stereotypeDefinitionId="d8f6f331-d4f0-4c75-aa91-f2e715cd9591" name="Type Reference Settings"> | ||
<addedByDefault>true</addedByDefault> | ||
<definitionPackageName>Intent.ModuleBuilder</definitionPackageName> | ||
<definitionPackageId>9972b2a9-b749-4bba-b5c8-824bf694c6ef</definitionPackageId> | ||
<properties> | ||
<property name="8da796ff-e5b8-4a53-9c18-9176bfff8fbc" display="Mode" value="Disabled" isActive="true" /> | ||
<property name="07613cf6-d1bf-411c-96db-65daad7d07f4" display="Display Name" isActive="false" /> | ||
<property name="3941cc0b-503e-495a-bef3-9923a6554cee" display="Hint" isActive="false" /> | ||
<property name="b94f760c-0ce7-4176-bbae-97e26914b39c" display="Target Types" isActive="false" /> | ||
<property name="52f3c2e8-6438-494a-b0a7-7a9e61c8aae8" display="Target Traits" isActive="true" /> | ||
<property name="eedd06e4-e2b8-42f2-b882-c8ae9cecabb8" display="Represents" value="[]" isActive="false" /> | ||
<property name="ff4b18c5-397b-4639-ba79-89939deb9834" display="Default Type Id" isActive="false" /> | ||
<property name="229dcbe7-f000-4ee9-a06a-febad727f7e1" display="Allow Nullable" value="true" isActive="false" /> | ||
<property name="d04ec558-6f6a-462b-b16a-9da1d7b4e9db" display="Allow Collection" value="true" isActive="false" /> | ||
</properties> | ||
</stereotype> | ||
<stereotype stereotypeDefinitionId="f406222b-31a8-435e-80f6-6a08f9108649" name="Settings"> | ||
<addedByDefault>true</addedByDefault> | ||
<definitionPackageName>Intent.ModuleBuilder</definitionPackageName> | ||
<definitionPackageId>9972b2a9-b749-4bba-b5c8-824bf694c6ef</definitionPackageId> | ||
<properties> | ||
<property name="5a9277a9-b808-4ade-bb57-840b51b0da3a" display="Save Mode" value="As Child" isActive="true" /> | ||
<property name="736b1337-6f35-4e38-85a8-69ff5d69fb7d" display="Icon" value="{"source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAACYpJREFUeF7tnGtsFNcVx/93Zt9+YGPzcAAFE0xLSEpTqVWfIimIFgJK1Uj5UKlVVDWqaNUP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||
<property name="32086823-bd72-4be0-a765-2d9530f4ce06" display="Expanded Icon" isActive="true" /> | ||
<property name="b966a8e9-f298-4741-8397-fe49f29c248b" display="Icon Function" isActive="true" /> | ||
<property name="0632053a-6b40-47a0-857f-6840e322344c" display="Display Text Function" value="" isActive="true" /> | ||
<property name="1e5a5798-220b-4a92-993d-c4ebd4123e53" display="Validate Function" value="" isActive="true" /> | ||
<property name="c48d9593-c1f4-4610-9cb3-54de9c2f0c06" display="Allow Rename" value="true" isActive="true" /> | ||
<property name="581e77d6-4587-4041-86f6-880bd57d5848" display="Name Must Be Unique" value="true" isActive="true" /> | ||
<property name="4b17e907-bd58-4f70-b376-383c6046ad8a" display="Allow Abstract" value="false" isActive="true" /> | ||
<property name="ad2bbaa1-becc-477b-83d2-97179678e4bb" display="Allow Static" value="false" isActive="true" /> | ||
<property name="0eb8bcd6-4120-47c5-ac74-9a9e4a7d4536" display="Allow Set Value" value="true" isActive="true" /> | ||
<property name="8ad604ab-7edf-4a6c-86a5-e27f0f95dfac" display="Allow Generic Types" value="false" isActive="true" /> | ||
<property name="ad5ce0fc-72ab-4aa3-92e9-238954c2aedb" display="Allow Sorting" value="true" isActive="true" /> | ||
<property name="3a68e3cb-8014-4c43-9965-f6fc35589d37" display="Sort Children" value="By type then name" isActive="true" /> | ||
<property name="46180320-9a7e-4fe3-8351-f7524612a52c" display="Allow Find in View" value="false" isActive="true" /> | ||
</properties> | ||
</stereotype> | ||
<stereotype stereotypeDefinitionId="b407aace-ad14-484e-ac93-4762a3d182d8" name="[Component]"> | ||
<addedByDefault>false</addedByDefault> | ||
<definitionPackageName>Intent.Modelers.UI</definitionPackageName> | ||
<definitionPackageId>5c4628ec-679e-4f3d-afda-137c978deae0</definitionPackageId> | ||
<properties /> | ||
</stereotype> | ||
</stereotypes> | ||
<metadata /> | ||
<childElements /> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Modules/Intent.Modules.Modelers.UI.Core/Intent.Modelers.UI.Core.imodspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.