Search in sources :

Example 1 with DynamicLauncher

use of com.github.bordertech.wcomponents.test.selenium.DynamicLauncher in project wcomponents by BorderTech.

the class ServerCache method setUI.

/**
 * Set the UI for the launcher.
 *
 * @param key the UI key
 * @param ui the UI component
 * @return the registered UI instance
 */
public static WComponent setUI(final String key, final WComponent ui) {
    if (!(LAUNCHER instanceof DynamicLauncher)) {
        return ui;
    }
    // If a DynamicLauncher is being used, set the UI to match this component.
    synchronized (LAUNCHER) {
        DynamicLauncher dynamic = (DynamicLauncher) LAUNCHER;
        // Set the current key
        dynamic.setCurrentKey(key);
        // Check if already registered
        WApplication egUI = dynamic.getRegisteredComponent(key);
        if (egUI != null) {
            // Already registered, check if wrapped
            return (ui instanceof WApplication) ? egUI : egUI.getChildAt(0);
        }
        // Register UI - Check if needs to be wrapped
        dynamic.registerComponent(key, wrapUI(ui));
        // This is the registered instance
        return ui;
    }
}
Also used : WApplication(com.github.bordertech.wcomponents.WApplication) DynamicLauncher(com.github.bordertech.wcomponents.test.selenium.DynamicLauncher)

Aggregations

WApplication (com.github.bordertech.wcomponents.WApplication)1 DynamicLauncher (com.github.bordertech.wcomponents.test.selenium.DynamicLauncher)1