Enhancement
Critical
Major
Detail
Detail
If one creates a new type A` without a supertype, gives it an attribute `name, instances of this type are displayed in some places via the value in their name attribute (e.g. in references pointing to type A`). In other places you get the display `AttributedWrapper(type:my.app:A, id: GenericObject:3848, name: A3), e.g. in the title of the context menu for an object of type A and in tooltips.
- Fascinatingly, the problem seems to disappear after restarting the application.
- The problem also does not seem to occur all the time.
Analysis
When the problem occurs, the newly created type has inconsistent ResourceProviders and LabelProviders registered. The reference display uses the tl:ResourceProvider, but the title display in the context menu and the name display in the tooltip use the LabelProvider.
The problem occurs as follows: After restarting the application, the LabelProviderService caches are empty to the extent that only the directly configured Type->LabelProvider mappings are entered. For the problem to occur, the first compartment object for which a label is requested must be a New-Object of a Grid.
A Grid-New-Object is considered like a (transient) compartment object, but it very well has a model type (the type that is being instantiated). In this case the type of the Grid-New-Object is the just created model type 'A' (see test case description). There is no configured label provider for this model type. Therefore, the search for a label provider falls back to the Java class hierarchy. But also there no label provider is found, because only for com.top_logic.knowledge.wrap.AbstractWrapper a label provider is stored, but the Grid-New-Object does not derive from AbtractWrapper. Therefore, the DefaultLabelProvider is found and then registered in the cache for the newly created model type. If a real object of type A` is to be rendered afterwards, the `DefaultLabelProvider is found in the c ache. If a LabelProvider for a real A` object had been requested first , then the LabelProvider"com.top_logic.knowledge.gui.WrapperResourceProvider" registered for`AbstractWrapper" would have been found via the Java class hierarchy.
Test
Attention: The problem only occurs if you follow the order exactly:
- Create new app.
- Define new type A.
- Give the type a name attribute name.
- Switch to the instance view for A.
- Create new row in the grid, do not save or apply.
- Show context menu for the new row.
- Fill values and save.
- Give demo type a reference to itself.
- Create two instances a1 and a2 of A.
- Leta1 refer to a2.
- Display the tooltip of the reference value.