Our media front end should implement {@link FrameParticipant} and call this method in their
{@link FrameParticipant#needsPaint} method.
971370
public boolean needsPaint ()
    {
        // compute our average dirty regions per tick
        if (_tick++ == 99) {
            _tick = 0;
            int dirty = IntListUtil.sum(_dirty);
            Arrays.fill(_dirty, 0);
            _dirtyPerTick = (float)dirty/100;
        }

        // regardless of whether or not we paint, we need to let our abstract media managers know
        // that we've gotten to the point of painting because they need to remain prepared to deal
        // with media changes that happen any time between the tick() and the paint() and thus need
        // to know when paint() happens
        _animmgr.willPaint();
        _spritemgr.willPaint();

        // if we have dirty regions, we need painting
        return _remgr.haveDirtyRegions();
    }
586809
@Override
	public void preparePaintComponent(final Request request) {
		if (!this.isInitialised()) {
			// Give the repeater the list of data to display.
			repeater.setData(fetchDataList());






			// THIS IS THE BIT YOUSHOULD NEVER EVER DO SO LOOK AWAY NOW...
			WNamingContext nc = (WNamingContext) WebUtilities.getAncestorOfClass(WNamingContext.class, this);
			if (null != nc) {
				nc.setNamingContext(false);
			}
			// OK, WE ARE SAFE AGAIN

			// Remember that we've done the initialisation.
			this.setInitialised(true);
		}
	}
1131637
@Provides protected TvShowCollectionRendererBuilder provideTvShowCollectionRendererBuilder(
      Context context) {
    List<Renderer<TvShowViewModel>> prototypes = new LinkedList<Renderer<TvShowViewModel>>();
    prototypes.add(new TvShowRenderer(context));
    return new TvShowCollectionRendererBuilder(prototypes);
  }
255901
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		UIContext uic = UIContextHolder.getCurrent();

		// If the link has an action, register it for AJAX
		final Action action = getAction();
		final AjaxTarget[] actionTargets = getActionTargets();

		if (action != null && uic.getUI() != null) {
			// Register AJAX operation if AJAX targets are set, otherwise rely on InternalAjax request
			if (actionTargets != null && actionTargets.length > 0) {
				List<String> targetIds = new ArrayList<>();
				for (AjaxTarget target : actionTargets) {
					targetIds.add(target.getId());
				}
				// Register the action targets
				AjaxHelper.registerComponents(targetIds, getId());
			}
		}
	}
783558
@Override
	public void preparePaint(final Request request) {
		// Headers
		// The WHeaders comes from the root WComponent and is a
		// mechanism for WComponents to add their own headers
		// (eg more JavaScript references).

		Headers headers = this.getUI().getHeaders();
		headers.reset();

		super.preparePaint(request);
	}
707489
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!isInitialised()) {
			// Check project versions for Wcomponents-examples and WComponents match
			String egVersion = Config.getInstance().getString("wcomponents-examples.version");
			String wcVersion = WebUtilities.getProjectVersion();

			if (egVersion != null && !egVersion.equals(wcVersion)) {
				String msg = "WComponents-Examples version (" + egVersion + ") does not match WComponents version ("
						+ wcVersion + ").";

				LOG.error(msg);

				messages.addMessage(new Message(Message.ERROR_MESSAGE, msg));
			}
			setInitialised(true);
		}

	}
1226573
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!isInitialised()) {
			textArea.setFocussed();

			setInitialised(true);
		}
	}
1298291
@Override
	protected void preparePaintComponent(final Request request) {
		if (!isInitialised()) {
			MyDataBean myBean = new MyDataBean();
			myBean.setName("My Bean");

			myBean.addBean(new SomeDataBean("blah", "more blah"));
			myBean.addBean(new SomeDataBean());

			repeaterFields.setData(myBean);

			setInitialised(true);
		}
	}
576817
protected final void initializeMediaUpload(AbstractInputStreamContent mediaContent) {
    HttpRequestFactory requestFactory = abstractGoogleClient.getRequestFactory();
    this.uploader = new MediaHttpUploader(
        mediaContent, requestFactory.getTransport(), requestFactory.getInitializer());
    this.uploader.setInitiationRequestMethod(requestMethod);
    if (httpContent != null) {
      this.uploader.setMetadata(httpContent);
    }
  }
1174184
function() {
      WireIt.CanvasContainer.superclass.render.call(this);

		this.canvasEl = new WireIt.CanvasElement(this.bodyEl);
		this.canvasEl.SetCanvasRegion(0,0, this.width, this.height );
		this.canvasWidth = this.width;
		this.canvasHeight = this.height;
		this.drawCanvas();
   }
584928
@Override
	protected void preparePaintComponent(final Request request) {
		assertConfigured();

		List beanList = getBeanList();

		List<Integer> used = new ArrayList<>();

		for (int i = 0; i < beanList.size(); i++) {
			Object rowData = beanList.get(i);

			// Each row has its own context. This is why we can reuse the same
			// WComponent instance for each row.
			UIContext rowContext = getRowContext(rowData, i);

			// Check the context has not been used for another row
			Integer subId = ((SubUIContext) rowContext).getContextId();
			if (used.contains(subId)) {
				Object rowId = ((SubUIContext) rowContext).getRowId();
				String msg = "The row context for row id ["
						+ rowId
						+ "] has already been used for another row. "
						+ "Either the row ID is not unique or the row bean has not implemented equals/hashcode "
						+ "or no rowIdBeanProperty set on the repeater that uniquely identifies the row.";
				throw new SystemException(msg);
			}
			used.add(subId);

			UIContextHolder.pushContext(rowContext);

			try {
				prepareRow(request, i);
			} finally {
				UIContextHolder.popContext();
			}
		}
	}
1057735
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		String targetId = getContent().getId();
		String contentId = getId() + "-content";

		switch (getComponentModel().mode) {
			case LAZY: {
				getContent().setVisible(isOpen());
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				break;
			}
			case DYNAMIC: {
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				getContent().setVisible(isOpen());
				break;
			}
			case EAGER: {
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				// Will always be visible
				break;
			}
			case SERVER: {
				// same as DYNAMIC
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				getContent().setVisible(isOpen());
				break;
			}
			case CLIENT: {
				// Will always be visible
				break;
			}

			default:
				// do nothing.
				break;
		}
	}
57916
protected void paint (Graphics2D gfx, Rectangle[] dirty)
    {
        int dcount = dirty.length;

        for (int ii = 0; ii < dcount; ii++) {
            Rectangle clip = dirty[ii];
            // sanity-check the dirty rectangle
            if (clip == null) {
                log.warning("Found null dirty rect painting media panel?!", new Exception());
                continue;
            }

            // constrain this dirty region to the bounds of the component
            constrainToBounds(clip);

            // ignore rectangles that were reduced to nothingness
            if (clip.width == 0 || clip.height == 0) {
                continue;
            }

            // clip to this dirty region
            clipToDirtyRegion(gfx, clip);

            // paint the region
            paintDirtyRect(gfx, clip);
        }
    }
801806
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (content != null) {
			switch (getMode()) {
				case EAGER: {
					// Always visible
					content.setVisible(true);
					AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					break;
				}
				case LAZY:
					content.setVisible(!isCollapsed());

					if (isCollapsed()) {
						AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					}

					break;

				case DYNAMIC: {
					content.setVisible(!isCollapsed());
					AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					break;
				}
				case SERVER: {
					content.setVisible(!isCollapsed());
					break;
				}
				case CLIENT: {
					// Will always be visible
					content.setVisible(true);
					break;
				}
				default: {
					throw new SystemException("Unknown mode: " + getMode());
				}
			}
		}
	}
986256
function() {

		// Create Dom element
		this._el.content_item   = TL.Dom.create("div", "tl-media-item tl-media-map tl-media-shadow", this._el.content);

		// Get Media ID
		this.media_id = this.data.url;

		// API Call
		this.mapframe = TL.Dom.create("iframe", "", this._el.content_item);
		window.stash = this;
		this.mapframe.width       = "100%";
		this.mapframe.height      = "100%";
		this.mapframe.frameBorder = "0";
		this.mapframe.src         = this.makeGoogleMapsEmbedURL(this.media_id, this.options.api_key_googlemaps);
		
		
		// After Loaded
		this.onLoaded();
	}
692939
private void visitFrameAfterOnMethodEntry() {
        if (!visitFramesAfterCallbacks)
            return;

        // The frame that is required after the trace guard must be
        // fully specified as 'this' is no longer an 'uninitialized this'
        if (isConstructor()) {
            List<Object> stackLocals = new ArrayList<Object>(argTypes.length + 1);
            stackLocals.add(classAdapter.getClassType().getInternalName());
            for (Type type : argTypes) {
                switch (type.getSort()) {
                    case Type.ARRAY:
                    case Type.OBJECT:
                        stackLocals.add(type.getInternalName());
                        break;
                    case Type.BOOLEAN:
                    case Type.CHAR:
                    case Type.BYTE:
                    case Type.SHORT:
                    case Type.INT:
                        stackLocals.add(INTEGER);
                        break;
                    case Type.LONG:
                        stackLocals.add(LONG);
                        break;
                    case Type.FLOAT:
                        stackLocals.add(FLOAT);
                        break;
                    case Type.DOUBLE:
                        stackLocals.add(DOUBLE);
                        break;
                }
            }
            visitFrame(F_FULL, stackLocals.size(), stackLocals.toArray(), 0, new Object[] {});
            visitInsn(NOP);
        } else {
            visitFrame(F_SAME, 0, null, 0, null);
            visitInsn(NOP);
        }
    }
1018372
private void callOnFrameError(WebSocketException cause, WebSocketFrame frame)
    {
        mWebSocket.getListenerManager().callOnFrameError(cause, frame);
    }