001 package util.swing;
002
003 /**
004 * Interface defining filter for JFilterInput components.
005 *
006 * <p>Implement the methods according to your needs.
007 * </p>
008 *
009 * @author Thomas Ryssel
010 * @version 3.2
011 * @since 3.2 2006-03-18
012 */
013 public interface InputFilter {
014
015 /**
016 * Called before applying a changed value in the JFilterInput.
017 *
018 * <p>If this returns true, the value will be accepted, in any
019 * other case the new value will not be taken.
020 * </p>
021 *
022 * @param value The new value the input would have after applying
023 * the current change.
024 * @return Whether or not to accept this value.
025 */
026 public boolean allowEditing(String value);
027
028 /**
029 * Called when exiting the control.
030 *
031 * <p>Lets you react on "finishing" some input. If the given value
032 * is not acceptable you can edit and return it. This is also the right
033 * place for error messages and similar things.
034 * </p>
035 *
036 * @param value The current value the input has.
037 * @return An accepted value.
038 */
039 public String validExit(String value);
040
041 }