Override preparePaintComponent to set the initial selection from the app preferences. The selection is set the
first time the example is accessed or when the reset button is used.

@param request the request being responded to.
9054
@Override
	public void preparePaintComponent(final Request request) {
		if (!this.isInitialised() || resetButton.isPressed()) {
			String preferredState = request.getAppPreferenceParameter("example.preferred.state");
			stateSelector.setSelected(preferredState);
			this.setInitialised(true);
		}
	}
1087378
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		// Check if window in request
		boolean targeted = isPresent(request);
		setTargeted(targeted);

		if (getState() == ACTIVE_STATE && isTargeted()) {
			getComponentModel().wrappedContent.serviceRequest(request);
		}
	}
1114492
public void init(ServletRequest request)
    {
        String[] vals = request.getParameterValues(ITEM_PARAM);

        if (vals != null) {
            _retrieveMap = new HashMap();

            for (int i = 0; i < vals.length; i++) {
                String val = vals[i];
                int delimPos = val.indexOf(DELIM);
                if (delimPos != -1) {
                    String expressionToRetrieve = val.substring(0, delimPos);
                    String fieldID = val.substring(delimPos + 1);
                    _retrieveMap.put(fieldID, expressionToRetrieve);
                }
            }
        }

        _callbackFunc = request.getParameter(CALLBACK_PARAM);
    }
918884
public void deletePreset(DeletePresetRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getPresetName(), "The parameter presetName should NOT be null or empty string.");
        InternalRequest internalRequest =
                createRequest(HttpMethodName.DELETE, request, PRESET, request.getPresetName());

        invokeHttpClient(internalRequest, DeletePresetResponse.class);
    }
584216
private Paint getPreparedPaint() {
		getActionButton().resetPaint();
		Paint paint = getActionButton().getPaint();
		paint.setStyle(Paint.Style.FILL);
		paint.setColor(getActionButton().getButtonColorRipple());
		return paint;
	}
229587
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!isInitialised()) {
			tf3.setText("This is read only.");
			tf4.setText("This is disabled.");
			readFields();
			setInitialised(true);
		}
	}
511158
public void setRequest(ServletRequest request) {
        if (request != null) {
            if (logger.isDebugEnabled()) {
                logger.debug(String.format("set request: %s", request));
            }
            this.threadLocalRequests.set((HttpServletRequest) request);
        } else {
            //if null, remove from threadLocalRequests
            // @see WindowTask#run 's finally
            if (logger.isDebugEnabled()) {
                HttpServletRequest tmpRequest = this.threadLocalRequests.get();
                logger.debug(String.format("remove request: %s", tmpRequest));
            }
            this.threadLocalRequests.remove();
        }
    }
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);
		}
	}
453140
@Override
	protected void preparePaintComponent(final Request request) {
		if (OPTION_CONTENT1.equals(rbSelect.getSelected())) {
			content.setText("This is content 1");
		} else if (OPTION_CONTENT2.equals(rbSelect.getSelected())) {
			content.setText("This is content 2");
		} else if (OPTION_CONTENT3.equals(rbSelect.getSelected())) {
			content.setText("This is content 3");
		} else {
			content.setText(null);
		}
	}
1174881
@Override
	public void serviceRequest(final Request request) {
		// Get expected step count
		UIContext uic = UIContextHolder.getCurrent();
		int expected = uic.getEnvironment().getStep();

		// Step should already be set on the session
		if (expected == 0) {
			throw new SystemException(
					"Step count should already be set on the session before content request.");
		}

		// Get step count on the request
		int got = StepCountUtil.getRequestStep(request);

		// Check tokens match (both must be provided)
		if (expected == got) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else if (!StepCountUtil.isStepOnRequest(request) && StepCountUtil.isCachedContentRequest(request)) {  // cached content (no step on request)
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else {  // Invalid token
			// Set an error code
			LOG.warn(
					"Wrong step detected for content request. Expected step [" + expected + "] but got step [" + got
					+ "].");
			handleError();
		}

	}
1083993
protected void initPaint() {
        // time text
        mTimeTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mTimeTextPaint.setColor(mTimeTextColor);
        mTimeTextPaint.setTextAlign(Paint.Align.CENTER);
        mTimeTextPaint.setTextSize(mTimeTextSize);
        if (isTimeTextBold) {
            mTimeTextPaint.setFakeBoldText(true);
        }

        // suffix text
        mSuffixTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mSuffixTextPaint.setColor(mSuffixTextColor);
        mSuffixTextPaint.setTextSize(mSuffixTextSize);
        if (isSuffixTextBold) {
            mSuffixTextPaint.setFakeBoldText(true);
        }

        mMeasureHourWidthPaint = new Paint();
        mMeasureHourWidthPaint.setTextSize(mTimeTextSize);
        if (isTimeTextBold) {
            mMeasureHourWidthPaint.setFakeBoldText(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);
		}
	}
895310
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) {
        if (serviceValidateConfigurationContext.isRenewEnabled()) {
            binder.setRequiredFields(CasProtocolConstants.PARAMETER_RENEW);
        }
    }
19109
public void setRequest(Object request)
    {
        ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
        
        if (ctx == null)
        {
            throw new UnsupportedOperationException();
        }
        
        ctx.setRequest(request);
    }
366076
public void changeSelected(String selectNode, ServletRequest request)
    {
        _selectedNode = TreeHelpers.changeSelected(this, _selectedNode, selectNode, request);
    }
248265
@Override
	public void preparePaintComponent(final Request request) {
		String dateStr = "The current date is " + new Date();
		dynamicText.setText(dateStr);
	}
1153101
@Override
	public void preparePaintComponent(final Request request) {
		if (!isInitialised()) {
			List<SimpleTableBean> items = new ArrayList<>();
			items.add(new SimpleTableBean("A", "none", "thing"));
			items.add(new SimpleTableBean("B", "some", "thing2"));
			items.add(new SimpleTableBean("C", "little", "thing3"));
			items.add(new SimpleTableBean("D", "lots", "thing4"));

			for (WList list : lists) {
				list.setData(items);
			}

			setInitialised(true);
		}
	}