Java 类javax.swing.JFormattedTextField.AbstractFormatterFactory 实例源码

项目:swingx    文件:BasicDatePickerUI.java   
/**
     * Checks and returns custom formats on the editor, if any.
     * 
     * @param editor the editor to check
     * @return the custom formats uses in the editor or null if it had
     *   used defaults as defined in the datepicker properties
     */
    private DateFormat[] getCustomFormats(JFormattedTextField editor) {
        DateFormat[] formats = null;
        if (editor != null) {
            AbstractFormatterFactory factory = editor.getFormatterFactory();
            if (factory != null) {
                AbstractFormatter formatter = factory.getFormatter(editor);
                // fix for #1144: classCastException for custom formatters
                // PENDING JW: revisit for #1138
                if ((formatter instanceof DatePickerFormatter) && !(formatter instanceof UIResource)) {
//                if (!(formatter instanceof DatePickerFormatterUIResource))  {
                    formats = ((DatePickerFormatter) formatter).getFormats();
                }
            }

        }
        return formats;
    }
项目:swingx    文件:JXDatePicker.java   
/**
 * Returns an array of the formats used by the installed formatter
 * if it is a subclass of <code>JXDatePickerFormatter<code>.
 * <code>javax.swing.JFormattedTextField.AbstractFormatter</code>
 * and <code>javax.swing.text.DefaultFormatter</code> do not have
 * support for accessing the formats used.
 *
 * @return array of formats guaranteed to be not null, but might be empty.
 */
public DateFormat[] getFormats() {
    // Dig this out from the factory, if possible, otherwise return null.
    AbstractFormatterFactory factory = _dateField.getFormatterFactory();
    if (factory != null) {
        AbstractFormatter formatter = factory.getFormatter(_dateField);
        if (formatter instanceof DatePickerFormatter) {
            return ((DatePickerFormatter) formatter).getFormats();
        }
    }
    return EMPTY_DATE_FORMATS;
}
项目:metasfresh    文件:SwingTerminalTextField.java   
public void setFormatterFactory(final AbstractFormatterFactory formatter)
{
    if (textComponent instanceof JFormattedTextField)
    {
        ((JFormattedTextField)textComponent).setFormatterFactory(formatter);
    }
}
项目:metasfresh    文件:SwingTerminalTextField.java   
public AbstractFormatterFactory getFormatterFactory()
{
    if (textComponent instanceof JFormattedTextField)
    {
        return ((JFormattedTextField)textComponent).getFormatterFactory();
    }
    else
    {
        return null;
    }
}
项目:aibench-project    文件:JXDatePicker.java   
/**
 * Returns an array of the formats used by the installed formatter
 * if it is a subclass of <code>JXDatePickerFormatter<code>.
 * <code>javax.swing.JFormattedTextField.AbstractFormatter</code>
 * and <code>javax.swing.text.DefaultFormatter</code> do not have
 * support for accessing the formats used.
 *
 * @return array of formats guaranteed to be not null, but might be empty.
 */
public DateFormat[] getFormats() {
    // Dig this out from the factory, if possible, otherwise return null.
    AbstractFormatterFactory factory = _dateField.getFormatterFactory();
    if (factory != null) {
        AbstractFormatter formatter = factory.getFormatter(_dateField);
        if (formatter instanceof DatePickerFormatter) {
            return ((DatePickerFormatter) formatter).getFormats();
        }
    }
    return EMPTY_DATE_FORMATS;
}
项目:aibench-project    文件:BasicDatePickerUI.java   
/**
 * Checks and returns custom formats on the editor, if any.
 * 
 * @param editor the editor to check
 * @return the custom formats uses in the editor or null if it had
 *   used defaults as defined in the datepicker properties
 */
private DateFormat[] getCustomFormats(JFormattedTextField editor) {
    DateFormat[] formats = null;
    if (editor != null) {
        AbstractFormatterFactory factory = editor.getFormatterFactory();
        if (factory != null) {
            AbstractFormatter formatter = factory.getFormatter(editor);
            if (!(formatter instanceof DatePickerFormatterUIResource))  {
                formats = ((DatePickerFormatter) formatter).getFormats();
            }
        }

    }
    return formats;
}
项目:ireport-fork    文件:DateRangeDatePicker.java   
/**
 * Returns an array of the formats used by the installed formatter
 * if it is a subclass of <code>JXDatePickerFormatter<code>.
 * <code>javax.swing.JFormattedTextField.AbstractFormatter</code>
 * and <code>javax.swing.text.DefaultFormatter</code> do not have
 * support for accessing the formats used.
 *
 * @return array of formats or null if unavailable.
 */
public DateFormat[] getFormats() {
    // Dig this out from the factory, if possible, otherwise return null.
    AbstractFormatterFactory factory = _dateField.getFormatterFactory();
    if (factory != null) {
        AbstractFormatter formatter = factory.getFormatter(_dateField);
        if (formatter instanceof JXDatePickerFormatter) {
            return ((JXDatePickerFormatter)formatter).getFormats();
        }
    }
    return null;
}
项目:binnavi    文件:HexSearcher.java   
@Override
public AbstractFormatterFactory getFormatterFactory() {
  return m_factory;
}
项目:binnavi    文件:AsciiSearcher.java   
@Override
public AbstractFormatterFactory getFormatterFactory() {
  return null;
}
项目:binnavi    文件:UnicodeSearcher.java   
@Override
public AbstractFormatterFactory getFormatterFactory() {
  return null;
}
项目:swingx    文件:DatePickerDemo.java   
private void configureComponents() {
    dateEchoField.setEditable(false);
    AbstractFormatter formatter = new DateFormatter(DateFormat.getDateTimeInstance());
    AbstractFormatterFactory tf = new DefaultFormatterFactory(formatter);
    dateEchoField.setFormatterFactory(tf);
}
项目:umple    文件:JavaNumberFormatter.java   
/**
 * Convenience method for creating a formatter factory with a
 * {@code ScalableNumberFormatter} and a Java-style DecimalFormat.
 */
public static AbstractFormatterFactory createFormatterFactory(double min, double max, double multiplier, boolean allowsNullValue) {
    JavaNumberFormatter formatter = new JavaNumberFormatter(min, max, multiplier, allowsNullValue, null);
    return new DefaultFormatterFactory(formatter);
}
项目:umple    文件:JavaNumberFormatter.java   
/**
 * Convenience method for creating a formatter factory with a
 * {@code ScalableNumberFormatter} and a Java-style DecimalFormat.
 */
public static AbstractFormatterFactory createFormatterFactory(double min, double max, double multiplier, boolean allowsNullValue, @Nullable String unit) {
    JavaNumberFormatter formatter = new JavaNumberFormatter(min, max, multiplier, allowsNullValue, unit);
    return new DefaultFormatterFactory(formatter);
}
项目:umple    文件:FontFormatter.java   
public static AbstractFormatterFactory createFormatterFactory(boolean allowsNullValue) {
    return new DefaultFormatterFactory(new FontFormatter(allowsNullValue));
}
项目:umple    文件:ColorFormatter.java   
public static AbstractFormatterFactory createFormatterFactory() {
    return createFormatterFactory(Format.RGB_INTEGER_SHORT, true, true);
}
项目:umple    文件:ColorFormatter.java   
public static AbstractFormatterFactory createFormatterFactory(Format outputFormat, boolean allowsNullValue, boolean isAdaptive) {
    return new DefaultFormatterFactory(new ColorFormatter(outputFormat, allowsNullValue, isAdaptive));
}
项目:spring-rich-client    文件:FormattedTextFieldBinder.java   
protected JComponent createControl(Map context) {
    return getComponentFactory().createFormattedTextField(
            (AbstractFormatterFactory)context.get(FORMATTER_FACTORY_KEY));
}
项目:spring-rich-client    文件:SwingBindingFactory.java   
public Binding createBoundFormattedTextField(String formProperty, AbstractFormatterFactory formatterFactory) {
    Map context = createContext(FormattedTextFieldBinder.FORMATTER_FACTORY_KEY, formatterFactory);
    return createBinding(JFormattedTextField.class, formProperty, context);
}
项目:spring-rich-client    文件:DefaultComponentFactory.java   
public JFormattedTextField createFormattedTextField(AbstractFormatterFactory formatterFactory) {
    PatchedJFormattedTextField patchedJFormattedTextField = new PatchedJFormattedTextField(formatterFactory);
    configureTextField(patchedJFormattedTextField);
    return patchedJFormattedTextField;
}
项目:spring-richclient    文件:FormattedTextFieldBinder.java   
protected JComponent createControl(Map context) {
    return getComponentFactory().createFormattedTextField(
            (AbstractFormatterFactory)context.get(FORMATTER_FACTORY_KEY));
}
项目:spring-richclient    文件:SwingBindingFactory.java   
public Binding createBoundFormattedTextField(String formProperty, AbstractFormatterFactory formatterFactory) {
    Map context = createContext(FormattedTextFieldBinder.FORMATTER_FACTORY_KEY, formatterFactory);
    return createBinding(JFormattedTextField.class, formProperty, context);
}
项目:spring-richclient    文件:DefaultComponentFactory.java   
public JFormattedTextField createFormattedTextField(AbstractFormatterFactory formatterFactory) {
    PatchedJFormattedTextField patchedJFormattedTextField = new PatchedJFormattedTextField(formatterFactory);
    configureTextField(patchedJFormattedTextField);
    return patchedJFormattedTextField;
}
项目:binnavi    文件:ISearcher.java   
/**
 * Returns the formatter factory that decides about valid inputs for the search data type.
 *
 * @return A valid formatter factory or null.
 */
AbstractFormatterFactory getFormatterFactory();
项目:umple    文件:JavaNumberFormatter.java   
/**
 * Convenience method for creating a formatter factory with a
 * {@code ScalableNumberFormatter} and a Java-style DecimalFormat.
 * Doesn't allow null values and doesn't append ".0" to double and float values.
 */
public static AbstractFormatterFactory createFormatterFactory(double min, double max, double multiplier) {
    return createFormatterFactory(min, max, multiplier, false, null);
}
项目:umple    文件:FontFormatter.java   
/**
 * Convenience method for creating a formatter factory with a
 * {@code FontFormatter}.
 * Uses the RGB_INTEGER format and disallows null values.
 */
public static AbstractFormatterFactory createFormatterFactory() {
    return createFormatterFactory(false);
}
项目:umple    文件:ColorFormatter.java   
/**
 * Convenience method for creating a formatter factory with a
 * {@code ColorFormatter}.
 * Uses the RGB_INTEGER_SHORT format, allows null values and is adaptive.
 */
public static AbstractFormatterFactory createFormatterFactory() {
    return createFormatterFactory(Format.RGB_INTEGER_SHORT, true, true);
}
项目:umple    文件:FontFormatter.java   
/**
 * Convenience method for creating a formatter factory with a
 * {@code FontFormatter}.
 * Uses the RGB_INTEGER format and disallows null values.
 */
public static AbstractFormatterFactory createFormatterFactory() {
    return createFormatterFactory(false);
}
项目:spring-rich-client    文件:ComponentFactory.java   
/**
 * Create a formatted text field using this component factory.
 *
 * @param formatterFactory AbstractFormatterFactory used for formatting.
 * @return The new formatted text field
 */
public JFormattedTextField createFormattedTextField(AbstractFormatterFactory formatterFactory);
项目:spring-richclient    文件:ComponentFactory.java   
/**
 * Create a formatted text field using this component factory.
 *
 * @param formatterFactory AbstractFormatterFactory used for formatting.
 * @return The new formatted text field
 */
public JFormattedTextField createFormattedTextField(AbstractFormatterFactory formatterFactory);