Currently how an attribute and its items are displayed are based on the style (including item views) stored in the View information. For example:
<View Type="Instanced" Title="General">
<InstancedAttributes>
<Att Name="numerics-att" Type="numerics" />
<Att Name="outputs-att" Type="outputs">
<ItemViews>
<View Path="/output-times" ImportFromFile="true" LoadButtonText="Import from File"
FileFormat="Double" BrowserTitle="Import from Double File"
ValueSeparator="," CommentChar="#" FileExtensions="Time Files (*.txt *.csv *.dat)"/>
</ItemViews>
</Att>
<Att Name="simulation-control-att" Type="simulation-control" />
</InstancedAttributes>
</View>
Shows an Instanced View Description that includes style information for an outputs attribute. This allows the designer to provide customization for attributes displayed within a View.
The downside of this approach is that if you wanted an Attribute to be displayed in two different Views you would have to make sure you copied the style exactly. The other downside is when creating an item’s expression using the attribute editor dialog. Currently there is no way to specify the style for the attribute and if we did, it would have to store under the item referring to it which seems wrong.
Proposed Extension
Create a Style Section inside the View Configuration information. When an attribute is about to be displayed, the View or Editor would first look to see if the it contains a style specification. If it does it would use it (this is the current behavior), but if it doesn’t it would ask the UIManager (eventually it would be the View Manager but thats still a work in progress) to see if it has a Style for the attribute and it did find one it would use it.
Several styles, each with a unique style name, could be registered to the same attribute definition. These styles could then be referenced in a View Configuration. In addition, a default style (Name="") could also be defined. Default styles would not need to be explicitly referenced within a View Configuration.
Styles can also be inherited. If an attribute’s Definition did not have a Style defined but it’s base definition did, then that Style would be applied (this would work with both named and default Styles).
So in the above we would have something like this:
The following is a default style example in XML:
<!-- Style specifications -->
<Styles>
<Att Type="outputs">
<Style>
<ItemViews>
<View Path="/output-times" ImportFromFile="true" LoadButtonText="Import from File"
FileFormat="Double" BrowserTitle="Import from Double File"
ValueSeparator="," CommentChar="#" FileExtensions="Time Files (*.txt *.csv *.dat)"/>
</ItemViews>
</Style>
</Att>
</Styles>
The following shows an example of using a named style:
<!-- Style specifications -->
<Styles>
<Att Type="outputs">
<Style Name="foo">
<ItemViews>
<View Path="/output-times" ImportFromFile="true" LoadButtonText="Import from File"
FileFormat="Double" BrowserTitle="Import from Double File"
ValueSeparator="," CommentChar="#" FileExtensions="Time Files (*.txt *.csv *.dat)"/>
</ItemViews>
</Style>
</Att>
</Styles>
<Views>
<View Type="Instanced" Title="General">
<InstancedAttributes>
<Att Name="outputs-att" Type="outputs" Style="foo"/>
</InstancedAttributes>
</View>
</Views>
Comments?