01: package com.calipso.reportgenerator.userinterface;
02:
03: import com.calipso.reportgenerator.reportcalculator.SharedInteger;
04:
05: import javax.swing.text.Document;
06:
07: /**
08: * Representa un componente <code>JTextField</code> a incluirse en una instancia
09: * de <code>UPRangePanel</code> o <code>UPValuePanel</code>.
10: * Devuele el texto del componente en un objeto <code>SharedInteger</code>
11: */
12:
13: public class UPIntegerTextField extends UPTextField {
14:
15: public UPIntegerTextField() {
16: }
17:
18: public UPIntegerTextField(String text) {
19: super (text);
20: }
21:
22: public UPIntegerTextField(int columns) {
23: super (columns);
24: }
25:
26: public UPIntegerTextField(String text, int columns) {
27: super (text, columns);
28: }
29:
30: public UPIntegerTextField(Document doc, String text, int columns) {
31: super (doc, text, columns);
32: }
33:
34: public boolean isLessThan(UPTextField upTextField) {
35: SharedInteger integer = (SharedInteger) getComponentValue();
36: int result = integer.compareTo(upTextField.getComponentValue());
37: if (result > 0) {
38: return false;
39: } else {
40: return true;
41: }
42: }
43:
44: public Object getComponentValue() {
45: String text = super.getText();
46: return SharedInteger.newFrom(Integer.valueOf(text));
47: }
48: }
|