Search in sources :

Example 1 with ErrorPage

use of com.github.bordertech.wcomponents.ErrorPage in project wcomponents by BorderTech.

the class UIRegistryAmicableImpl method getUI.

/**
 * Retrieves the user interface that was registered with the given key. If the UI has not been registered, this
 * attempts to load the UI using the key as a class name.
 *
 * @param key The registration key.
 * @return the UI for the given key. The UI may be newly created.
 */
@Override
public synchronized WComponent getUI(final String key) {
    WComponent ui = registry.get(key);
    if (ui == null) {
        // Looks like we haven't tried loading this UI yet, so do it now.
        ui = loadUI(key);
        ui.setLocked(true);
        // Cache the result only if the UI was successfully loaded.
        if (ui instanceof ErrorPage) {
            LOG.debug("Returning non-cached ErrorPage WComponent. Key=" + key);
        } else {
            register(key, ui);
            LOG.debug("Returning cached WComponent. Key=" + key);
        }
    } else {
        LOG.debug("Returning cached WComponent. Key=" + key);
    }
    return ui;
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) ErrorPage(com.github.bordertech.wcomponents.ErrorPage)

Aggregations

ErrorPage (com.github.bordertech.wcomponents.ErrorPage)1 WComponent (com.github.bordertech.wcomponents.WComponent)1