@eclipse-scout/core
Version:
Eclipse Scout runtime
53 lines • 2.85 kB
TypeScript
import { HybridActionContextElement, ObjectWithType, Widget } from '../../index';
/**
* Represents a map which holds lists of {@link HybridActionContextElement}s indexed by a string key. The value of the
* map is always a list, even when only a single context element is expected. Several convenience methods to add or
* retrieve context elements are provided, though the actual map can also be accessed via {@link map}.
*/
export declare class HybridActionContextElements implements ObjectWithType {
objectType: string;
map: Map<string, HybridActionContextElement[]>;
/**
* @returns whether the internal map is empty
*/
isEmpty(): boolean;
/**
* Returns a list of context elements for the given key. If the given key does not exist, an error is thrown.
* Use {@link optList} to return `null` instead. Use {@link getSingle} if only a single context element is expected.
*/
getList(key: string): HybridActionContextElement[];
/**
* Returns a list of context elements for the given key, or `null` if the given key does not exist.
*/
optList(key: string): HybridActionContextElement[];
/**
* Returns the context elements for the given key. If the given key does not exist, an error is thrown.
* Use {@link optSingle} to return `null` instead. Use {@link getList} if more than one context element is expected.
*/
getSingle(key: string): HybridActionContextElement;
/**
* Returns the context elements for the given key, or `null` if the given key does not exist.
* Use {@link optList} if more than one context element is expected.
*/
optSingle(key: string): HybridActionContextElement;
/**
* Stores the given map of context elements in the internal map. Nothing happens if the argument is `null` or empty.
*/
withMap(map: Record<string, HybridActionContextElement[]>): HybridActionContextElements;
/**
* Stores the given list of context elements in the internal map under the given key. Existing elements for the same
* key are overwritten.
*
* @throws Error if any of the arguments is `null`
*/
withElements(key: string, contextElements: HybridActionContextElement[]): HybridActionContextElements;
/**
* Stores the given context element in the internal map under the given key. Existing elements for the same key are
* overwritten. If a widget is given as the second argument, it is automatically wrapped in a {@link HybridActionContextElement}.
*
* @throws Error if the mandatory arguments are `null`
*/
withElement(key: string, contextElement: HybridActionContextElement): HybridActionContextElements;
withElement(key: string, widget: Widget, element?: any): HybridActionContextElements;
}
//# sourceMappingURL=HybridActionContextElements.d.ts.map