Interface IXViewerPreComputedColumn
- All Known Implementing Classes:
XViewerPreComputedColumnAdapter
public interface IXViewerPreComputedColumn
Columns that implement this interface will be given a chance to compute their values in the background before the
XViewer is loaded. Any item that does not have a value (null or otherwise) in preComputedValueMap will call getText
as normal.
Important: XViewer.setInputXViewer(Object input) should be called instead of XViewer.setInput for precomputed columns to work.
Important: XViewer.setInputXViewer(Object input) should be called instead of XViewer.setInput for precomputed columns to work.
-
Method Summary
Modifier and Type Method Description java.lang.Long
getKey(java.lang.Object obj)
Called to get index for element for retrieval of cached text valuejava.lang.String
getText(java.lang.Object obj, java.lang.Long key, java.lang.String cachedValue)
Optional method available to make other checks during loading or otherwise change the cached value.void
populateCachedValues(java.util.Collection<?> objects, java.util.Map<java.lang.Long,java.lang.String> preComputedValueMap)
Called in a background thread to populate values in XViewerColumn.preComputedValueMap.
-
Method Details
-
getKey
java.lang.Long getKey(java.lang.Object obj)Called to get index for element for retrieval of cached text value -
populateCachedValues
void populateCachedValues(java.util.Collection<?> objects, java.util.Map<java.lang.Long,java.lang.String> preComputedValueMap)Called in a background thread to populate values in XViewerColumn.preComputedValueMap. For best performance, each item in table should have an entry here and should not be null. See getText comment for cases where null is found. -
getText
java.lang.String getText(java.lang.Object obj, java.lang.Long key, java.lang.String cachedValue)Optional method available to make other checks during loading or otherwise change the cached value. If this method returns null, populateCachedValues will be called one more time to attempt to resolve a possibly new object. If null is returned, then empty string will be stored in preComputedValueMap for successive calls. This will handle cases where a parent in the table expands to show an object that was not in the original objects sent to populateCachedValues OR a new element is added to the viewer.- Parameters:
key
- returned from getKey callcachedValue
- that will be used if this method isn't overridden or returns null- Returns:
- string to display
-