< prev index next >

src/java.desktop/share/classes/javax/swing/text/InternationalFormatter.java

Print this page

        

*** 30,103 **** import java.text.AttributedCharacterIterator.Attribute; import java.util.*; import javax.swing.*; /** ! * <code>InternationalFormatter</code> extends <code>DefaultFormatter</code>, ! * using an instance of <code>java.text.Format</code> to handle the * conversion to a String, and the conversion from a String. * <p> ! * If <code>getAllowsInvalid()</code> is false, this will ask the ! * <code>Format</code> to format the current text on every edit. * <p> * You can specify a minimum and maximum value by way of the ! * <code>setMinimum</code> and <code>setMaximum</code> methods. In order ! * for this to work the values returned from <code>stringToValue</code> must be ! * comparable to the min/max values by way of the <code>Comparable</code> * interface. * <p> ! * Be careful how you configure the <code>Format</code> and the ! * <code>InternationalFormatter</code>, as it is possible to create a * situation where certain values can not be input. Consider the date ! * format 'M/d/yy', an <code>InternationalFormatter</code> that is always ! * valid (<code>setAllowsInvalid(false)</code>), is in overwrite mode ! * (<code>setOverwriteMode(true)</code>) and the date 7/1/99. In this * case the user will not be able to enter a two digit month or day of * month. To avoid this, the format should be 'MM/dd/yy'. * <p> ! * If <code>InternationalFormatter</code> is configured to only allow valid ! * values (<code>setAllowsInvalid(false)</code>), every valid edit will result ! * in the text of the <code>JFormattedTextField</code> being completely reset ! * from the <code>Format</code>. * The cursor position will also be adjusted as literal characters are * added/removed from the resulting String. * <p> ! * <code>InternationalFormatter</code>'s behavior of ! * <code>stringToValue</code> is slightly different than that of ! * <code>DefaultTextFormatter</code>, it does the following: * <ol> ! * <li><code>parseObject</code> is invoked on the <code>Format</code> ! * specified by <code>setFormat</code> ! * <li>If a Class has been set for the values (<code>setValueClass</code>), * supers implementation is invoked to convert the value returned ! * from <code>parseObject</code> to the appropriate class. ! * <li>If a <code>ParseException</code> has not been thrown, and the value ! * is outside the min/max a <code>ParseException</code> is thrown. * <li>The value is returned. * </ol> ! * <code>InternationalFormatter</code> implements <code>stringToValue</code> * in this manner so that you can specify an alternate Class than ! * <code>Format</code> may return. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see java.text.Format * @see java.lang.Comparable * * @since 1.4 */ @SuppressWarnings("serial") // Same-version serialization only public class InternationalFormatter extends DefaultFormatter { /** ! * Used by <code>getFields</code>. */ private static final Format.Field[] EMPTY_FIELD_ARRAY =new Format.Field[0]; /** * Object used to handle the conversion. --- 30,103 ---- import java.text.AttributedCharacterIterator.Attribute; import java.util.*; import javax.swing.*; /** ! * {@code InternationalFormatter} extends {@code DefaultFormatter}, ! * using an instance of {@code java.text.Format} to handle the * conversion to a String, and the conversion from a String. * <p> ! * If {@code getAllowsInvalid()} is false, this will ask the ! * {@code Format} to format the current text on every edit. * <p> * You can specify a minimum and maximum value by way of the ! * {@code setMinimum} and {@code setMaximum} methods. In order ! * for this to work the values returned from {@code stringToValue} must be ! * comparable to the min/max values by way of the {@code Comparable} * interface. * <p> ! * Be careful how you configure the {@code Format} and the ! * {@code InternationalFormatter}, as it is possible to create a * situation where certain values can not be input. Consider the date ! * format 'M/d/yy', an {@code InternationalFormatter} that is always ! * valid ({@code setAllowsInvalid(false)}), is in overwrite mode ! * ({@code setOverwriteMode(true)}) and the date 7/1/99. In this * case the user will not be able to enter a two digit month or day of * month. To avoid this, the format should be 'MM/dd/yy'. * <p> ! * If {@code InternationalFormatter} is configured to only allow valid ! * values ({@code setAllowsInvalid(false)}), every valid edit will result ! * in the text of the {@code JFormattedTextField} being completely reset ! * from the {@code Format}. * The cursor position will also be adjusted as literal characters are * added/removed from the resulting String. * <p> ! * {@code InternationalFormatter}'s behavior of ! * {@code stringToValue} is slightly different than that of ! * {@code DefaultTextFormatter}, it does the following: * <ol> ! * <li>{@code parseObject} is invoked on the {@code Format} ! * specified by {@code setFormat} ! * <li>If a Class has been set for the values ({@code setValueClass}), * supers implementation is invoked to convert the value returned ! * from {@code parseObject} to the appropriate class. ! * <li>If a {@code ParseException} has not been thrown, and the value ! * is outside the min/max a {@code ParseException} is thrown. * <li>The value is returned. * </ol> ! * {@code InternationalFormatter} implements {@code stringToValue} * in this manner so that you can specify an alternate Class than ! * {@code Format} may return. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see java.text.Format * @see java.lang.Comparable * * @since 1.4 */ @SuppressWarnings("serial") // Same-version serialization only public class InternationalFormatter extends DefaultFormatter { /** ! * Used by {@code getFields}. */ private static final Format.Field[] EMPTY_FIELD_ARRAY =new Format.Field[0]; /** * Object used to handle the conversion.
*** 111,141 **** * Can be used to impose a minimum value. */ private Comparable<?> min; /** ! * <code>InternationalFormatter</code>'s behavior is dicatated by a ! * <code>AttributedCharacterIterator</code> that is obtained from ! * the <code>Format</code>. On every edit, assuming ! * allows invalid is false, the <code>Format</code> instance is invoked ! * with <code>formatToCharacterIterator</code>. A <code>BitSet</code> is * also kept upto date with the non-literal characters, that is ! * for every index in the <code>AttributedCharacterIterator</code> an * entry in the bit set is updated based on the return value from ! * <code>isLiteral(Map)</code>. <code>isLiteral(int)</code> then uses * this cached information. * <p> * If allowsInvalid is false, every edit results in resetting the complete * text of the JTextComponent. * <p> * InternationalFormatterFilter can also provide two actions suitable for * incrementing and decrementing. To enable this a subclass must ! * override <code>getSupportsIncrement</code> to return true, and ! * override <code>adjustValue</code> to handle the changing of the * value. If you want to support changing the value outside of * the valid FieldPositions, you will need to override ! * <code>canIncrement</code>. */ /** * A bit is set for every index identified in the * AttributedCharacterIterator that is not considered decoration. * This should only be used if validMask is true. --- 111,141 ---- * Can be used to impose a minimum value. */ private Comparable<?> min; /** ! * {@code InternationalFormatter}'s behavior is dicatated by a ! * {@code AttributedCharacterIterator} that is obtained from ! * the {@code Format}. On every edit, assuming ! * allows invalid is false, the {@code Format} instance is invoked ! * with {@code formatToCharacterIterator}. A {@code BitSet} is * also kept upto date with the non-literal characters, that is ! * for every index in the {@code AttributedCharacterIterator} an * entry in the bit set is updated based on the return value from ! * {@code isLiteral(Map)}. {@code isLiteral(int)} then uses * this cached information. * <p> * If allowsInvalid is false, every edit results in resetting the complete * text of the JTextComponent. * <p> * InternationalFormatterFilter can also provide two actions suitable for * incrementing and decrementing. To enable this a subclass must ! * override {@code getSupportsIncrement} to return true, and ! * override {@code adjustValue} to handle the changing of the * value. If you want to support changing the value outside of * the valid FieldPositions, you will need to override ! * {@code canIncrement}. */ /** * A bit is set for every index identified in the * AttributedCharacterIterator that is not considered decoration. * This should only be used if validMask is true.
*** 161,180 **** */ private transient boolean ignoreDocumentMutate; /** ! * Creates an <code>InternationalFormatter</code> with no ! * <code>Format</code> specified. */ public InternationalFormatter() { setOverwriteMode(false); } /** ! * Creates an <code>InternationalFormatter</code> with the specified ! * <code>Format</code> instance. * * @param format Format instance used for converting from/to Strings */ public InternationalFormatter(Format format) { this(); --- 161,180 ---- */ private transient boolean ignoreDocumentMutate; /** ! * Creates an {@code InternationalFormatter} with no ! * {@code Format} specified. */ public InternationalFormatter() { setOverwriteMode(false); } /** ! * Creates an {@code InternationalFormatter} with the specified ! * {@code Format} instance. * * @param format Format instance used for converting from/to Strings */ public InternationalFormatter(Format format) { this();
*** 183,193 **** /** * Sets the format that dictates the legal values that can be edited * and displayed. * ! * @param format <code>Format</code> instance used for converting * from/to Strings */ public void setFormat(Format format) { this.format = format; } --- 183,193 ---- /** * Sets the format that dictates the legal values that can be edited * and displayed. * ! * @param format {@code Format} instance used for converting * from/to Strings */ public void setFormat(Format format) { this.format = format; }
*** 201,214 **** public Format getFormat() { return format; } /** ! * Sets the minimum permissible value. If the <code>valueClass</code> has ! * not been specified, and <code>minimum</code> is non null, the ! * <code>valueClass</code> will be set to that of the class of ! * <code>minimum</code>. * * @param minimum Minimum legal value that can be input * @see #setValueClass */ public void setMinimum(Comparable<?> minimum) { --- 201,214 ---- public Format getFormat() { return format; } /** ! * Sets the minimum permissible value. If the {@code valueClass} has ! * not been specified, and {@code minimum} is non null, the ! * {@code valueClass} will be set to that of the class of ! * {@code minimum}. * * @param minimum Minimum legal value that can be input * @see #setValueClass */ public void setMinimum(Comparable<?> minimum) {
*** 226,239 **** public Comparable<?> getMinimum() { return min; } /** ! * Sets the maximum permissible value. If the <code>valueClass</code> has ! * not been specified, and <code>max</code> is non null, the ! * <code>valueClass</code> will be set to that of the class of ! * <code>max</code>. * * @param max Maximum legal value that can be input * @see #setValueClass */ public void setMaximum(Comparable<?> max) { --- 226,239 ---- public Comparable<?> getMinimum() { return min; } /** ! * Sets the maximum permissible value. If the {@code valueClass} has ! * not been specified, and {@code max} is non null, the ! * {@code valueClass} will be set to that of the class of ! * {@code max}. * * @param max Maximum legal value that can be input * @see #setValueClass */ public void setMaximum(Comparable<?> max) {
*** 251,283 **** public Comparable<?> getMaximum() { return max; } /** ! * Installs the <code>DefaultFormatter</code> onto a particular ! * <code>JFormattedTextField</code>. ! * This will invoke <code>valueToString</code> to convert the ! * current value from the <code>JFormattedTextField</code> to ! * a String. This will then install the <code>Action</code>s from ! * <code>getActions</code>, the <code>DocumentFilter</code> ! * returned from <code>getDocumentFilter</code> and the ! * <code>NavigationFilter</code> returned from ! * <code>getNavigationFilter</code> onto the ! * <code>JFormattedTextField</code>. * <p> * Subclasses will typically only need to override this if they * wish to install additional listeners on the ! * <code>JFormattedTextField</code>. * <p> ! * If there is a <code>ParseException</code> in converting the * current value to a String, this will set the text to an empty ! * String, and mark the <code>JFormattedTextField</code> as being * in an invalid state. * <p> * While this is a public method, this is typically only useful ! * for subclassers of <code>JFormattedTextField</code>. ! * <code>JFormattedTextField</code> will invoke this method at * the appropriate times when the value changes, or its internal * state changes. * * @param ftf JFormattedTextField to format for, may be null indicating * uninstall from current JFormattedTextField. --- 251,283 ---- public Comparable<?> getMaximum() { return max; } /** ! * Installs the {@code DefaultFormatter} onto a particular ! * {@code JFormattedTextField}. ! * This will invoke {@code valueToString} to convert the ! * current value from the {@code JFormattedTextField} to ! * a String. This will then install the {@code Action}s from ! * {@code getActions}, the {@code DocumentFilter} ! * returned from {@code getDocumentFilter} and the ! * {@code NavigationFilter} returned from ! * {@code getNavigationFilter} onto the ! * {@code JFormattedTextField}. * <p> * Subclasses will typically only need to override this if they * wish to install additional listeners on the ! * {@code JFormattedTextField}. * <p> ! * If there is a {@code ParseException} in converting the * current value to a String, this will set the text to an empty ! * String, and mark the {@code JFormattedTextField} as being * in an invalid state. * <p> * While this is a public method, this is typically only useful ! * for subclassers of {@code JFormattedTextField}. ! * {@code JFormattedTextField} will invoke this method at * the appropriate times when the value changes, or its internal * state changes. * * @param ftf JFormattedTextField to format for, may be null indicating * uninstall from current JFormattedTextField.
*** 288,299 **** // invoked again as the mask should now be valid. positionCursorAtInitialLocation(); } /** ! * Returns a String representation of the Object <code>value</code>. ! * This invokes <code>format</code> on the current <code>Format</code>. * * @throws ParseException if there is an error in the conversion * @param value Value to convert * @return String representation of value */ --- 288,299 ---- // invoked again as the mask should now be valid. positionCursorAtInitialLocation(); } /** ! * Returns a String representation of the Object {@code value}. ! * This invokes {@code format} on the current {@code Format}. * * @throws ParseException if there is an error in the conversion * @param value Value to convert * @return String representation of value */
*** 308,322 **** } return f.format(value); } /** ! * Returns the <code>Object</code> representation of the ! * <code>String</code> <code>text</code>. * ! * @param text <code>String</code> to convert ! * @return <code>Object</code> representation of text * @throws ParseException if there is an error in the conversion */ public Object stringToValue(String text) throws ParseException { Object value = stringToValue(text, getFormat()); --- 308,322 ---- } return f.format(value); } /** ! * Returns the {@code Object} representation of the ! * {@code String text}. * ! * @param text {@code String} to convert ! * @return {@code Object} representation of text * @throws ParseException if there is an error in the conversion */ public Object stringToValue(String text) throws ParseException { Object value = stringToValue(text, getFormat());
*** 336,347 **** } return value; } /** ! * Returns the <code>Format.Field</code> constants associated with ! * the text at <code>offset</code>. If <code>offset</code> is not * a valid location into the current text, this will return an * empty array. * * @param offset offset into text to be examined * @return Format.Field constants associated with the text at the --- 336,347 ---- } return value; } /** ! * Returns the {@code Format.Field} constants associated with ! * the text at {@code offset}. If {@code offset} is not * a valid location into the current text, this will return an * empty array. * * @param offset offset into text to be examined * @return Format.Field constants associated with the text at the
*** 379,389 **** formatter.string = null; return formatter; } /** ! * If <code>getSupportsIncrement</code> returns true, this returns * two Actions suitable for incrementing/decrementing the value. */ protected Action[] getActions() { if (getSupportsIncrement()) { return new Action[] { new IncrementAction("increment", 1), --- 379,389 ---- formatter.string = null; return formatter; } /** ! * If {@code getSupportsIncrement} returns true, this returns * two Actions suitable for incrementing/decrementing the value. */ protected Action[] getActions() { if (getSupportsIncrement()) { return new Action[] { new IncrementAction("increment", 1),
*** 391,412 **** } return null; } /** ! * Invokes <code>parseObject</code> on <code>f</code>, returning * its value. */ Object stringToValue(String text, Format f) throws ParseException { if (f == null) { return text; } return f.parseObject(text); } /** ! * Returns true if <code>value</code> is between the min/max. * * @param wantsCCE If false, and a ClassCastException is thrown in * comparing the values, the exception is consumed and * false is returned. */ --- 391,412 ---- } return null; } /** ! * Invokes {@code parseObject} on {@code f}, returning * its value. */ Object stringToValue(String text, Format f) throws ParseException { if (f == null) { return text; } return f.parseObject(text); } /** ! * Returns true if {@code value} is between the min/max. * * @param wantsCCE If false, and a ClassCastException is thrown in * comparing the values, the exception is consumed and * false is returned. */
*** 439,449 **** } return true; } /** ! * Returns a Set of the attribute identifiers at <code>index</code>. */ Map<Attribute, Object> getAttributes(int index) { if (isValidMask()) { AttributedCharacterIterator iterator = getIterator(); --- 439,449 ---- } return true; } /** ! * Returns a Set of the attribute identifiers at {@code index}. */ Map<Attribute, Object> getAttributes(int index) { if (isValidMask()) { AttributedCharacterIterator iterator = getIterator();
*** 456,466 **** } /** * Returns the start of the first run that contains the attribute ! * <code>id</code>. This will return <code>-1</code> if the attribute * can not be found. */ int getAttributeStart(AttributedCharacterIterator.Attribute id) { if (isValidMask()) { AttributedCharacterIterator iterator = getIterator(); --- 456,466 ---- } /** * Returns the start of the first run that contains the attribute ! * {@code id}. This will return {@code -1} if the attribute * can not be found. */ int getAttributeStart(AttributedCharacterIterator.Attribute id) { if (isValidMask()) { AttributedCharacterIterator iterator = getIterator();
*** 475,485 **** } return -1; } /** ! * Returns the <code>AttributedCharacterIterator</code> used to * format the last value. */ AttributedCharacterIterator getIterator() { return iterator; } --- 475,485 ---- } return -1; } /** ! * Returns the {@code AttributedCharacterIterator} used to * format the last value. */ AttributedCharacterIterator getIterator() { return iterator; }
*** 502,514 **** } } /** * Updates the AttributedCharacterIterator by invoking ! * <code>formatToCharacterIterator</code> on the <code>Format</code>. * If this is successful, ! * <code>updateMask(AttributedCharacterIterator)</code> * is then invoked to update the internal bitmask. */ void updateMask() { if (getFormat() != null) { Document doc = getFormattedTextField().getDocument(); --- 502,514 ---- } } /** * Updates the AttributedCharacterIterator by invoking ! * {@code formatToCharacterIterator} on the {@code Format}. * If this is successful, ! * {@code updateMask(AttributedCharacterIterator)} * is then invoked to update the internal bitmask. */ void updateMask() { if (getFormat() != null) { Document doc = getFormattedTextField().getDocument();
*** 535,545 **** } } } /** ! * Returns the number of literal characters before <code>index</code>. */ int getLiteralCountTo(int index) { int lCount = 0; for (int counter = 0; counter < index; counter++) { --- 535,545 ---- } } } /** ! * Returns the number of literal characters before {@code index}. */ int getLiteralCountTo(int index) { int lCount = 0; for (int counter = 0; counter < index; counter++) {
*** 571,581 **** return (char)0; } /** * Returns true if the character at offset is navigable too. This ! * is implemented in terms of <code>isLiteral</code>, subclasses * may wish to provide different behavior. */ boolean isNavigatable(int offset) { return !isLiteral(offset); } --- 571,581 ---- return (char)0; } /** * Returns true if the character at offset is navigable too. This ! * is implemented in terms of {@code isLiteral}, subclasses * may wish to provide different behavior. */ boolean isNavigatable(int offset) { return !isLiteral(offset); }
*** 684,694 **** /** * When in !allowsInvalid mode the text is reset on every edit, thus * supers implementation will position the cursor at the wrong position. * As such, this invokes supers implementation and then invokes ! * <code>repositionCursor</code> to correctly reset the cursor. */ boolean replace(ReplaceHolder rh) throws BadLocationException { int start = -1; int direction = 1; int literalCount = -1; --- 684,694 ---- /** * When in !allowsInvalid mode the text is reset on every edit, thus * supers implementation will position the cursor at the wrong position. * As such, this invokes supers implementation and then invokes ! * {@code repositionCursor} to correctly reset the cursor. */ boolean replace(ReplaceHolder rh) throws BadLocationException { int start = -1; int direction = 1; int literalCount = -1;
*** 726,739 **** } return false; } /** ! * Repositions the cursor. <code>startLiteralCount</code> gives * the number of literals to the start of the deleted range, end * gives the ending location to adjust from, direction gives ! * the direction relative to <code>end</code> to position the * cursor from. */ private void repositionCursor(int startLiteralCount, int end, int direction) { int endLiteralCount = getLiteralCountTo(end); --- 726,739 ---- } return false; } /** ! * Repositions the cursor. {@code startLiteralCount} gives * the number of literals to the start of the deleted range, end * gives the ending location to adjust from, direction gives ! * the direction relative to {@code end} to position the * cursor from. */ private void repositionCursor(int startLiteralCount, int end, int direction) { int endLiteralCount = getLiteralCountTo(end);
*** 749,759 **** repositionCursor(end, 1 /*direction*/); } /** * Returns the character from the mask that has been buffered ! * at <code>index</code>. */ char getBufferedChar(int index) { if (isValidMask()) { if (string != null && index < string.length()) { return string.charAt(index); --- 749,759 ---- repositionCursor(end, 1 /*direction*/); } /** * Returns the character from the mask that has been buffered ! * at {@code index}. */ char getBufferedChar(int index) { if (isValidMask()) { if (string != null && index < string.length()) { return string.charAt(index);
*** 768,786 **** boolean isValidMask() { return validMask; } /** ! * Returns true if <code>attributes</code> is null or empty. */ boolean isLiteral(Map<?, ?> attributes) { return ((attributes == null) || attributes.size() == 0); } /** ! * Updates the interal bitset from <code>iterator</code>. This will ! * set <code>validMask</code> to true if <code>iterator</code> is * non-null. */ private void updateMask(AttributedCharacterIterator iterator) { if (iterator != null) { validMask = true; --- 768,786 ---- boolean isValidMask() { return validMask; } /** ! * Returns true if {@code attributes} is null or empty. */ boolean isLiteral(Map<?, ?> attributes) { return ((attributes == null) || attributes.size() == 0); } /** ! * Updates the interal bitset from {@code iterator}. This will ! * set {@code validMask} to true if {@code iterator} is * non-null. */ private void updateMask(AttributedCharacterIterator iterator) { if (iterator != null) { validMask = true;
*** 817,836 **** } } } /** ! * Returns true if <code>field</code> is non-null. * Subclasses that wish to allow incrementing to happen outside of * the known fields will need to override this. */ boolean canIncrement(Object field, int cursorPosition) { return (field != null); } /** ! * Selects the fields identified by <code>attributes</code>. */ void selectField(Object f, int count) { AttributedCharacterIterator iterator = getIterator(); if (iterator != null && --- 817,836 ---- } } } /** ! * Returns true if {@code field} is non-null. * Subclasses that wish to allow incrementing to happen outside of * the known fields will need to override this. */ boolean canIncrement(Object field, int cursorPosition) { return (field != null); } /** ! * Selects the fields identified by {@code attributes}. */ void selectField(Object f, int count) { AttributedCharacterIterator iterator = getIterator(); if (iterator != null &&
*** 863,875 **** Object getAdjustField(int start, Map<?, ?> attributes) { return null; } /** ! * Returns the number of occurrences of <code>f</code> before ! * the location <code>start</code> in the current ! * <code>AttributedCharacterIterator</code>. */ private int getFieldTypeCountTo(Object f, int start) { AttributedCharacterIterator iterator = getIterator(); int count = 0; --- 863,875 ---- Object getAdjustField(int start, Map<?, ?> attributes) { return null; } /** ! * Returns the number of occurrences of {@code f} before ! * the location {@code start} in the current ! * {@code AttributedCharacterIterator}. */ private int getFieldTypeCountTo(Object f, int start) { AttributedCharacterIterator iterator = getIterator(); int count = 0;
*** 895,908 **** return count; } /** * Subclasses supporting incrementing must override this to handle ! * the actual incrementing. <code>value</code> is the current value, ! * <code>attributes</code> gives the field the cursor is in (may be ! * null depending upon <code>canIncrement</code>) and ! * <code>direction</code> is the amount to increment by. */ Object adjustValue(Object value, Map<?, ?> attributes, Object field, int direction) throws BadLocationException, ParseException { return null; --- 895,908 ---- return count; } /** * Subclasses supporting incrementing must override this to handle ! * the actual incrementing. {@code value} is the current value, ! * {@code attributes} gives the field the cursor is in (may be ! * null depending upon {@code canIncrement}) and ! * {@code direction} is the amount to increment by. */ Object adjustValue(Object value, Map<?, ?> attributes, Object field, int direction) throws BadLocationException, ParseException { return null;
*** 911,929 **** /** * Returns false, indicating InternationalFormatter does not allow * incrementing of the value. Subclasses that wish to support * incrementing/decrementing the value should override this and * return true. Subclasses should also override ! * <code>adjustValue</code>. */ boolean getSupportsIncrement() { return false; } /** * Resets the value of the JFormattedTextField to be ! * <code>value</code>. */ void resetValue(Object value) throws BadLocationException, ParseException { Document doc = getFormattedTextField().getDocument(); String string = valueToString(value); --- 911,929 ---- /** * Returns false, indicating InternationalFormatter does not allow * incrementing of the value. Subclasses that wish to support * incrementing/decrementing the value should override this and * return true. Subclasses should also override ! * {@code adjustValue}. */ boolean getSupportsIncrement() { return false; } /** * Resets the value of the JFormattedTextField to be ! * {@code value}. */ void resetValue(Object value) throws BadLocationException, ParseException { Document doc = getFormattedTextField().getDocument(); String string = valueToString(value);
*** 947,957 **** updateMaskIfNecessary(); } /** ! * Overriden to return an instance of <code>ExtendedReplaceHolder</code>. */ ReplaceHolder getReplaceHolder(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs) { if (replaceHolder == null) { --- 947,957 ---- updateMaskIfNecessary(); } /** ! * Overriden to return an instance of {@code ExtendedReplaceHolder}. */ ReplaceHolder getReplaceHolder(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs) { if (replaceHolder == null) {
*** 994,1004 **** } /** * IncrementAction is used to increment the value by a certain amount. ! * It calls into <code>adjustValue</code> to handle the actual * incrementing of the value. */ private class IncrementAction extends AbstractAction { private int direction; --- 994,1004 ---- } /** * IncrementAction is used to increment the value by a certain amount. ! * It calls into {@code adjustValue} to handle the actual * incrementing of the value. */ private class IncrementAction extends AbstractAction { private int direction;
< prev index next >