Loads the image for the view if it isn't already loaded.

@param isInLayoutPass True if this was invoked from a layout pass, false otherwise.
491723
synchronized void loadImageIfNecessary(final boolean isInLayoutPass) {
        int width = getWidth();
        int height = getHeight();

        boolean wrapWidth = false, wrapHeight = false;
        if (getLayoutParams() != null) {
            wrapWidth = getLayoutParams().width == LayoutParams.WRAP_CONTENT;
            wrapHeight = getLayoutParams().height == LayoutParams.WRAP_CONTENT;
        }

        // if the view's bounds aren't known yet, and this is not a wrap-content/wrap-content
        // view, hold off on loading the image.
        boolean isFullyWrapContent = wrapWidth && wrapHeight;
        if (width == 0 && height == 0 && !isFullyWrapContent) {
            return;
        }

        // if the URL to be loaded in this view is empty, cancel any old requests and clear the
        // currently loaded image.
        if (TextUtils.isEmpty(url)) {
            if (imageContainer != null) {
                imageContainer.cancelRequest();
                imageContainer = null;
            }
            setDefaultImageOrNull();
            return;
        }

        // if there was an old request in this view, check if it needs to be canceled.
        if (imageContainer != null && imageContainer.getRequestUrl() != null) {
            if (imageContainer.getRequestUrl().equals(url)) {
                // if the request is from the same URL, return.
                return;
            } else {
                // if there is a pre-existing request, cancel it if it's fetching a different URL.
                imageContainer.cancelRequest();
                setDefaultImageOrNull();
            }
        }

        // Calculate the max image width / height to use while ignoring WRAP_CONTENT dimens.
        int maxWidth = wrapWidth ? 0 : width;
        int maxHeight = wrapHeight ? 0 : height;

        // The pre-existing content of this view didn't match the current URL. Load the new image
        // from the network.
        ImageContainer newContainer = imageLoader.get(url,
                new ImageListener() {
                    @Override
                    public void onError(JusError error) {
                        if (errorImageId != 0) {
                            setImageResource(errorImageId);
                        }
                    }

                    @Override
                    public void onResponse(final ImageContainer response, boolean isImmediate) {
                        //verify if we expect the same url
                        if (NetworkImageView.this.url == null ||
                                !NetworkImageView.this.url.equals(response.getRequestUrl())) {
                            JusLog.error("NetworkImageView received: " + response.getRequestUrl()
                                    + ", expected: " + NetworkImageView.this.url);
                            return;
                        }

                        // If this was an immediate response that was delivered inside of a layout
                        // pass do not set the image immediately as it will trigger a requestLayout
                        // inside of a layout. Instead, defer setting the image by posting back to
                        // the main threadId.
                        if (isImmediate && isInLayoutPass) {
                            post(new Runnable() {
                                @Override
                                public void run() {
                                    onResponse(response, false);
                                }
                            });
                            return;
                        }

                        if (response.getBitmap() != null && isOk2Draw(response.getBitmap())) {
                            setImageBitmap(response.getBitmap());
                        } else if (defaultImageId != 0) {
                            if (!isImmediate) {
                                JusLog.error("NetworkImageView received null for: " + response
                                        .getRequestUrl());
                            }
                            setImageResource(defaultImageId);
                        }
                    }
                }, maxWidth, maxHeight, tag);

        // update the ImageContainer to be the new bitmap container.
        imageContainer = newContainer;
    }
1107227
@Override
    public void saveLayout(LayoutIdentifier layout, String content) {
        propertyService.saveValue(getPropertyName(layout.shared), layout.name, layout.shared, content);
    }
950369
public void setImageDrawable(Drawable drawable, boolean animate) {
        if (view != null) {
            ((ImageView) view).setImageDrawable(drawable);
        }
    }
1308159
private void initContentView(LayoutInflater inflater, View header, boolean fixedHeader, View footer,
                               boolean fixedFooter, BaseAdapter adapter, int[] padding, int[] margin) {
    View contentView = createView(inflater, header, fixedHeader, footer, fixedFooter, adapter);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
        ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    );
    params.setMargins(margin[0], margin[1], margin[2], margin[3]);
    contentView.setLayoutParams(params);
    getHolderView().setPadding(padding[0], padding[1], padding[2], padding[3]);
    contentContainer.addView(contentView);
  }
673345
private void inflateView() {
        parentView = createParentView();
        view = createView();
        view.setOnFocusChangeListener(createFocusChangeListener());
        view.setBackgroundResource(R.drawable.validateable_view_background);
        setLineColor(getAccentColor());

        if (parentView != null) {
            parentView.addView(view, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
            addView(parentView, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        } else {
            addView(view, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        }
    }
662028
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_movie_poster, container, false);
    ButterKnife.inject(this, view);
    Picasso.with(getActivity())
        .load(videoPosterThumbnail)
        .placeholder(R.drawable.xmen_placeholder)
        .into(thumbnailImageView);
    return view;
  }
43264
private void initLayout() {

        VerticalLayout page = new VerticalLayout();
        setContent(page);
        page.setId("page");

        page.addComponent(headerLayout);
        initLayoutHeader();

        page.addComponent(mainTab);


        initLayoutFooter();
        page.addComponent(layoutFooter);

    }
660301
@Override
    public void loadImageThumbnail(final ImageView iv, String imageUrl, int dimension) {
        if (!TextUtils.isEmpty(imageUrl)) {
            Picasso.with(iv.getContext())
                    .load(imageUrl)
                    .resize(dimension, dimension)
                    .centerCrop()
                    .into(iv);
        } else {
            iv.setImageDrawable(null);
        }
    }
8824
private void ensureCurrentLayout() {
        if (!tabPane.isValid()) {
            tabPane.validate();
        }

        /*
         * If tabPane doesn't have a peer yet, the validate() call will silently
         * fail. We handle that by forcing a layout if tabPane is still invalid.
         * See bug 4237677.
         */
        if (!tabPane.isValid()) {
            TabbedPaneLayout layout = (TabbedPaneLayout) tabPane.getLayout();

            layout.calculateLayoutInfo();
        }
    }
84887
public ImageHelper load(ImageView v, String url) {
        return load(v, url, null);
    }
407006
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.place_row, container, false);
    ButterKnife.inject(this, view);
    return view;
  }
637220
@Override
    protected void layoutChildren() {
        Insets ins = getInsets();
        visibleParagraphs.suspendWhile(() -> {
            virtualFlow.resizeRelocate(
                    ins.getLeft(), ins.getTop(),
                    getWidth() - ins.getLeft() - ins.getRight(),
                    getHeight() - ins.getTop() - ins.getBottom());

            if(followCaretRequested) {
                followCaretRequested = false;
                try (Guard g = viewportDirty.suspend()) {
                    followCaret();
                }
            }
        });
    }
653357
protected void postLayoutChild(final int dataIndex) {
        if (!mContainer.isDynamic()) {
            boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
            ViewPortVisibility visibility = visibleInLayout ?
                    ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
            Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
                    dataIndex, visibility);

            Widget childWidget = mContainer.get(dataIndex);
            if (childWidget != null) {
                childWidget.setViewPortVisibility(visibility);
            }
        }
    }
1266722
protected LayoutManager getLayOutManagerObj(ActionInvocation _invocation) {
		if (layoutManager == null || "".equals(layoutManager)){
			LOG.warn("No valid LayoutManager, using ClassicLayoutManager");
			return new ClassicLayoutManager();
		}

		Object los = conditionalParse(layoutManager, _invocation);

		if (los instanceof LayoutManager){
			return (LayoutManager) los;
		}

		LayoutManager lo = null;
		if (los instanceof String){
			if (LAYOUT_CLASSIC.equalsIgnoreCase((String) los))
				lo = new ClassicLayoutManager();
			else if (LAYOUT_LIST.equalsIgnoreCase((String) los))
				lo =  new ListLayoutManager();
			else {
				try {
					lo = (LayoutManager) Class.forName((String) los).newInstance();
				} catch (Exception e) {
					LOG.warn("No valid LayoutManager: " + e.getMessage(),e);
				}
			}
		}

		return lo;
	}
1336166
public void disableCompass() {
        mIsCompassEnabled = false;

        if (mOrientationProvider != null) {
            mOrientationProvider.stopOrientationProvider();
        }

        // Reset values
        mAzimuth = Float.NaN;

        // Update the screen to see changes take effect
        if (mMapView != null) {
            this.invalidateCompass();
        }
    }
239755
public ImageHelper load(ImageView v, Request request) {
        loadInternal(v, request, listener, null);

        return this;
    }
551050
private Image loadImage(final String resourceName, final boolean skipImagesFolder) {
        Image image = null;

        final List<String> imagePaths = skipImagesFolder ? Collections.singletonList("") : ResourceParameters.IMAGE_FOLDER.get();
        for (int i = 0; i < imagePaths.size() && image == null; i++) {

            String imagePath = imagePaths.get(i);
            if (!imagePath.isEmpty()) {
                imagePath += Resources.PATH_SEP;
            }
            final InputStream imageInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(imagePath + resourceName);
            if (imageInputStream != null) {
                image = new Image(imageInputStream);
            }
        }
        if (image == null) {
            LOGGER.error("Image : {} not found into base folder: {}", resourceName, ResourceParameters.IMAGE_FOLDER.get());
        }
        return image;
    }