JAL-1807 Bob
[jalviewjs.git] / site / j2s / swingjs / plaf / JSTextFieldUI.js
1 Clazz.declarePackage ("swingjs.plaf");
2 Clazz.load (["swingjs.plaf.JSTextUI"], "swingjs.plaf.JSTextFieldUI", ["java.awt.Dimension", "java.awt.event.ActionEvent", "swingjs.api.DOMNode"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.inputType = "text";
5 Clazz.instantialize (this, arguments);
6 }, swingjs.plaf, "JSTextFieldUI", swingjs.plaf.JSTextUI);
7 Clazz.overrideMethod (c$, "getDOMObject", 
8 function () {
9 if (this.domNode == null) {
10 this.updateHandler.checkDocument ();
11 this.focusNode = this.enableNode = this.valueNode = this.domNode = swingjs.api.DOMNode.setStyles (this.createDOMObject ("input", this.id, ["type", this.inputType]), ["padding", "0px 1px"]);
12 swingjs.plaf.JSComponentUI.vCenter (this.domNode, -10);
13 this.bindMouse (this.domNode);
14 this.bindKeys (this.domNode);
15 this.setFocusable ();
16 }this.setCssFont (this.setProp (this.domNode, "value", this.getComponentText ()), this.c.getFont ());
17 if (!this.editable) swingjs.api.DOMNode.setAttr (this.domNode, "readOnly", "true");
18 return this.domNode;
19 });
20 Clazz.overrideMethod (c$, "getCSSDimension", 
21 function (w, h) {
22 return  new java.awt.Dimension (w, h - 2);
23 }, "~N,~N");
24 Clazz.overrideMethod (c$, "handleEnter", 
25 function (eventType) {
26 if (eventType == 401) {
27 var a = this.getActionMap ().get ("notify-field-accept");
28 if (a != null) a.actionPerformed ( new java.awt.event.ActionEvent (this.c, 1001, "notify-field-accept", System.currentTimeMillis (), 0));
29 }return true;
30 }, "~N");
31 });