Override preparePaintComponent in order to populate the recently accessed menu when a user accesses this panel
for the first time.

@param request the request being responded to.
558535
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!isInitialised()) {
			List<ExampleData> recent = menuPanel.getRecent();

			if (!recent.isEmpty()) {
				selectExample(recent.get(0));
			}

			setInitialised(true);
		}
		lastLoaded.setText("Last loaded on ".concat(getMeAReadableDate(new Date())));
	}
199046
public void init(HttpServletRequest request) {
		resetTimers();
		
		if (request != null) {
			String p = request.getPathInfo();
			final int pathLength = (p == null ? 0 : p.length());
			
			final StringBuffer urlSb = request.getRequestURL();
			String simpleUrl = urlSb.toString(); // without qs
			
			String qs = request.getQueryString();
			if (qs != null) urlSb.append("?").append(qs);
			final String fullUrl = urlSb.toString();
			contextUrl.set(fullUrl);
		
			requestCookies.remove();
			responseCookies.remove();
			
			StringBuilder cookiesDump = new StringBuilder();
			Map<String, Cookie> cookiez = requestCookies.get();
			for (javax.servlet.http.Cookie c : Check.ifNull(request.getCookies(), new javax.servlet.http.Cookie[0])) {
				cookiez.put(c.getName(), new BasicClientCookie(c.getName(), c.getValue()));
				cookiesDump.append(c.toString()).append(";");
			}
	
			String xForwardedFor = request.getHeader(HEADER_X_FORWARDED_FOR);
			clientIp.set(xForwardedFor != null ? xForwardedFor : request.getRemoteAddr());
			
			String xForwardedUrl = request.getHeader(HEADER_X_FORWARDED_URL);
			if (xForwardedUrl != null) {
				int i = xForwardedUrl.lastIndexOf("?");
				simpleUrl = (i == -1 ? xForwardedUrl : xForwardedUrl.substring(0, i));
			}
			
			try {
				simpleUrl = URLDecoder.decode(simpleUrl, "UTF-8"); // convert "%xx" stuff before working with lengths
			} catch (UnsupportedEncodingException e) {
				log.error(e.toString());
			}
			contextPath.set(simpleUrl.substring(0, simpleUrl.length() - pathLength));

			if (verbose) log.info(">>> Time 0 [" + fullUrl + "]. cookies from client: " + cookiesDump.toString());
		}
		
		initialized.set(true);
	}
262907
@Override
	protected void preparePaintComponent(final Request request) {
		if (!isInitialised()) {
			table.setDataModel(createTableModel());
			setInitialised(true);
		}
	}
992893
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		WComponent content = getContent();

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

					break;
				}
				case DYNAMIC: {
					content.setVisible(isOpen());
					AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					break;
				}
				case SERVER: {
					content.setVisible(isOpen());
					break;
				}
				case CLIENT: {
					// Will always be visible
					content.setVisible(true);
					break;
				}

				default:
					// do nothing.
					break;
			}
		}
	}
348178
@Override
	public void preparePaint(final Request request) {
		UIContext uic = UIContextHolder.getCurrent();
		Headers headers = uic.getUI().getHeaders();
		headers.reset();
		headers.setContentType(WebUtilities.CONTENT_TYPE_XML);

		super.preparePaint(request);
	}
994726
public void prepareToConnect(Request request) {
    if (this.request != null) {
      if (sameConnection(this.request.url(), request.url()) && exchangeFinder.hasRouteToTry()) {
        return; // Already ready.
      }
      if (exchange != null) throw new IllegalStateException();

      if (exchangeFinder != null) {
        maybeReleaseConnection(null, true);
        exchangeFinder = null;
      }
    }

    this.request = request;
    this.exchangeFinder = new ExchangeFinder(this, connectionPool, createAddress(request.url()),
        call, eventListener);
  }
194979
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		if (!isInitialised()) {
			table.setTableModel(createTableModel());
			setInitialised(true);
		}
	}
157906
@Override
	protected void preparePaintComponent(final Request request) {
		StringBuffer text = new StringBuffer("Options: ");

		for (Object option : shuffler.getOptions()) {
			text.append(option).append(", ");
		}

		order.setText(text.toString());
	}
541601
@Override
	public void preparePaint(final Request request) {
		if (windowId == null) {
			super.preparePaint(request);
		} else {
			// Get the window component
			ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
			if (target == null) {
				throw new SystemException("No window component for id " + windowId);
			}

			UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
			Environment originalEnvironment = uic.getEnvironment();
			uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));

			UIContextHolder.pushContext(target.getContext());
			try {
				super.preparePaint(request);
			} finally {
				uic.setEnvironment(originalEnvironment);
				UIContextHolder.popContext();
			}
		}
	}
135684
@Override
	public void serviceRequest(final Request request) {
		// Get the expected session token
		UIContext uic = UIContextHolder.getCurrent();
		String expected = uic.getEnvironment().getSessionToken();

		// Session token should already be set
		if (expected == null) {
			LOG.error("Session token should already be set on the session before AJAX request. Can be due to the session timing out.");
			handleError();
		}

		// Get the session token from the request
		String got = request.getParameter(Environment.SESSION_TOKEN_VARIABLE);

		// Check tokens match (both must be provided)
		if (Util.equals(expected, got)) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else { // Invalid token
			LOG.error("Wrong session token detected for AJAX request. Expected token [" + expected
					+ "] but got token [" + got + "].");
			handleError();
		}
	}
1205761
@Override
	protected void preparePaintComponent(final Request request) {
		if (!isInitialised()) {
			MyData data = new MyData("Homer");
			basic.setData(data);

			List<MyData> dataList = new ArrayList<>();
			dataList.add(new MyData("Homer"));
			dataList.add(new MyData("Marge"));
			dataList.add(new MyData("Bart"));
			repeated.setBeanList(dataList);

			dataList = new ArrayList<>();
			dataList.add(new MyData("Greg"));
			dataList.add(new MyData("Jeff"));
			dataList.add(new MyData("Anthony"));
			dataList.add(new MyData("Murray"));
			repeatedLink.setData(dataList);

			List<List<MyData>> rootList = new ArrayList<>();

			List<MyData> subList = new ArrayList<>();
			subList.add(new MyData("Ernie"));
			subList.add(new MyData("Bert"));
			rootList.add(subList);

			subList = new ArrayList<>();
			subList.add(new MyData("Starsky"));
			subList.add(new MyData("Hutch"));
			rootList.add(subList);

			nestedRepeaterTab.setData(rootList);

			setInitialised(true);
		}
	}
60996
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		if (!isInitialised()) {
			setInitialised(true);
			setTreeModel(new MenuTreeModel(data));
		}
	}
732708
@Override
	public void handleRequest(final Request request) {
		// Clear pressed
		clearPressed();

		String requestValue = request.getParameter(getId());
		boolean pressed = "x".equals(requestValue);

		// Only process on a POST
		if (pressed && !"POST".equals(request.getMethod())) {
			LOG.warn("Button pressed on a request that is not a POST. Will be ignored.");
			return;
		}

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

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

			setInitialised(true);
		}
	}
449182
private void handleSelectionRequest(final Request request) {
		String[] paramValue = request.getParameterValues(getId() + ".selected");

		if (paramValue == null) {
			paramValue = new String[0];
		}

		String[] selectedRows = removeEmptyStrings(paramValue);
		List<Integer> oldSelections = getSelectedRows();
		List<Integer> newSelections;

		boolean singleSelect = SelectMode.SINGLE.equals(getSelectMode());

		if (getDataModel().getRowCount() == 0) {
			newSelections = new ArrayList<>();
			selectedRows = new String[0];
		} else if (getPaginationMode() == PaginationMode.NONE
				|| getPaginationMode() == PaginationMode.CLIENT
				|| oldSelections == null) {
			newSelections = new ArrayList<>(selectedRows.length);
		} else if (singleSelect && selectedRows.length > 0) {
			// For single-select, we need to remove the old entries
			newSelections = new ArrayList<>(1);
		} else {
			// For multi-select, we need to entries for the current page only
			newSelections = new ArrayList<>(oldSelections);

			int startRow = getCurrentPageStartRow();
			int endRow = getCurrentPageEndRow();
			newSelections.removeAll(getRowIds(startRow, endRow));
		}

		for (String selectedRow : selectedRows) {
			try {
				newSelections.add(Integer.parseInt(selectedRow));

				if (singleSelect) {
					break;
				}
			} catch (NumberFormatException e) {
				LOG.warn("Invalid row id for selection: " + selectedRow);
			}
		}

		setSelectedRows(newSelections);

		// If there is a selection change action specified, it may need to be fired
		Action selectionChangeAction = getSelectionChangeAction();

		if (selectionChangeAction != null && !newSelections.equals(oldSelections)) {
			selectionChangeAction.execute(new ActionEvent(this, "selection"));
		}
	}
859558
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (isAjax() && UIContextHolder.getCurrent().getUI() != null) {
			AjaxTarget target = getAjaxTarget();
			AjaxHelper.registerComponent(target.getId(), getId());
		}

		String cacheKey = getListCacheKey();

		if (cacheKey != null) {
			LookupTableHelper.registerList(cacheKey, request);
		}
	}
204668
@Override
	public void handleRequest(final Request request) {
		if (clrBtn.isPressed()) {
			textFld.setText("");
		} else if (dupBtn.isPressed()) {
			// Get the text entered by the user.
			String text = textFld.getText();

			// Now duplicate it.
			textFld.setText(text + text);
		}
	}