Diagram Services

1. Palette

The palette computed in a diagram can be customized by using a service implementing either of those interfaces:

  • o.e.s.c.collaborative.diagrams.palette.api.IDiagramPaletteCustomizer

  • o.e.s.c.collaborative.diagrams.palette.api.IDiagramConnectorPaletteCustomizer

The IDiagramPaletteCustomizer is used to perform any change in a palette computed for the diagram itself, any diagram element or any set of diagram elements selected. On the other hand, the IDiagramConnectorPaletteCustomizer can be used to change the palette computed while using the connector tool which is mostly used to create edges between diagram elements.

A service implementing any of those interfaces can add, transform or even remove any tools, tool sections or quick access tools from the computed palette.

The tool of a diagram palette can be overridden using the paletteToolOverrideExtensionPoint. Some configuration is required to make an overridden tool work with the last tool used & the search feature of the palette. Some props are available to make it easier.

For a diagram, using the canHandle: (representationKind: string, tool: GQLTool) method, the value of representationKind will be DIAGRAM_REPRESENTATION_KIND (exported from the diagram package).

1.1. Last tool used

The last tool used is displayed on top the tool section. You need to call the prop onInvoked() after the execution of a tool to set it as the last tool used.

1.2. Search feature

The current searched value is available from the prop searchedValue. Palette package export the function fuzzyMatch = (candidate: string, searchTerm: string): MatchResult. If there is a searchedValue you need to test your label with fuzzyMatch it in order to know if the tool is candidate. If there is a searchedValue but the attributed matches of MatchResult is false then the contributed component should not render.