public abstract class ElementResolver<T> extends Object
A custom resolver responsible for correctly identifying each element displayed in, e.g. a combo box user input.
Extend/override this class to create a custom element resolver for proprietary (custom) types. If the element type is
unknown to PolyScope, this resolver is used. Consider using this approach even for String
elements, if
translations should be supported. Then it is possible to correctly identify an element if the language is changed.
Constructor and Description |
---|
ElementResolver() |
Modifier and Type | Method and Description |
---|---|
String |
getDisplayName(T element)
This method should return the name of an element.
|
abstract String |
getId(T element)
This method should return an identifier to uniquely identify an element.
|
public abstract String getId(T element)
This method should return an identifier to uniquely identify an element. The identifier will be used for persistence and resolving of elements. Therefore the identifier should remain constant over time and versions of the Gripper URCap.
This method must be implemented.element
- the element to identifypublic String getDisplayName(T element)
This method should return the name of an element. The name will be displayed in the UI, e.g. in a combo box. The name returned is allowed to change over versions of the driver URCap as well as be different depending on the current language selected in Polyscope, if translations are supported.
Override this method if the return value of theObject.toString()
method is not appropriate.element
- the element to get the display name forCopyright © 2020. All rights reserved.