The Item ribbon tab feature offers visibility options for view buttons when the associated views are not available for the selected item type. The options come in the form of two attributes: hideIfDisabled and visibility. They enable you to define the visibility behavior of a view button and, subsequently, ribbon groups in various ways. This article first provides an explanation of the default behavior of unavailable view buttons on a ribbon and then presents some configuration examples of the view button visibility options in item ribbon configuration.


Prerequisites


Default Behavior of Unavailable View Buttons

It is good to be aware of the default behavior if you do not use the optional visibility options. By default, a ribbon group will be visible for a user when at least one menu option in the group becomes active. Whether or not an option becomes available will depend on the type of item that is selected in the structure tree. If a menu option is grayed out, it is because it is not available for the item type currently selected. It will become active when an item type that is associated with its use is selected. If none of the menu options in a group are activated by the selected item, the ribbon group will not display.  


In the below example, the "Brake Control System" item is an item type called Design function and it is associated with the menu option Requirements Traceability. Because it is selected in the tree, the option is available for use. The "BrakeBoosterSensingUnit" item is an item type called Software component and it is associated with the Requirement Signal Mapping menu option. That option is grayed out since a Software component item is not selected.



Visibility Property

For your reference, Configure the explorer provides information about visibility for each item view in SystemWeaver.

The Visibility column on the Item views tab indicates when a view is available/visible. The availability/visibility conditions can be very complex and are, for some views, configurable. 



sid: B(Base Item)Available for all item types
configurableCan be configured for specific applications and uses cases
sid: XXXX(item type)Hard-coded view available for specific meta models, patterns, SIDs
sid: context: XXXX(item type)Hard-coded view available for specific meta models, patterns, SIDs in a specific context
customHard-coded view available for specific SID(s) and containing custom logic

Visibility Options in Item Ribbon Tab Feature

The following two attributes can be used to define the dynamic behavior of an ItemView button (and indirectly the ribbon group, item tab and context). These are optional.


<ItemView name="" configId="" visibility="" hideIfDisabled=""/>


visibility

This attribute defines the visibility of the ribbon group. There are three possible values:

  • Ignore: the item view is not be activated by item selection. Activation is instead depend on activation of other views or item links in the same ribbon group. In other words, we ignore the button when the item type for which it is configured is selected and ignore it when none of the other buttons are activated, but as soon as one of the other buttons is activated, the "ignored" button is shown. If all buttons in a ribbon group are set to visibility="Ignore", then the group will not be visible at all. "Ignore" cannot be applied in a ribbon group where "Always" is in use, i.e., they cannot be combined in a ribbon group. 
  • Always: the item view and ribbon group will always be available. If an "Always" button is used together with a "Dynamic" button in a ribbon group, the "Always" will apply for the group. 
  • Dynamic: activation of the item view will depend on the specific view and the item being selected in the item structure tree, according to standard view activation (This is default behavior). 


hideIfDisabled

As mentioned above, by default, if a view button is not applicable to a selected item type, it continues to display, but with gray text. 


Here, "Model Flow" is not an applicable/usable option with the selected item type: 



The hideIfDisabled attribute provides a different behavior. If set to "true", the button will be hidden if it is not applicable to the selected item type. If there are no other buttons in the ribbon group, the group itself will be hidden as well. Setting this attribute to "false" results in default behavior for the button, i.e., the button continues to display, but with gray text. 


Configuration Examples


Visibility="Always"

<ItemRibbonTabConfig>
  <ItemTabs>
	<ItemTab caption="Help">
	  <RibbonGroups>>
		<RibbonGroup caption="Help"> 
			<ItemView name="Grid" configItem="CNDE:ValidateHARA"/>
			<ItemView name="XXXGraph" configItem="4BAS:ModelFlow" visibility="Always"/>
		</RibbonGroup>
	  </RibbonGroups>
	</ItemTab>
  </ItemTabs>
</ItemRibbonTabConfig>


The ribbon group will always be visible.



Visibility="Ignore"

<ItemRibbonTabConfig>
    <ItemTabs>
        <ItemTab caption="Help">
            <RibbonGroups>
                <RibbonGroup caption="Resources" merge="true">
                    <ItemView name="XXXGraph" configItem="4BAS:ModelFlow"/>
                    <OpenItem id="x3400000000005264" visibility="Ignore"/> 
                </RibbonGroup>
            </RibbonGroups>
        </ItemTab>
    </ItemTabs>
</ItemRibbonTabConfig>

The ribbon group (and the item button set to "Ignore") will only be visible when a button NOT set to "Ignore" is activated. In this example, the "Model Flow" item view button is activated, so the OpenItem button displays as well. 



If the item view button is not activated, the group will be hidden. In this example, since there are no other ribbon groups on the "Help" tab, the tab itself is also hidden. 



hideIfDisabled="true"

This first example is for a custom ribbon group on the Items tab. The button for the XXXGraph config item for item type 4BAS is hidden from view when the selected item is not of type 4BAS. In other words, the button is disabled and will appear only if an item of type 4BAS is selected.

<ItemRibbonTabConfig>
<ItemTabs>
<ItemTab caption="Items">
<RibbonGroups>>
<RibbonGroup caption="Help" merge="true">
<ItemView name="Grid" configItem="CNDE:ValidateHARA"/>
<ItemView name="XXXGraph" configItem="4BAS:ModelFlow" hideIfDisabled="true"/>
</RibbonGroup>
</RibbonGroups>
</ItemTab>
</ItemTabs>
</ItemRibbonTabConfig>


below, the ribbon group on the custom "Help" tab will always display (due to visibility="Always"), but the XXXGraph config item view button will be hidden if the selected item is not of type 4BAS (or its sub-types).

<ItemRibbonTabConfig>
<ItemTabs>
<ItemTab caption="Help">
<RibbonGroups>
<RibbonGroup caption="Resources" merge="true">
<ItemView name="XXXGraph" configItem="4BAS:ModelFlow" hideIfDisabled="True"/>
<OpenItem id="x3400000000005264" visibility="Always"/>
</RibbonGroup>
</RibbonGroups>
</ItemTab>
</ItemTabs>
</ItemRibbonTabConfig>