/** * Called form property listener, updates all components locale, formats * etc. * * @author PeS */ protected void updateLocale() { Locale locale = datePicker.getLocale(); updateFormatLocale(locale); updateChildLocale(locale); }
/** * Called form property listener, updates all components locale, formats * etc. * * @author PeS */ protected void updateLocale() { Locale locale = datePicker.getLocale(); updateFormatLocale(locale); updateChildLocale(locale); }
/** * Called form property listener, updates all components locale, formats * etc. * * @author PeS */ protected void updateLocale() { Locale locale = datePicker.getLocale(); updateFormatLocale(locale); updateChildLocale(locale); }
/** * Called form property listener, updates all components locale, formats * etc. * * @author PeS */ protected void updateLocale() { Locale locale = datePicker.getLocale(); updateFormatLocale(locale); updateChildLocale(locale); }
/** * Called form property listener, updates all components locale, formats * etc. * * @author PeS */ protected void updateLocale() { Locale locale = datePicker.getLocale(); updateFormatLocale(locale); updateChildLocale(locale); }
/** * Update text on the link panel. * */ private void updateLinkFormat() { // PENDING JW: move to ui String linkFormat = UIManagerExt.getString( "JXDatePicker.linkFormat", getLocale()); if (linkFormat != null) { setLinkFormat(new MessageFormat(linkFormat)); } else { setLinkFormat(new MessageFormat("{0,date, dd MMMM yyyy}")); } }
/** * Update text on the link panel. * */ private void updateLinkFormat() { // PENDING JW: move to ui String linkFormat = UIManagerExt.getString( "JXDatePicker.linkFormat", getLocale()); if (linkFormat != null) { setLinkFormat(new MessageFormat(linkFormat)); } else { setLinkFormat(new MessageFormat("{0,date, dd MMMM yyyy}")); } }
/** * Update text on the link panel. * */ private void updateLinkFormat() { // PENDING JW: move to ui String linkFormat = UIManagerExt.getString( "JXDatePicker.linkFormat", getLocale()); if (linkFormat != null) { setLinkFormat(new MessageFormat(linkFormat)); } else { setLinkFormat(new MessageFormat("{0,date, dd MMMM yyyy}")); } }
/** * Update text on the link panel. * */ private void updateLinkFormat() { // PENDING JW: move to ui String linkFormat = UIManagerExt.getString( "JXDatePicker.linkFormat", getLocale()); if (linkFormat != null) { setLinkFormat(new MessageFormat(linkFormat)); } else { setLinkFormat(new MessageFormat("{0,date, dd MMMM yyyy}")); } }
/** * Update text on the link panel. * */ private void updateLinkFormat() { // PENDING JW: move to ui String linkFormat = UIManagerExt.getString( "JXDatePicker.linkFormat", getLocale()); if (linkFormat != null) { setLinkFormat(new MessageFormat(linkFormat)); } else { setLinkFormat(new MessageFormat("{0,date, dd MMMM yyyy}")); } }
/** * Replaces the currently installed formatter and factory used by the * editor. These string formats are defined by the * <code>java.text.SimpleDateFormat</code> class. <p> * * Note: The given formats are internally synched to the picker's current * TimeZone. * * @param formats zero or more not null string formats to use. Note that a * null array is allowed and resets the formatter to use the * localized default formats. * @throws NullPointerException any array element is null. * @see java.text.SimpleDateFormat */ public void setFormats(String... formats) { DateFormat[] dateFormats = null; if (formats != null) { Contract.asNotNull(formats, "the array of format strings must not " + "must not contain null elements"); dateFormats = new DateFormat[formats.length]; for (int counter = formats.length - 1; counter >= 0; counter--) { dateFormats[counter] = new SimpleDateFormat(formats[counter], getLocale()); } } setFormats(dateFormats); }
/** * Creates the editor used to edit the date selection. The editor is * configured with the default DatePickerFormatter marked as UIResource. * * @return an instance of a JFormattedTextField */ protected JFormattedTextField createEditor() { JFormattedTextField f = new DefaultEditor( new DatePickerFormatterUIResource(datePicker.getLocale())); f.setName("dateField"); // this produces a fixed pref widths, looking a bit funny // int columns = UIManagerExt.getInt("JXDatePicker.numColumns", null); // if (columns > 0) { // f.setColumns(columns); // } // that's always 0 as it comes from the resourcebundle // f.setColumns(UIManager.getInt("JXDatePicker.numColumns")); Border border = UIManager.getBorder("JXDatePicker.border"); if (border != null) { f.setBorder(border); } return f; }
/** * Creates the editor used to edit the date selection. The editor is * configured with the default DatePickerFormatter marked as UIResource. * * @return an instance of a JFormattedTextField */ protected JFormattedTextField createEditor() { JFormattedTextField f = new DefaultEditor( new DatePickerFormatterUIResource(datePicker.getLocale())); f.setName("dateField"); // this produces a fixed pref widths, looking a bit funny // int columns = UIManagerExt.getInt("JXDatePicker.numColumns", null); // if (columns > 0) { // f.setColumns(columns); // } // that's always 0 as it comes from the resourcebundle // f.setColumns(UIManager.getInt("JXDatePicker.numColumns")); Border border = UIManager.getBorder("JXDatePicker.border"); if (border != null) { f.setBorder(border); } return f; }
/** * Creates the editor used to edit the date selection. The editor is * configured with the default DatePickerFormatter marked as UIResource. * * @return an instance of a JFormattedTextField */ protected JFormattedTextField createEditor() { JFormattedTextField f = new DefaultEditor( new DatePickerFormatterUIResource(datePicker.getLocale())); f.setName("dateField"); // this produces a fixed pref widths, looking a bit funny // int columns = UIManagerExt.getInt("JXDatePicker.numColumns", null); // if (columns > 0) { // f.setColumns(columns); // } // that's always 0 as it comes from the resourcebundle // f.setColumns(UIManager.getInt("JXDatePicker.numColumns")); Border border = UIManager.getBorder("JXDatePicker.border"); if (border != null) { f.setBorder(border); } return f; }
/** * Replaces the currently installed formatter and factory used by the * editor.<p> * * Note: The given formats are internally synched to the picker's current * TimeZone. * * @param formats zero or more not null formats to use. Note that a * null array is allowed and resets the formatter to use the * localized default formats. * @throws NullPointerException any of its elements is null. */ public void setFormats(DateFormat... formats) { if (formats != null) { Contract.asNotNull(formats, "the array of formats " + "must not contain null elements"); } DateFormat[] old = getFormats(); _dateField.setFormatterFactory(new DefaultFormatterFactory( new DatePickerFormatter(formats, getLocale()))); firePropertyChange("formats", old, getFormats()); }
/** * Replaces the currently installed formatter and factory used by the * editor.<p> * * Note: The given formats are internally synched to the picker's current * TimeZone. * * @param formats zero or more not null formats to use. Note that a * null array is allowed and resets the formatter to use the * localized default formats. * @throws NullPointerException any of its elements is null. */ public void setFormats(DateFormat... formats) { if (formats != null) { Contract.asNotNull(formats, "the array of formats " + "must not contain null elements"); } DateFormat[] old = getFormats(); _dateField.setFormatterFactory(new DefaultFormatterFactory( new DatePickerFormatter(formats, getLocale()))); firePropertyChange("formats", old, getFormats()); }
/** * Replaces the currently installed formatter and factory used by the * editor.<p> * * Note: The given formats are internally synched to the picker's current * TimeZone. * * @param formats zero or more not null formats to use. Note that a * null array is allowed and resets the formatter to use the * localized default formats. * @throws NullPointerException any of its elements is null. */ public void setFormats(DateFormat... formats) { if (formats != null) { Contract.asNotNull(formats, "the array of formats " + "must not contain null elements"); } DateFormat[] old = getFormats(); _dateField.setFormatterFactory(new DefaultFormatterFactory( new DatePickerFormatter(formats, getLocale()))); firePropertyChange("formats", old, getFormats()); }
/** * Replaces the currently installed formatter and factory used by the * editor.<p> * * Note: The given formats are internally synched to the picker's current * TimeZone. * * @param formats zero or more not null formats to use. Note that a * null array is allowed and resets the formatter to use the * localized default formats. * @throws NullPointerException any of its elements is null. */ public void setFormats(DateFormat... formats) { if (formats != null) { Contract.asNotNull(formats, "the array of formats " + "must not contain null elements"); } DateFormat[] old = getFormats(); _dateField.setFormatterFactory(new DefaultFormatterFactory( new DatePickerFormatter(formats, getLocale()))); firePropertyChange("formats", old, getFormats()); }
/** * Replaces the currently installed formatter and factory used by the * editor.<p> * * Note: The given formats are internally synched to the picker's current * TimeZone. * * @param formats zero or more not null formats to use. Note that a * null array is allowed and resets the formatter to use the * localized default formats. * @throws NullPointerException any of its elements is null. */ public void setFormats(DateFormat... formats) { if (formats != null) { Contract.asNotNull(formats, "the array of formats " + "must not contain null elements"); } DateFormat[] old = getFormats(); _dateField.setFormatterFactory(new DefaultFormatterFactory( new DatePickerFormatter(formats, getLocale()))); firePropertyChange("formats", old, getFormats()); }
protected void installComponents() { JFormattedTextField editor = datePicker.getEditor(); if (SwingXUtilities.isUIInstallable(editor)) { DateFormat[] formats = getCustomFormats(editor); // we are not yet listening ... datePicker.setEditor(createEditor()); if (formats != null) { datePicker.setFormats(formats); } } updateFromEditorChanged(null, false); popupButton = createPopupButton(); if (popupButton != null) { // this is a trick to get hold of the client prop which // prevents closing of the popup JComboBox box = new JComboBox(); Object preventHide = box.getClientProperty("doNotCancelPopup"); popupButton.putClientProperty("doNotCancelPopup", preventHide); datePicker.add(popupButton); } updateChildLocale(datePicker.getLocale()); }