category property

String get category

Gets or sets the category of this part, typically used to distinguish different kinds of nodes or links.

The initial value is an empty string, which is the default category. Any new value must be a string. This should not be set in templates.

When building Parts for node data or link data in a model, the Diagram will call Model#getCategoryForNodeData or GraphLinksModel#getCategoryForLinkData to get the category string for the data object. The diagram uses this value to look up a template in Diagram#nodeTemplateMap, Diagram#linkTemplateMap or Diagram#groupTemplateMap. That template is copied to create the actual Part that is added to the diagram. The diagram will set this property to remember the category it used.

Note that the class of the new Part must be the same as the class of the original Part. For example, a Node cannot be replaced by a simple Part or vice-versa. Nor can a Link be replaced by a subclass of Link or vice-versa.

To change the category for a Part created for model data, call Model#setCategoryForNodeData or GraphLinksModel#setCategoryForLinkData.

This property is also used to distinguish Adornments on a Part. In this scenario you create the Adornment, often indirectly by specifying a template, and set this property explicitly. For example, ResizingTool#updateAdornments creates a resizing Adornment from the Part#resizeAdornmentTemplate and sets its category to be "Resizing". Changing the category of an existing Adornment will update any adorned part's association.

Implementation

_i2.String get category => _i4.getProperty(
      this,
      'category',
    );
set category (String value)

Implementation

set category(_i2.String value) {
  _i4.setProperty(
    this,
    'category',
    value,
  );
}