Class ViewGroup
public class ViewGroup : AbstractView
Inherited Members
Namespace: HomeSeer.Jui.Views
Assembly: PluginSdk.dll
View groups define a vertical sub-grouping of views with a header.
Constructors
View SourceViewGroup(String)
Create a new instance of a view group with an ID
Declaration
[JsonConstructor]
protected ViewGroup(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The unique ID of the group |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if a view is created with an invalid ID |
ViewGroup(String, String)
Create a new instance of a view group with an ID and Name
Declaration
public ViewGroup(string id, string name = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The unique ID of the group |
System.String | name | The unique ID of the name. DEFAULT: null |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if a view is created with an invalid ID |
Fields
View Source_viewIds
A set of IDs for the views in this group. This is used to ensure that there are no duplicate IDs used.
Declaration
[JsonIgnore]
Dictionary<string, int> _viewIds
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Int32> |
_views
The views to display within this group.
Declaration
[JsonProperty("views", ItemIsReference = true)]
List<AbstractView> _views
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<AbstractView> |
Properties
View SourceViewCount
The number of views that are in this group.
Declaration
[JsonIgnore]
public int ViewCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ViewIds
A list of the IDs of the views in this group
Declaration
[JsonIgnore]
public ReadOnlyCollection<string> ViewIds { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<System.String> |
Views
The views to display within this group. This is for access only. Use AddView(AbstractView) and UpdateViewById(AbstractView) for setting views/updating them
Declaration
[JsonIgnore]
public ReadOnlyCollection<AbstractView> Views { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<AbstractView> |
Methods
View SourceAddView(AbstractView)
Add a view to the group
Declaration
public virtual void AddView(AbstractView view)
Parameters
Type | Name | Description |
---|---|---|
AbstractView | view |
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>)
Add multiple views to the group
Declaration
public virtual void AddViews(IEnumerable<AbstractView> views)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<AbstractView> | views |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The list of views is null |
ContainsViewWithId(String)
Check to see if a view with a specific ID is present in a collection
Declaration
public bool ContainsViewWithId(string viewId)
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId |
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 |
GetStringValue()
Get the value associated with this view as a string if there is one.
Declaration
public override string GetStringValue()
Returns
Type | Description |
---|---|
System.String | The value stored in this view as a string or NULL if there is no value stored. |
Overrides
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown to indicate that this ViewGroup contains other views |
GetViewById(String)
Get the view with a specific ID from a collection
Declaration
public AbstractView GetViewById(string viewId)
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId |
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)
Get the view with a specific ID from a collection cast as the target type
Declaration
public TViewType GetViewById<TViewType>(string viewId)
where TViewType : AbstractView
Parameters
Type | Name | Description |
---|---|---|
System.String | viewId | The ID of the view to get |
Returns
Type | Description |
---|---|
TViewType | The view with the specified ID cast as the target type. |
Type Parameters
Name | Description |
---|---|
TViewType |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | An invalid view ID was entered |
System.ArgumentException | No views are in the group to get |
System.IndexOutOfRangeException | The ID was found, but the view was not. The group is probably malformed and should be recreated. |
System.Collections.Generic.KeyNotFoundException | No views with that ID were found |
MapViewIds()
Build a map of view IDs and list indexes for a collection of views
Declaration
void MapViewIds()
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The list of views to map is null |
RemoveAllViews()
Clear a collection of views
Declaration
public virtual void RemoveAllViews()
SetViews(IEnumerable<AbstractView>)
Set the list of views in this group
Declaration
public virtual void SetViews(IEnumerable<AbstractView> views)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<AbstractView> | views |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The list of views is null |
ToHtml(Int32)
Get a string representation of this view converted into HTML
Declaration
public override string ToHtml(int indent = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | indent |
Returns
Type | Description |
---|---|
System.String | An HTML representation of the view as a string |
Overrides
View SourceUpdate(AbstractView)
Not used by ViewGroups
Declaration
public override void Update(AbstractView newViewState)
Parameters
Type | Name | Description |
---|---|---|
AbstractView | newViewState | The new state of the view being updated. This view's ID and Type must match the calling view exactly |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when the new state of the view is null |
System.InvalidOperationException | Thrown when the new view's ID or Type don't match the calling view |
UpdateViewById(AbstractView)
Perform a soft update to a view in a collection with a particular ID
Declaration
public void UpdateViewById(AbstractView view)
Parameters
Type | Name | Description |
---|---|---|
AbstractView | view |
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)
Declaration
public void UpdateViewValueById(string id, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | |
System.String | value |