Changes

UBIK Templates

15,582 bytes added, 25 March
Added Template Selectors
The UI of {{UBIK}} WinX/UWP client is highly customizable. Project engineers/customizers can tailor the UI for minor style changes or major redesigns according to their needs.
 
= General knowledge =
{{Hint|It's also possible to specify a Suffix for the template selector, e.g.<br><nowiki><tpl:ChildAreaTemplateSelector x:Key="ChildAreaTemplateSelector" Suffix="Small" /></nowiki>.<br>Unlike the custom name template name lookup, the Suffix is no longer considered optional once specified. If such a template file cannot be found, an error template will be used.}}
 
== Template Selectors ==
[[File:Under_Construction.PNG]]
 
In general, Template Selectors return DataTemplates based on the given object. UBIK provides template selectors for different Items & Areas and their logic is explained in the following subsections.
 
=== ChildItemTemplateSelector (UWP & Xamarin) ===
The ChildItemTemplateSelector returns a fitting DataTemplate based on the given child item.
 
<tabs>
<tab name="UWP">
* Returns a custom template if one is configured.
* Otherwise, it returns a ''UBIKProjectItem'' if the given item is a MROViewModel and contains ProjectData (namely if the associated object is a [[MRO_Objects_(Client)#MRO_objects_with_project_information_.28WinX_only.29|MRO object with project information]])
* Otherwise, it returns a ''UBIKTaskItem'' if the given item is a TaskViewModel (namely if the associated object is a [[MRO_Objects_(Client)#Task|Task]])
* If nothing of the above fits, it returns a ''UBIKChildItem''.
</tab>
 
<tab name="Xamarin">
* If the given ContentListItemViewModel is not null:
** If the given item is a TaskViewModel (namely if the associated object is a [[MRO_Objects_(Client)#Task|Task]]) and the TaskItemTemplate is not null, it returns that TaskItemTemplate.
** Otherwise, if the given item is a TaskViewModel (namely if the associated object is a [[MRO_Objects_(Client)#Task|Task]]) & the TaskItemTemplate is null, it returns a ''UBIKTaskItem''.
** If the given MROViewModel contains ProjectData (namely if the associated object is a [[MRO_Objects_(Client)#MRO_objects_with_project_information_.28WinX_only.29|MRO object with project information]]) and the ProjectItemTemplate is not null, it returns that ProjectItemTemplate.
** Otherwise, if the given MROViewModel contains ProjectData (namely if the associated object is a [[MRO_Objects_(Client)#MRO_objects_with_project_information_.28WinX_only.29|MRO object with project information]]) and the ProjectItemTemplate is null, it returns a ''UBIKProjectItem''.
** If nothing of the above fits & the ChildItemTemplate is not null, it returns that ChildItemTemplate.
** If nothing of the above fits & the ChildItemTemplate is null, it returns a ''UBIKChildItem''.
* Returns null if the given ContentListItemViewModel is null.
</tab>
</tabs>
 
=== PropertyDirectItemTemplateSelector (UWP & Xamarin) ===
The PropertyDirectItemTemplateSelector returns a fitting DataTemplate based on the given property item.
<tabs>
<tab name="UWP">
* Returns a non-direct edit template (namely ''UBIKPropertyDirectItemNotSupported''):
** when the given PropertyViewModel is a [[Live_Values|live value]] item or
** if the related property is read only or
** if the object is locked or
** when the object requires authentication.
* Otherwise:
** Returns a ''UBIKPropertyDirectItemList'' if the MetaProperty of the given item has a [[UBIK_Client_Basics#Selective_List_Properties|SelectiveList]].
** Returns a ''UBIKPropertyDirectItemBool'' if the given PropertyViewModel is of type Bool.
** Returns a ''UBIKPropertyDirectItemString'' if the given PropertyViewModel is of type String.
** Returns a ''UBIKPropertyDirectItemInt'' if the given PropertyViewModel is of type Int.
** Returns a ''UBIKPropertyDirectItemDouble'' if the given PropertyViewModel is of type Double.
** Returns a ''UBIKPropertyDirectItemDateTime'' if the given PropertyViewModel is of type DateTime.
** Returns a ''UBIKPropertyDirectItemGuid'' if the given PropertyViewModel is of type Guid.
** Returns a ''UBIKPropertyDirectItemGeoData'' if the givenPropertyViewModel is of type GeoData.
</tab>
<tab name="Xamarin">
* Returns a non-direct edit template (namely ''UBIKPropertyItem''):
** when the given PropertyViewModel is a [[Live_Values|live value]] item or
** if the related property is read only or
** if the object is locked or
** when the object requires authentication.
* Otherwise:
** Returns a ''UBIKPropertyDirectItemList'' if the MetaProperty of the given item has a [[UBIK_Client_Basics#Selective_List_Properties|SelectiveList]].
** Returns a ''UBIKPropertyDirectItemBool'' if the given PropertyViewModel is of type Bool.
** Returns a ''UBIKPropertyDirectItemString'' if the given PropertyViewModel is of type String.
** Returns a ''UBIKPropertyDirectItemInt'' if the given PropertyViewModel is of type Int.
** Returns a ''UBIKPropertyDirectItemDouble'' if the given PropertyViewModel is of type Double.
** Returns a ''UBIKPropertyDirectItemGuid'' if the given PropertyViewModel is of type Guid.
</tab>
</tabs>
 
=== TaskPropertyTemplateSelector (UWP & Xamarin) ===
The TaskPropertyTemplateSelector returns a fitting DataTemplate based on the given task property item.
<tabs>
<tab name="UWP">
* Returns a non-direct edit template (''UBIKTaskProperty''):
** when the PropertyViewModel of the given TaskViewModel (namely if the associated object is a [[MRO_Objects_(Client)#Task|Task]]) is a [[Live_Values|live value]] item or
** if the related property is read only or
** if the object is locked or
** when the objects requires authentication.
* Otherwise:
** Returns a ''UBIKTaskPropertyList'' if the MetaProperty of the given item has a [[UBIK_Client_Basics#Selective_List_Properties|SelectiveList]].
** Returns a ''UBIKTaskPropertyBool'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Bool.
** Returns a ''UBIKTaskPropertyString'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type String.
** Returns a ''UBIKTaskPropertyInt'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Int.
** Returns a ''UBIKTaskPropertyDouble'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Double.
** Returns a ''UBIKTaskPropertyDateTime'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type DateTime.
** Returns a ''UBIKTaskPropertyGuid'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Guid.
** Returns a ''UBIKTaskPropertyGeoData'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type GeoData.
</tab>
<tab name="Xamarin">
* Returns a non-direct edit template (''UBIKTaskProperty''):
** when the PropertyViewModel of the given TaskViewModel (namely if the associated object is a [[MRO_Objects_(Client)#Task|Task]]) is a [[Live_Values|live value]] item or
** if the related property is read only or
** if the object is locked or
** when the objects requires authentication.
* Otherwise:
** Returns a ''UBIKTaskPropertyList'' if the MetaProperty of the given item has a [[UBIK_Client_Basics#Selective_List_Properties|SelectiveList]].
** Returns a ''UBIKTaskPropertyBool'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Bool.
** Returns a ''UBIKTaskPropertyString'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type String.
** Returns a ''UBIKTaskPropertyInt'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Int.
** Returns a ''UBIKTaskPropertyDouble'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Double.
** Returns a ''UBIKTaskPropertyGuid'' if the given TaskViewModels (namely the associated object is a [[MRO_Objects_(Client)#Task|Task]]) Value is of type Guid.
</tab>
</tabs>
 
=== HotSpotTemplateSelector (UWP & Xamarin) ===
The HotSpotTemplateSelector returns a fitting DataTemplate based on the given [[HotSpotting#HotSpots|HotSpot]] item.
<tabs>
<tab name="UWP">
* Returns a ''UBIKAngularLinkHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type LinkHotSpot with HotSpotShape Angular & if the UBIKAngularLinkHotSpot template is not null.
* Returns a ''UBIKRoundLinkHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type LinkHotSpot with HotSpotShape Round & if the UBIKRoundLinkHotSpot template is not null.
* Returns a ''UBIKSignatureHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type [[HotSpotting#SignatureSpot|SignatureSpot]] & if the UBIKSignatureHotSpot template is not null.
* Returns a ''UBIKObjectHotSpot'''' if the given [[HotSpotting#HotSpots|HotSpot]] is of type ObjectHotSpot & if the UBIKObjectHotSpot template is not null.
* Returns a ''UBIKMediaHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type [[HotSpotting#MediaSpot|MediaSpot]] & if the UBIKMediaHotSpot template is not null.
* Returns a ''UBIKInputHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type [[HotSpotting#InputSpot|InputHotSpot]] & if the UBIKInputHotSpot template is not null.
* If nothing of the above fits, it returns a ''UBIKDefaultHotSpot''.
</tab>
<tab name="Xamarin">
* Returns a ''UBIKAngularLinkHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type LinkHotSpot with HotSpotShape Angular & if the UBIKAngularLinkHotSpot template is not null.
* Returns a ''UBIKRoundLinkHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type LinkHotSpot with HotSpotShape Round & if the UBIKRoundLinkHotSpot template is not null.
* Returns a ''UBIKSignatureHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type [[HotSpotting#SignatureSpot|SignatureSpot]] & if the UBIKSignatureHotSpot template is not null.
* Returns a ''UBIKObjectHotSpot'''' if the given [[HotSpotting#HotSpots|HotSpot]] is of type ObjectHotSpot & if the UBIKObjectHotSpot template is not null.
* Returns a ''UBIKMediaHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type [[HotSpotting#MediaSpot|MediaSpot]] & if the UBIKMediaHotSpot template is not null.
* Returns a ''UBIKInputHotSpot'' if the given [[HotSpotting#HotSpots|HotSpot]] is of type [[HotSpotting#InputSpot|InputHotSpot]] & if the UBIKInputHotSpot template is not null.
* If nothing of the above fits, it returns a ''UBIKDefaultHotSpot''.
</tab>
</tabs>
 
=== ProfileItemTemplateSelector (UWP) ===
* The ProfileItemTemplateSelector returns a ''UBIKProfileItem'' if the given item is a Profile file.
* If the given item is a folder, it returns a ''UBIKProfileFolder''.
 
=== RootItemTemplateSelector (UWP) ===
The RootItemTemplateSelector returns a fitting DataTemplate based on the given root item.
 
* Returns a custom template if one is configured.
* Otherwise:
** It returns a ''UBIKProjectItem'' if the given item is a MROViewModel and contains ProjectData (namely if the associated object is a [[MRO_Objects_(Client)#MRO_objects_with_project_information_.28WinX_only.29|MRO object with project information]]).
** It returns a ''UBIKTaskItem'' if the given item is a TaskViewModel (namely if the associated object is a [[MRO_Objects_(Client)#Task|Task]]).
* If nothing of the above fits, it returns a ''UBIKMainItem''.
 
=== ComboBoxItemTemplateSelector (UWP) ===
* The ComboBoxItemTemplateSelector returns a ''DropDownItemTemplate'' for drop-down list items.
* Otherwise, it returns a ''ComboBoxSectionItemTemplate'' (for the selected item when the drop-down list is closed).
 
=== ChildAreaTemplateSelector (UWP) / ChildAreaTemplateConverter (Xamarin) ===
<tabs>
<tab name="UWP">
The ChildAreaTemplateSelector returns a fitting template for a given context object according to the following rules:
* If the context object is classified with the [[SYSCLS_CHILDAREATEMPLATE|ChildAreaTemplate Classification]] and carries a valid child area template name:
** Tries to return a custom template with the name of CustomTemplateName + Suffix;
** If not found, returns an error template (strict policy on) or goes to rule 2 (strict policy off).
* Otherwise:
** Tries to return a custom template with the name ''UBIKChildArea'' + Suffix;
** If not found, it returns an error template.
</tab>
<tab name="Xamarin">
The ChildAreaTemplateConverter returns a fitting child area template for a given ContentViewModel if it's classified with the [[SYSCLS_CHILDAREATEMPLATE|ChildAreaTemplate Classification]].
* Returns null if the given ViewModel is not a ContentViewModel.
* Returns a default template named ''UBIKChildArea'' if no specific template is found.
</tab>
</tabs>
 
=== ContentAreaTemplateSelector (UWP) / ContentAreaTemplateConverter (Xamarin) ===
<tabs>
<tab name="UWP">
The ContentAreaTemplateSelector returns a fitting template for a given context object according to the following rules:
* If the context object is classified with the [[SYSCLS_CONTENTAREATEMPLATE|ContentAreaTemplate Classification]] and carries a valid content area template name:
** Tries to return a custom template with the name of CustomTemplateName + Suffix;
** If not found, returns an error template (strict policy on) or goes to rule 2 (strict policy off).
* Otherwise:
** Tries to return a custom template with the name of ''UBIKContentArea'' + Suffix;
** If not found, it returns an error template.
</tab>
<tab name="Xamarin">
The ContentAreaTemplateConverter returns a fitting content area template for a given ContentViewModel if it's classified with the [[SYSCLS_CONTENTAREATEMPLATE|ContentAreaTemplate Classification]].
* Returns null if the given ViewModel is not a ContentViewModel.
* Returns a default template named ''UBIKContentArea'' if no specific template is found.
</tab>
</tabs>
 
=== PropertyEditorItemTemplateSelector (UWP) / EditTemplateConverter (Xamarin) ===
<tabs>
<tab name="UWP">
The PropertyEditorItemTemplateSelector dynamically selects a fitting DataTemplate based on the type of the given property.
* Returns a ''UBIKEditBool'' template if the MetaProperty type of the given Property is of type Bool.
* Returns a ''UBIKEditString'' template if the MetaProperty type of the given Property is of type String.
* Returns a ''UBIKEditInt'' template if the MetaProperty type of the given Property is of type Int.
* Returns a ''UBIKEditDouble'' template if the MetaProperty type of the given Property is of type Double.
* Returns a ''UBIKEditDateTime'' template if the MetaProperty type of the given Property is of type DateTime.
* Returns a ''UBIKEditGuid'' template if the MetaProperty type of the given Property is of type Guid.
* Returns a ''UBIKEditSignature'' template if the MetaProperty type of the given Property is of type Signature.
* Returns a ''UBIKEditChart'' template if the MetaProperty type of the given Property is of type Chart.
</tab>
<tab name="Xamarin">
The EditTemplateConverter returns a fitting EditTemplate from a Property item.
* Returns null if the current editor’s PropertyViewModel instance is null.
* Returns a "UBIKEditBool" if the given PropertyItem is of type Bool.
* Returns a "UBIKEditString" if the given PropertyItem is of type String.
* Returns a "UBIKEditInt" if the given PropertyItem is of type Int.
* Returns a "UBIKEditDouble" if the given PropertyItem is of type Double.
* Returns a "UBIKEditDateTime" if the given PropertyItem is of type DateTime.
* Returns a "UBIKEditGuid" if the given PropertyItem is of type Guid.
* Returns a "UBIKEditGeo" if the given PropertyItem is of type GeoData.
* Returns a "UBIKEditSignature" if the given PropertyItem is of type Signature.
* Returns a "UBIKEditNotSupported" if the given PropertyItem is of type XML, ByteStream, Geography, Undefined or FileReference.
* Otherwise, it returns null if no specific template is found.
</tab>
</tabs>
[[File:Under_Construction_End.PNG]]
[[Category:Client|UBIK Templates]]
[[Category:UBIK|UBIK Templates]]
[[Category:WinX|UBIK Templates]]
257
edits