01a643e6e02c4043e22ebcf6b3a06d97f60a6bc8
[jalviewjs.git] / site / swingjs / j2s / javax / swing / text / DefaultFormatterFactory.js
1 Clazz.declarePackage ("javax.swing.text");
2 Clazz.load (["javax.swing.JFormattedTextField"], "javax.swing.text.DefaultFormatterFactory", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.defaultFormat = null;
5 this.displayFormat = null;
6 this.editFormat = null;
7 this.nullFormat = null;
8 Clazz.instantialize (this, arguments);
9 }, javax.swing.text, "DefaultFormatterFactory", javax.swing.JFormattedTextField.AbstractFormatterFactory);
10 Clazz.makeConstructor (c$, 
11 function (defaultFormat, displayFormat, editFormat, nullFormat) {
12 Clazz.superConstructor (this, javax.swing.text.DefaultFormatterFactory, []);
13 {
14 defaultFormat || (defaultFormat = null);
15 displayFormat || (displayFormat = null);
16 editFormat || (editFormat = null);
17 nullFormat || (nullFormat = null);
18 }this.set (defaultFormat, displayFormat, editFormat, nullFormat);
19 }, "javax.swing.JFormattedTextField.AbstractFormatter,javax.swing.JFormattedTextField.AbstractFormatter,javax.swing.JFormattedTextField.AbstractFormatter,javax.swing.JFormattedTextField.AbstractFormatter");
20 Clazz.defineMethod (c$, "set", 
21  function (defaultFormat, displayFormat, editFormat, nullFormat) {
22 this.defaultFormat = defaultFormat;
23 this.displayFormat = displayFormat;
24 this.editFormat = editFormat;
25 this.nullFormat = nullFormat;
26 return this;
27 }, "javax.swing.JFormattedTextField.AbstractFormatter,javax.swing.JFormattedTextField.AbstractFormatter,javax.swing.JFormattedTextField.AbstractFormatter,javax.swing.JFormattedTextField.AbstractFormatter");
28 Clazz.defineMethod (c$, "setDefaultFormatter", 
29 function (atf) {
30 this.defaultFormat = atf;
31 }, "javax.swing.JFormattedTextField.AbstractFormatter");
32 Clazz.defineMethod (c$, "getDefaultFormatter", 
33 function () {
34 return this.defaultFormat;
35 });
36 Clazz.defineMethod (c$, "setDisplayFormatter", 
37 function (atf) {
38 this.displayFormat = atf;
39 }, "javax.swing.JFormattedTextField.AbstractFormatter");
40 Clazz.defineMethod (c$, "getDisplayFormatter", 
41 function () {
42 return this.displayFormat;
43 });
44 Clazz.defineMethod (c$, "setEditFormatter", 
45 function (atf) {
46 this.editFormat = atf;
47 }, "javax.swing.JFormattedTextField.AbstractFormatter");
48 Clazz.defineMethod (c$, "getEditFormatter", 
49 function () {
50 return this.editFormat;
51 });
52 Clazz.defineMethod (c$, "setNullFormatter", 
53 function (atf) {
54 this.nullFormat = atf;
55 }, "javax.swing.JFormattedTextField.AbstractFormatter");
56 Clazz.defineMethod (c$, "getNullFormatter", 
57 function () {
58 return this.nullFormat;
59 });
60 Clazz.overrideMethod (c$, "getFormatter", 
61 function (source) {
62 var format = null;
63 if (source == null) {
64 return null;
65 }var value = source.getValue ();
66 if (value == null) {
67 format = this.getNullFormatter ();
68 }if (format == null) {
69 if (source.hasFocus ()) {
70 format = this.getEditFormatter ();
71 } else {
72 format = this.getDisplayFormatter ();
73 }if (format == null) {
74 format = this.getDefaultFormatter ();
75 }}return format;
76 }, "javax.swing.JFormattedTextField");
77 });