When working on large diagrams modellers often need to identify certain elements that are of particular interest to them.
Some examples of element selection are:
- Elements which have no value for a particular property (for example the Description)
- Elements who share the same value for a particular property (for example Status or Phase)
- Elements that were written by a particular person
- Elements that have (or have not) been modified since a certain date
Diagram Filters functionality was added to Enterprise Architect version 8.0. Currently the Diagram Filters function only operates on Elements that are visible on a diagram (but the same Diagram Filters can be applied to diagrams of different types). They work by using a slimmed down version of the Search Filters already built-into Enterprise Architect, but instead of returning a list as a result of the search, the appearance of the Elements on the diagram can be changed.
There are four effects that can be applied when Diagram Filters are in use on a diagram, these are:
- Fade – display all elements that do not match the filter criteria in a pale version of the diagram background
- Gray Scale – display all elements that do not match the filter criteria in pale grey
- Hide – conceal all elements that do not match the filter
- Select – select all those elements that do match the filter criteria
Initially the above seems confusing, but when you see the Diagram Filters in action, the effects described above will become more intuitive. It must be noted that any one of the four effects can be applied with any Diagram Filter, that is to say, the effect is not part of the Diagram Filter but rather it controls how the filter is applied to the diagram.
A simple example should clarify matters. It is common modelling practice that all Elements on a diagram be elaborated with a textual description, captured in the Notes property of an Element within Enterprise Architect.
Some modellers add these notes as they create elements whereas others do not, so if we imagine a project team working collaboratively, how can each member of the team identify which elements have notes and which do not? Although there are many possible solutions to this problem, this example will illustrate a simple solution using Diagram Filters.
- Open a diagram and then select View | Diagram Filters from the main menu to open up the Diagram Filters view (as shown below)
- Create a new Diagram Filter, by clicking on the toolbar icon
- Give the Diagram Filter a suitable name, for this example I have used Needs Description
- Create a Diagram Filter by completing the following dialog
- In this example we need a simple filter that tests the value of the Notes property to be Equal to nothing. The condition is selected from a drop down list
- After setting these options our filter now looks like
- Click OK
- The Diagram Filter is now added to the list of available filters (it is perfectly feasible to have many Diagram Filters defined and apply them in many different combinations)
- To apply the filter to the current diagram, use the Drop Down list (Fade, Gray Scale, Hide, Select…) to set the effect and click the check box next to the Diagram Filter name.
The following images illustrate the application of the Diagram Filter for each of the four effects.
Fade out those elements that do have a description leaving those elements that need a description
Colour grey out those elements that do have a description leaving those elements that need a description
Hide those elements that do have a description leaving those elements that need a description
Select these elements that do need a description leaving those elements that have a description unselected.
The modeller is able to identify quickly and easily those elements that require a description to be added.
For some diagrams with many different element types, a filter setting for a particular Object Type could be added to the filter testing for the empty Notes property. Currently, Diagram Filters cannot use a search term, so a separate Diagram Filter would have to be created for each element type.
- If a Diagram Filter has been applied to a diagram (or diagrams) and documentation is produced, then the effect of the filter will be replicated in the documentation output.
- Also the application of a diagram filter does not mark the diagram as unsaved, hence if a Diagram Filter is applied, then diagram closed, when the diagram is re-opened the Diagram Filter is not applied despite the fact that it may still be checked in the Diagram Filters view.
In this tutorial, we have described how use Diagram Filters to “fine tune” the appearance of diagrams. Diagram Filters are a potentially valuable aid to modellers, particularly those who work in a collaborative modelling environment.
You can read more articles like this on our blog.