01: /*
02: * SAbstractFormatter.java
03: *
04: * Created on 11. September 2003, 11:29
05: */
06:
07: /*
08: * Copyright 2000,2005 wingS development team.
09: *
10: * This file is part of wingS (http://wingsframework.org).
11: *
12: * wingS is free software; you can redistribute it and/or modify
13: * it under the terms of the GNU Lesser General Public License
14: * as published by the Free Software Foundation; either version 2.1
15: * of the License, or (at your option) any later version.
16: *
17: * Please see COPYING for the complete licence.
18: */
19: package org.wings.text;
20:
21: import org.wings.SFormattedTextField;
22: import java.io.Serializable;
23: import java.text.ParseException;
24:
25: /**
26: * @author theresia
27: */
28: public abstract class SAbstractFormatter implements Serializable {
29:
30: private SFormattedTextField formattedTextField = null;
31:
32: /**
33: * @param text String to convert
34: * @return Object representation of text
35: */
36: public abstract Object stringToValue(String text)
37: throws ParseException;
38:
39: /**
40: * @param value Value to convert
41: * @return String representation of value
42: */
43: public abstract String valueToString(Object value)
44: throws ParseException;
45:
46: public void install(SFormattedTextField formattedTextField) {
47: this .formattedTextField = formattedTextField;
48: }
49:
50: public void uninstall() {
51: this .formattedTextField = null;
52: }
53:
54: public final SFormattedTextField getFormattedTextField() {
55: return formattedTextField;
56: }
57:
58: }
|