With the new framework, a new possibility has been created to make properties clickable in the Object Browser. By clicking on a property, you can call internal as well as external services.
It is also possible to store several targets to a property. If there are several targets/handlers for a property, a popup menu appears in which the desired one can be selected. By clicking the right mouse-button, a checkbox is also displayed which can be used to define the default value for the right click. This option does not exist when clicking the left mouse-button since the complete list is always displayed then.
The easiest way to make a property clickable is through preferences. For this, you have to maintain the following preferences:
Object type-independent
om.obr.url.<UNIQUE_ID>.<FIELD_TABLE_TYPE>.<FIELD_NAME> = <URL offset by tokens> om.obr.url.<UNIQUE_ID>.<OBJECT_TYPE>.<PROPERTY> = <URL offset by tokens>
With object type-specific restriction
om.obr.url.<OBJECT_TYPE>.<UNIQUE_ID>.<FIELD_TABLE_TYPE>.<FIELD_NAME> = <URL offset by tokens> om.obr.url.<OBJECT_TYPE>.<UNIQUE_ID>.<OBJECT_TYPE>.<PROPERTY> = <URL offset by tokens>
<UNIQUE_ID> = Comparable to a GUID, or a counter. Serves as a distinguishing feature, so that you can configure several handlers for the same property.
It is not a counter but alphanumeric, because with e.g. add-ons these handlers can be provided without having to know about other handlers.
Example: HANDLER4711, UGS1, WRD4
<PROPERTY> = Can be internal ObrProperty-ID, or an external representation of an ObrProperty-ID (like macros)
The tokens are structured as follows: $(<FIELD_ID>)
<FIELD_ID>:
- <FIELD_TABLE_TYPE>*<FIELD_NAME>
- XX::<OBJECT_TYPE>*<PROPERTY_KEY> (internal use only, not forwarded to OSGI)
<FIELD_ID> always references the internal property value, if you want to reference the display value you have to add the suffix ::DISP_VAL to the <FIELD_ID>.
By default, only URLs with the protocols sapplm://, http://, https:// (and which still support Java) are supported.
You can use the SPI service UrlProtocolHandler, which supports additional Url protocols.
Examples
om.obr.url.MAT.SUPERMATTOOLHANDLER.MARA.MATNR=https://super.material.tool.com/$(MARA*MATNR)-$(MARA*MTART) <- Handler on MARA-MATNR only for materials om.obr.url.SUPERMATTOOLHANDLER.MARA.MATNR=https://super.material.tool.com/$(MARA*MATNR)-$(MARA*MTART) <- Handler on MARA-MATNR for all objects that have this property om.obr.url.DOC.SUPERMATTOOLHANDLER.MARA.MATNR=https://super.material.tool.com/$(MARA*MATNR) <- Handler on MARA-MATNR only for documents
The following three definitions are equivalent:
om.obr.url.DOC.UGSUSERHANDLER1.DOC.USER=https://www.google.com/search?q=$(USER)&oq=$(USER) <- Via mapped property om.obr.url.DOC.UGSUSERHANDLER2.DOC.7=https://www.google.com/search?q=$(XX:DOC*7)&oq=$(XX:DOC*7) <-Internal <FIELD_ID> om.obr.url.DOC.UGSUSERHANDLER3.DRAW.DWNAM=https://www.google.com/search?q=$(DRAW*DWNAM)&oq=$(DRAW*DWNAM) <- <FIELD_ID>
The dictionary keys correspond to the preference keys.
Note
If tokens have been defined in a URL and an object does not have them, then the token will be replaced with an empty string!
In such cases, it is important to restrict the token to the correct object types.If you don't want to limit yourself to URLs, you can also implement other services.
This is for normal ECTR addons via the SPI LinkHandlerProviderService which provides LinkHandler implementations and for OSGI plugins via the PluginObjectBrowserLinkHandlerProvider interface of the PluginObjectBrowserLinkHandler implementations.
The LinkHandlerProviderServices receives a selector consisting of <OBJECT_TYPE>, <TABLE_TYPE>, <PROPERTY_KEY>, <FIELD_ID> and <LEGACY_FIELD_ID>.
Based on these selectors the LinkHandlerProviderService can decide if and which linkhanlder (plural) are delivered for the property.
The PluginObjectBrowserLinkHandlerProvider receives a <FIELD_ID> which he uses to decide whether and which PluginObjectBrowserLinkHandlers will be delivered.
The selected LinkHandler gets as input a <FIELD_ID> and a map with all real and derived properties of the corresponding object.
The map looks like this <FIELD_ID> -> <VALUE>. The <FIELD_ID>s and <VALUE>s are of type String.
Format of the values:
DateObjects: YYYYMMTTHHmmSS -> internal value, ObrProperty#formatValue -> ::DISP_VAL GxKeyValue: Key -> internal value, value -> ::DISP_VAL Everything else: (ObrProperty#getValue)#toString -> internal value, (ObrProperty#formatValue)#toString -> ::DISP_VAL
Panels that provide this functionality can additionally add properties derived by a mechanism to the map.