Example usage for com.google.gwt.user.client.ui LazyPanel ensureWidget

List of usage examples for com.google.gwt.user.client.ui LazyPanel ensureWidget

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui LazyPanel ensureWidget.

Prototype

public void ensureWidget() 

Source Link

Document

Ensures that the widget has been created by calling #createWidget if #getWidget returns null.

Usage

From source file:org.cruxframework.crux.core.client.screen.views.View.java

License:Apache License

/**
 * Call the {@code LazyPanel.ensureWidget()} method of the given lazyPanel.
 * This method can trigger other dependent lazyPanel initialization, through 
 * a recursive call to {@code View.getWidget(String)}.
 * //from www.  j ava 2 s .co m
 * @param widgetId lazyPanel to be loaded
 * @return true if some lazyPanel was really loaded for this request
 */
protected boolean initializeLazyDependentWidget(String widgetId) {
    boolean ret = false;
    if (LogConfiguration.loggingIsEnabled()) {
        logger.log(Level.FINE, "Initializing lazy dependents widgets of lazyPanel [" + widgetId + "]...");
    }

    LazyPanel lazyPanel = (LazyPanel) widgets.get(widgetId);
    if (lazyPanel == null) {
        //TODO: stackoverflow error when trying to access widgets on onLoad from a view (inside an HTMLPanel) 
        if (getWidget(ViewFactoryUtils.getWrappedWidgetIdFromLazyPanel(widgetId)) != null) {
            lazyPanel = (LazyPanel) widgets.get(widgetId);
        }
    }

    if (lazyPanel != null) {
        lazyPanel.ensureWidget();
        ret = true;
    } else {
        cleanLazyDependentWidgets(widgetId);
    }

    if (LogConfiguration.loggingIsEnabled()) {
        logger.log(Level.FINE, " Lazy dependents widgets of lazyPanel [" + widgetId + "] are now loaded.");
    }
    return ret;
}