code: @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());
  			}
  		}
  	}
docs: Override preparePaintComponent to register an AJAX operation if this link has an action.
  
  @param request the request being responded to.