dateLabelMousePressed, This event is called any time that the user clicks on a date label in
the calendar. This sets the date picker to the selected date, and closes the calendar panel.
496315
private void dateLabelMousePressed(MouseEvent e) {
        // Get the label that was clicked.
        JLabel label = (JLabel) e.getSource();
        // If the label is empty, do nothing and return.
        String labelText = label.getText();
        if ("".equals(labelText)) {
            return;
        }
        // We have a label with a specific date, so set the date and close the calendar.
        int dayOfMonth = Integer.parseInt(labelText);
        LocalDate clickedDate = LocalDate.of(
            displayedYearMonth.getYear(), displayedYearMonth.getMonth(), dayOfMonth);
        userSelectedADate(clickedDate);
    }
750638
function (e) {
    // console.log('Filtered by', (new Date(e.start)).toISOString(), (new Date(e.end)).toISOString())
    var field = this.collection.getTriggerField()

    var start = new Date(e.start)
    var startIso = trimLastCharacter(start.toISOString())
    var startFriendly = start.toLocaleDateString()

    var end = new Date(e.end)
    var endIso = trimLastCharacter(end.toISOString())
    var endFriendly = end.toLocaleDateString()

    // Trigger the global event handler with this filter
    this.vent.trigger(this.collection.getDataset() + '.filter', {
      field: field,
      expression: {
        type: 'and',
        value: [
          {
            type: '>=',
            value: startIso,
            label: startFriendly
          },
          {
            type: '<=',
            value: endIso,
            label: endFriendly
          }
        ]
      }
    })
  }
907118
function DatePickerCtrl($scope, $element, $attrs, $window, $mdConstant, $mdTheming, $mdUtil,
                          $mdDateLocale, $$mdDateUtil, $$rAF, $filter, $timeout) {

    /** @final */
    this.$window = $window;

    /** @final */
    this.dateUtil = $$mdDateUtil;

    /** @final */
    this.$mdConstant = $mdConstant;

    /** @final */
    this.$mdUtil = $mdUtil;

    /** @final */
    this.$$rAF = $$rAF;

    /** @final */
    this.$mdDateLocale = $mdDateLocale;

    /** @final */
    this.$timeout = $timeout;

    /**
     * The root document element. This is used for attaching a top-level click handler to
     * close the calendar panel when a click outside said panel occurs. We use `documentElement`
     * instead of body because, when scrolling is disabled, some browsers consider the body element
     * to be completely off the screen and propagate events directly to the html element.
     * @type {!angular.JQLite}
     */
    this.documentElement = angular.element(document.documentElement);

    /** @type {!angular.NgModelController} */
    this.ngModelCtrl = null;

    /** @type {HTMLInputElement} */
    this.inputElement = $element[0].querySelector('input');

    /** @final {!angular.JQLite} */
    this.ngInputElement = angular.element(this.inputElement);

    /** @type {HTMLElement} */
    this.inputContainer = $element[0].querySelector('.md-datepicker-input-container');

    /** @type {HTMLElement} Floating calendar pane. */
    this.calendarPane = $element[0].querySelector('.md-datepicker-calendar-pane');

    /** @type {HTMLElement} Calendar icon button. */
    this.calendarButton = $element[0].querySelector('.md-datepicker-button');

    /**
     * Element covering everything but the input in the top of the floating calendar pane.
     * @type {!angular.JQLite}
     */
    this.inputMask = angular.element($element[0].querySelector('.md-datepicker-input-mask-opaque'));

    /** @final {!angular.JQLite} */
    this.$element = $element;

    /** @final {!angular.Attributes} */
    this.$attrs = $attrs;

    /** @final {!angular.Scope} */
    this.$scope = $scope;

    /** @type {Date} */
    this.date = null;

    /** @type {boolean} */
    this.isFocused = false;

    /** @type {boolean} */
    this.isDisabled;
    this.setDisabled($element[0].disabled || angular.isString($attrs.disabled));

    /** @type {boolean} Whether the date-picker's calendar pane is open. */
    this.isCalendarOpen = false;

    /** @type {boolean} Whether the calendar should open when the input is focused. */
    this.openOnFocus = $attrs.hasOwnProperty('mdOpenOnFocus');

    /** @final */
    this.mdInputContainer = null;

    /**
     * Element from which the calendar pane was opened. Keep track of this so that we can return
     * focus to it when the pane is closed.
     * @type {HTMLElement}
     */
    this.calendarPaneOpenedFrom = null;

    /** @type {String} Unique id for the calendar pane. */
    this.calendarPaneId = 'md-date-pane-' + $mdUtil.nextUid();

    /** Pre-bound click handler is saved so that the event listener can be removed. */
    this.bodyClickHandler = angular.bind(this, this.handleBodyClick);

    /**
     * Name of the event that will trigger a close. Necessary to sniff the browser, because
     * the resize event doesn't make sense on mobile and can have a negative impact since it
     * triggers whenever the browser zooms in on a focused input.
     */
    this.windowEventName = IS_MOBILE_REGEX.test(
      navigator.userAgent || navigator.vendor || window.opera
    ) ? 'orientationchange' : 'resize';

    /** Pre-bound close handler so that the event listener can be removed. */
    this.windowEventHandler = $mdUtil.debounce(angular.bind(this, this.closeCalendarPane), 100);

    /** Pre-bound handler for the window blur event. Allows for it to be removed later. */
    this.windowBlurHandler = angular.bind(this, this.handleWindowBlur);

    /** The built-in AngularJS date filter. */
    this.ngDateFilter = $filter('date');

    /** @type {Number} Extra margin for the left side of the floating calendar pane. */
    this.leftMargin = 20;

    /** @type {Number} Extra margin for the top of the floating calendar. Gets determined on the first open. */
    this.topMargin = null;

    // Unless the user specifies so, the datepicker should not be a tab stop.
    // This is necessary because ngAria might add a tabindex to anything with an ng-model
    // (based on whether or not the user has turned that particular feature on/off).
    if ($attrs.tabindex) {
      this.ngInputElement.attr('tabindex', $attrs.tabindex);
      $attrs.$set('tabindex', null);
    } else {
      $attrs.$set('tabindex', '-1');
    }

    $attrs.$set('aria-owns', this.calendarPaneId);

    $mdTheming($element);
    $mdTheming(angular.element(this.calendarPane));

    var self = this;

    $scope.$on('$destroy', function() {
      self.detachCalendarPane();
    });

    if ($attrs.mdIsOpen) {
      $scope.$watch('ctrl.isOpen', function(shouldBeOpen) {
        if (shouldBeOpen) {
          self.openCalendarPane({
            target: self.inputElement
          });
        } else {
          self.closeCalendarPane();
        }
      });
    }

    // For AngularJS 1.4 and older, where there are no lifecycle hooks but bindings are pre-assigned,
    // manually call the $onInit hook.
    if (angular.version.major === 1 && angular.version.minor <= 4) {
      this.$onInit();
    }

  }
1305528
private void onDayClick(CalendarDay day) {
        if (mOnDayClickListener != null) {
            mOnDayClickListener.onDayClick(this, day);
        }

        // This is a no-op if accessibility is turned off.
        mNodeProvider.sendEventForItem(day, AccessibilityEvent.TYPE_VIEW_CLICKED);
    }
482244
private void labelWrapModeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelWrapModeMouseClicked
    this.wrapping = this.wrapping.next();
    writeWrappingCode(this.wrapping);
    final Component oldComponent = this.lastComponent;
    this.lastComponent = makeEditorForText(this.document);
    this.remove(oldComponent);
    this.add(this.lastComponent, BorderLayout.CENTER);
    updateBottomPanel();
  }
956312
public void setSelectedDate(@NonNull Calendar date) {
        final int count = getAdapter().getCount() - 1;
        int itemPosition = -1;
        for(int i=0; i<count; i++) {
            if(getAdapter().getItem(i).equals(date)) { // because DateItem deeply compares to calendar
                itemPosition = i;
                break;
            }
        }
        if(itemPosition >= 0)
            setSelection(itemPosition);
        else if(showWeekdayNames) {
            final long MILLIS_IN_DAY = 1000*60*60*24;
            final long dateDifference = (date.getTimeInMillis()/MILLIS_IN_DAY)
                    - (Calendar.getInstance().getTimeInMillis()/MILLIS_IN_DAY);
            if(dateDifference>0 && dateDifference<7) { // if the date is within the next week:
                // construct a temporary DateItem to select:
                final int day = date.get(Calendar.DAY_OF_WEEK);

                // Because these items are always temporarily selected, we can safely assume that
                // they will never appear in the spinner dropdown. When a FLAG_NUMBERS is set, we
                // want these items to have the date as secondary text in a short format.
                selectTemporary(new DateItem(getWeekDay(day, R.string.date_only_weekday), formatSecondaryDate(date), date, NO_ID));
            } else {
                // show the date as a full text, using the current DateFormat:
                selectTemporary(new DateItem(formatDate(date), date, NO_ID));
            }
        }
        else {
            // show the date as a full text, using the current DateFormat:
            selectTemporary(new DateItem(formatDate(date), date, NO_ID));
        }
    }
538711
public void actionPerformed(ActionEvent e) {
		int x = calendarButton.getWidth()
				- (int) popup.getPreferredSize().getWidth();
		int y = calendarButton.getY() + calendarButton.getHeight();

		Calendar calendar = Calendar.getInstance();
		Date date = dateEditor.getDate();
		if (date != null) {
			calendar.setTime(date);
		}
		jcalendar.setCalendar(calendar);
		popup.show(calendarButton, x, y);
		dateSelected = false;
	}
173663
function (out) {
            var cfg = this._cfg;

            var dm = this.controller.getDataModel();

            var calendarConf = {
                block : true,
                startDate : dm.jsDate,
                tabIndex : -1,
                label : cfg.calendarLabel,
                defaultTemplate : cfg.calendarTemplate,
                waiAria: cfg.waiAria,
                waiAriaDateFormat: cfg.waiAriaDateFormat,
                waiAriaLabel: cfg.waiAriaCalendarLabel,
                minValue : cfg.minValue,
                maxValue : cfg.maxValue,
                onclick : {
                    fn : this._clickOnDate,
                    scope : this
                },
                onkeydown : {
                    fn: this._calendar_onkeydown,
                    scope : this
                },
                onmousedown : {
                    fn: this._calendar_onmousedown,
                    scope: this
                },
                onfocus : {
                    fn: this._calendar_onfocus,
                    scope: this
                },
                onblur : {
                    fn: this._calendar_onblur,
                    scope: this
                },
                bind : {
                    "value" : {
                        to : "calendarValue",
                        inside : dm
                    }
                }
            };

            // maps property from datepicker configuration
            var propMapped = ['displayUnit', 'numberOfUnits', 'firstDayOfWeek', 'monthLabelFormat',
                    'dayOfWeekLabelFormat', 'dateLabelFormat', 'completeDateLabelFormat', 'showWeekNumbers',
                    'showShortcuts', 'restrainedNavigation', 'sclass'];
            for (var i = 0, property; property = propMapped[i]; i++) {
                this._applyCalendarCfg(property, calendarConf);
            }

            var calendar = new ariaWidgetsCalendarCalendar(calendarConf, this._context, this._lineNumber);
            calendar.$on({
                'widgetContentReady' : this._refreshPopup,
                scope : this
            });
            this.controller.setCalendar(calendar);
            out.registerBehavior(calendar);
            calendar.writeMarkup(out);
        }
880885
function() {
        var name = this.focusModel.which().columnName;
        var datePicker = this.datePickerMap[name];

        if (datePicker && datePicker.isOpened()) {
            datePicker.close();
        }
    }
582921
function (oEvent) {
				var fnHandleAppsOverlay = function () {
					var $CalendarRowAppsOverlay = jQuery(".sapUiCalendarRowAppsOverlay");

					setTimeout(function () {
						$CalendarRowAppsOverlay.addClass("sapUiCalendarRowAppsOverlayDragging");
					}, 0);

					jQuery(document).one("dragend", function () {
						$CalendarRowAppsOverlay.removeClass("sapUiCalendarRowAppsOverlayDragging");
					});
				};
				if (oTargetTimeline._isOneMonthIntervalOnSmallSizes() || !oTargetTimeline._isDraggingPerformed()) {
					oEvent.preventDefault();
					return;
				}

				fnHandleAppsOverlay();
			}
967272
function _handleDateFocus(oEvent){

		var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
		var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true);
		var bNotVisible = oEvent.getParameter("otherMonth");

		if (bNotVisible &&
				oDate.getUTCMonth() == oFocusedDate.getUTCMonth() &&
				oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) {
			// only show days in the same month
			// set start date and focus date
			_setDateInDatesRow.call(this, oDate);
		}

	}
888281
function datepicker_bindHover(dpDiv) {
	var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
	return dpDiv.delegate(selector, "mouseout", function() {
			$(this).removeClass("ui-state-hover");
			if (this.className.indexOf("ui-datepicker-prev") !== -1) {
				$(this).removeClass("ui-datepicker-prev-hover");
			}
			if (this.className.indexOf("ui-datepicker-next") !== -1) {
				$(this).removeClass("ui-datepicker-next-hover");
			}
		})
		.delegate( selector, "mouseover", datepicker_handleMouseover );
}
537909
function() {
    var value = this.value;
    var selectedValue = (value.getMonth()+1)+"/"+value.getDate()+"/"+value.getFullYear();
    this.calendar.cfg.setProperty("selected",selectedValue,false);
	this.calendar.render();
}
130773
protected void onDayTapped(CalendarDay day) {
        mController.tryVibrate();
        mController.onDayOfMonthSelected(day.year, day.month, day.day);
        setSelectedDay(day);
    }
627577
public void setSelectedDate(Calendar date) {
        if(date!=null) {
            dateSpinner.setSelectedDate(date);
            timeSpinner.setSelectedTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE));
            // a custom selection has been set, don't select the default date:
            shouldSelectDefault = false;
        }
    }
899722
void zApplyAllowKeyboardEditing() {
        if (parentDatePicker == null) {
            return;
        }
        // Set the editability of the date picker text field.
        parentDatePicker.getComponentDateTextField().setEditable(allowKeyboardEditing);
        // Set the text field border color based on whether the text field is editable.
        Color textFieldBorderColor = (allowKeyboardEditing)
            ? InternalConstants.colorEditableTextFieldBorder
            : InternalConstants.colorNotEditableTextFieldBorder;
        parentDatePicker.getComponentDateTextField().setBorder(new CompoundBorder(
            new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2)));
    }
291411
@Override
	public void onDown(HumanInputEvent<?> event) {
		if (dragging && leftWidget) {
			// mouse was moved outside of widget
			doSelect(event);

		} else if (!isRightMouseButton(event)) {
			// no point trying to select when there is no active layer
			dragging = true;
			leftWidget = false;
			timestamp = new Date().getTime();
			begin = getLocation(event, RenderSpace.SCREEN);
			bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
			shift = event.isShiftKeyDown();
			rectangle = new Rectangle("selectionRectangle");
			rectangle.setStyle(rectangleStyle);
			rectangle.setBounds(bounds);
			mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
		}
	}