Load a provided {@link ThemeBundle} asynchronously.

@param bundle The required theme bundle.
@param callback The async callback.
324317
public static void loadAsync(final ThemeBundle bundle, final ThemeAsyncCallback callback) {
        GWT.runAsync(new RunAsyncCallback() {
            @Override
            public void onSuccess() {
                if(bundle != null) {
                    if(elements == null) {
                        elements = new ArrayList<>();
                    } else {
                        unload();
                    }

                    // More resources might be loaded in the future.
                    elements.add(StyleInjector.injectStylesheet(bundle.style().getText()));
                    elements.add(StyleInjector.injectStylesheet(bundle.overrides().getText()));
                }

                if(callback != null) {
                    callback.onSuccess(elements.size());
                }
            }
            @Override
            public void onFailure(Throwable reason) {
                if(callback != null) {
                    callback.onFailure(reason);
                }
            }
        });
    }
793813
public void setBundles(java.util.Collection<Bundle> bundles) {
        if (bundles == null) {
            this.bundles = null;
            return;
        }

        this.bundles = new java.util.ArrayList<Bundle>(bundles);
    }
1210270
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
                              TileSetBundle bundle)
    {
        IMImageProvider improv = (_imgr == null) ?
            null : new IMImageProvider(_imgr, bundle);

        // map all of the tilesets in this bundle
        for (IntMap.IntEntry<TileSet> entry : bundle.intEntrySet()) {
            Integer tsid = entry.getKey();
            TileSet tset = entry.getValue();
            tset.setImageProvider(improv);
            idmap.put(tsid.intValue(), tset);
            namemap.put(tset.getName(), tsid);
        }
    }
353136
public static CallbacksManager init(Bundle bundle, Object... callbackHandlers) {
    if (bundle == null) {
      return new CallbacksManager();
    }

    CallbacksManager callbacksManager = new CallbacksManager();
    ArrayList<TaskHandler> taskProxies = bundle.getParcelableArrayList(TASK_PROXY_LIST);
    if (taskProxies != null) {
      callbacksManager.proxyTasks.addAll(taskProxies);
    }

    if (callbackHandlers != null) {
      for (TaskHandler proxyTask : new ArrayList<TaskHandler>(callbacksManager.proxyTasks)) {
        proxyTask.clearCallbacks();
        proxyTask.appendCallbacks(callbackHandlers);
      }
    }
    return callbacksManager;
  }
224431
protected void loadEntry(AsyncCallback<CmsClientSitemapEntry> callback) {

        CmsClientSitemapEntry entry = getEntry();
        if ((entry == null) && (m_sitePath != null)) {
            m_controller.loadPath(m_sitePath, true, callback);
        } else {
            callback.onSuccess(entry);
        }
    }
403974
function( parent, name ) {

	/**
	 * State of the bundle item in queue
	 *
	 * 0 - Requested
	 * 1 - Specs loaded
	 * 2 - Imports satisfied
	 * 3 - Loaded
	 */ 
	this.state = STATE_REQUESTED;

	/**
	 * Reference to the Bundles instance
	 */
	this.bundles = parent;

	/**
	 * The bundle name
	 */
	this.name = name;

	/**
	 * The bundle base directory
	 */
	this.bundleURL = null;

	/**
	 * Suffix to append to bundle files
	 */
	this.bundleURLSuffix = "";

	/**
	 * Bundle-specific resources
	 */
	this.resources = {};
	this.blobs = {};

	/**
	 * The bundle specifications
	 */
	this.specs = null;

	/**
	 * Callbacks of interested parties
	 */
	this.callbacks = [];

	/**
	 * Dependencies of this node
	 */
	this.depends = [];

	/**
	 * The loaded bundle item
	 */
	this.bundle = null;

}
882905
@Override
	public void init(ResourceBundlesHandler bundler, Boolean useRandomParam, Boolean async, Boolean defer,
			String crossorigin) {
		init(bundler, DEFAULT_TYPE, useRandomParam, async, defer, crossorigin);
	}
176801
public void loadRecent(final I_CmsSimpleCallback<List<CmsContainerElementData>> callback) {

        CmsRpcAction<List<CmsContainerElementData>> action = new CmsRpcAction<List<CmsContainerElementData>>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(200, true);
                getContainerpageService().getRecentList(
                    CmsCoreProvider.get().getStructureId(),
                    getData().getDetailId(),
                    getPageState(),
                    getLocale(),
                    this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(List<CmsContainerElementData> result) {

                stop(false);
                addElements(result);
                callback.execute(result);
            }
        };
        action.execute();
    }
961500
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
        ResourceBundle bundle)
    {
        try {
            TileSetBundle tsb = BundleUtil.extractBundle(bundle);
            // initialize it and add it to the list
            tsb.init(bundle);
            addBundle(idmap, namemap, tsb);

        } catch (Exception e) {
            log.warning("Unable to load tileset bundle '" + BundleUtil.METADATA_PATH +
                        "' from resource bundle [rbundle=" + bundle + "].", e);
        }
    }
739912
void loadMessageBundle() {

        //Check if chosen site template is valid and not empty
        if (!m_fieldLoadSiteTemplate.isValid()
            | m_fieldLoadSiteTemplate.isEmpty()
            | !CmsSiteManager.isFolderWithMacros(m_clonedCms, m_fieldLoadSiteTemplate.getValue())) {
            return;
        }
        try {
            m_bundleComponentKeyMap = new HashMap<TextField, String>();

            //Get resource of the descriptor.
            CmsResource descriptor = m_clonedCms.readResource(
                m_fieldLoadSiteTemplate.getValue()
                    + CmsSiteManager.MACRO_FOLDER
                    + "/"
                    + CmsSiteManager.BUNDLE_NAME
                    + "_desc");
            //Read related bundle

            Properties resourceBundle = getLocalizedBundle();
            Map<String, String[]> bundleKeyDescriptorMap = CmsMacroResolver.getBundleMapFromResources(
                resourceBundle,
                descriptor,
                m_clonedCms);

            for (String key : bundleKeyDescriptorMap.keySet()) {

                //Create TextField
                TextField field = new TextField();
                field.setCaption(bundleKeyDescriptorMap.get(key)[0]);
                field.setValue(bundleKeyDescriptorMap.get(key)[1]);
                field.setWidth("100%");

                //Add vaadin component to UI and keep related key in HashMap
                m_bundleValues.addComponent(field);
                m_bundleComponentKeyMap.put(field, key);
            }
        } catch (CmsException | IOException e) {
            LOG.error("Error reading bundle", e);
        }
    }
756407
@Override
	public void addCallback(Callback callback) {
		if (manager != null) {
			callback.initialize(manager);
		}
		callbacks.add(callback);
	}
260158
private function findTemplatesInThemes(BundleInterface $bundle, $theme)
    {
        $templates = $this->findTemplatesInFolder($bundle->getPath().'/Resources/themes/'.$theme);
        $name = $bundle->getName();

        foreach ($templates as $i => $template) {
            $templates[$i] = $template->set('bundle', $name);
        }

        return $templates;
    }
396532
public void registerCallback(UOWCallback callback)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "registerCallback", callback);

        if (!_callbacks.contains(callback))
        {
            _callbacks.add(callback);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Number of registered Callbacks: "+_callbacks.size());
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerCallback");
    }
403517
private void renderBundle(final ContextTreeConfig config, final TreeNode root,
                              final Class<?> scope, final Class<Object> bundle) {
        final BundleItemInfo info = service.getData().getInfo(bundle);
        if (isHidden(config, info, scope)) {
            return;
        }
        final List<String> markers = Lists.newArrayList();
        fillCommonMarkers(info, markers, scope);
        final TreeNode node = new TreeNode(RenderUtils.renderClassLine(bundle, markers));
        // avoid duplicate bundle content render
        if (!isDuplicateRegistration(info, scope)) {
            renderScopeContent(config, node, bundle);
        }
        // avoid showing empty bundle line if configured to hide (but show if bundle is ignored as duplicate)
        if (node.hasChildren() || !config.isHideEmptyBundles()
                || (!config.isHideDisables() && markers.contains(IGNORED))) {
            root.child(node);
        }
    }
1222418
protected void processBundle(Bundle bundle) {
        Properties props = readMessageRouterProps(bundle);

        if (props != null) {
            msgRouter.modified(props);
        }
    }
966927
public void queueResource (String bundle, String resource, boolean loop)
    {
        try {
            queueURL(new URL("resource://" + bundle + "/" + resource), loop);
        } catch (MalformedURLException e) {
            log.warning("Invalid resource url.", "resource", resource, e);
        }
    }
1061244
public void addRequiredBundles(String... requiredBundles) {
		String oldBundles = mainAttributes.get(REQUIRE_BUNDLE);
		if (oldBundles == null)
			oldBundles = "";
		BundleList oldResultList = BundleList.fromInput(oldBundles, newline);
		BundleList resultList = BundleList.fromInput(oldBundles, newline);
		for (String bundle : requiredBundles) {
			Bundle newBundle = Bundle.fromInput(bundle);
			if (name != null && name.equals(newBundle.getName()))
				continue;
			resultList.mergeInto(newBundle);
		}
		String result = resultList.toString();
		boolean changed = !oldResultList.toString().equals(result);
		modified |= changed;
		if (changed)
			mainAttributes.put(REQUIRE_BUNDLE, result);
	}