Class ViewCollectionHelper
static class ViewCollectionHelper
Inheritance
Inherited Members
Namespace: HomeSeer.Jui.Views
Assembly: PluginSdk.dll
Methods
View SourceAddView(AbstractView, ref List<AbstractView>, ref Dictionary<String, Int32>, Boolean)
Add a view to a collection
Declaration
static void AddView(AbstractView view, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds, bool toGroup = false)
Parameters
Type | Name | Description |
---|---|---|
AbstractView | view | The view to add to the collection |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
System.Boolean | toGroup | If the collection the view is being added it is a ViewGroup. DEFAULT: false for a Page |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The view or its ID is null |
System.ArgumentException | There is already a view with the same ID present in the collection |
System.InvalidOperationException | Thrown when trying to add a ViewGroup to another ViewGroup |
ViewTypeMismatchException | Thrown when a view group's type does not match its class |
AddViews(IEnumerable<AbstractView>, ref List<AbstractView>, ref Dictionary<String, Int32>, Boolean)
Add multiple views to a collection
Declaration
static void AddViews(IEnumerable<AbstractView> views, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds, bool toGroup = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<AbstractView> | views | The views to add to the collection |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
System.Boolean | toGroup | If the collection the views are being added it is a ViewGroup. DEFAULT: false for a Page |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The list of views is null |
ContainsViewWithId(String, ref List<AbstractView>, ref Dictionary<String, Int32>)
Check to see if a view with a specific ID is present in a collection
Declaration
static bool ContainsViewWithId(string viewId, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId | The ID of the view to look for |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the view exists in the collection; FALSE if it does not exist in the collection |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The viewId to look for is NULL |
System.IndexOutOfRangeException | The ID was found, but the view is not in the collection |
GetViewById(String, ref List<AbstractView>, ref Dictionary<String, Int32>)
Get the view with a specific ID from a collection
Declaration
static AbstractView GetViewById(string viewId, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId | The ID of the view to look for |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
Returns
Type | Description |
---|---|
AbstractView | The view with the specified ID |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The viewId to look for is NULL |
System.IndexOutOfRangeException | The ID was found, but the view is not in the collection |
System.ArgumentException | There are no views in the collection |
ViewNotFoundException | No views with that ID were found in the collection |
ViewTypeMismatchException | Thrown when a view group's type does not match its class |
GetViewById<TViewType>(String, ref List<AbstractView>, ref Dictionary<String, Int32>)
Get the view with a specific ID from a collection cast as the target type
Declaration
static TViewType GetViewById<TViewType>(string viewId, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
where TViewType : AbstractView
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId | The ID of the view to look for |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
Returns
Type | Description |
---|---|
TViewType | The view with the specified ID cast to the target type |
Type Parameters
Name | Description |
---|---|
TViewType |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The viewId to look for is NULL |
System.IndexOutOfRangeException | The ID was found, but the view is not in the collection |
System.ArgumentException | There are no views in the collection |
ViewNotFoundException | No views with that ID were found in the collection |
ViewTypeMismatchException | Thrown when a view group's type does not match its class |
MapViewIds(List<AbstractView>, out Dictionary<String, Int32>, Boolean)
Build a map of view IDs and list indexes for a collection of views
Declaration
static void MapViewIds(List<AbstractView> viewList, out Dictionary<string, int> viewIds, bool calledByGroup = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
System.Boolean | calledByGroup | Whether the method was called by a ViewGroup or not. Prevents infinite recursion. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The list of views to map is null |
RemoveAllViews(out List<AbstractView>, out Dictionary<String, Int32>)
Clear a collection of views
Declaration
static void RemoveAllViews(out List<AbstractView> viewList, out Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
RemoveViewById(String, ref List<AbstractView>, ref Dictionary<String, Int32>)
Remove a view with the specified ID from the collection.
Remaining views at indexes greater than the specified view will be moved down one index to fill the empty space
Declaration
static void RemoveViewById(string viewId, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId | The ID of the view to remove |
System.Collections.Generic.List<AbstractView> | viewList | The current list of views in the collection |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | The current view ID to index map for the collection |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the supplied parameters is null of empty |
System.ArgumentException | Thrown when the number of items in the |
System.Collections.Generic.KeyNotFoundException | Thrown when a view with the specified ID was not found |
RemoveViewsAfterId(String, ref List<AbstractView>, ref Dictionary<String, Int32>)
Trim all views in the collection following the view with the specified ID
Declaration
static void RemoveViewsAfterId(string viewId, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId | The ID of the view that should be at the end of the collection |
System.Collections.Generic.List<AbstractView> | viewList | The current list of views in the collection |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | The current view ID to index map for the collection |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the supplied parameters is null of empty |
System.ArgumentException | Thrown when the number of items in the |
SetViews(IEnumerable<AbstractView>, ref List<AbstractView>, ref Dictionary<String, Int32>, Boolean)
Set the collection of views
Declaration
static void SetViews(IEnumerable<AbstractView> views, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds, bool toGroup = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<AbstractView> | views | The new state of the collection |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
System.Boolean | toGroup | If the collection the views are being added it is a ViewGroup. DEFAULT: false for a Page |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The list of views is null |
UpdateViewById(AbstractView, ref List<AbstractView>, ref Dictionary<String, Int32>)
Perform a soft update to a view in a collection with a particular ID
Declaration
static void UpdateViewById(AbstractView view, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
AbstractView | view | The new state of the view to update |
System.Collections.Generic.List<AbstractView> | viewList | A reference to the current list of views |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds | A reference to the map of view IDs and list indexes |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The viewId to look for is NULL |
System.IndexOutOfRangeException | The ID was found, but the view is not in the collection |
System.ArgumentException | There are no views in the collection |
ViewNotFoundException | No views with that ID were found in the collection |
UpdateViewValueById(String, String, ref List<AbstractView>, ref Dictionary<String, Int32>)
Declaration
static void UpdateViewValueById(string id, string value, ref List<AbstractView> viewList, ref Dictionary<string, int> viewIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | |
System.String | value | |
System.Collections.Generic.List<AbstractView> | viewList | |
System.Collections.Generic.Dictionary<System.String, System.Int32> | viewIds |