Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / ComponentOrientation.js
1 Clazz.declarePackage ("java.awt");
2 Clazz.load (null, "java.awt.ComponentOrientation", ["java.util.Locale"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.orientation = 0;
5 Clazz.instantialize (this, arguments);
6 }, java.awt, "ComponentOrientation");
7 Clazz.defineMethod (c$, "isHorizontal", 
8 function () {
9 return (this.orientation & 2) != 0;
10 });
11 Clazz.defineMethod (c$, "isLeftToRight", 
12 function () {
13 return (this.orientation & 4) != 0;
14 });
15 c$.getOrientation = Clazz.defineMethod (c$, "getOrientation", 
16 function (locale) {
17 var lang = locale.getLanguage ();
18 if ("iw".equals (lang) || "ar".equals (lang) || "fa".equals (lang) || "ur".equals (lang)) {
19 return java.awt.ComponentOrientation.RIGHT_TO_LEFT;
20 } else {
21 return java.awt.ComponentOrientation.LEFT_TO_RIGHT;
22 }}, "java.util.Locale");
23 c$.getOrientation = Clazz.defineMethod (c$, "getOrientation", 
24 function (bdl) {
25 var result = null;
26 try {
27 result = bdl.getObject ("Orientation");
28 } catch (e) {
29 if (Clazz.exceptionOf (e, Exception)) {
30 } else {
31 throw e;
32 }
33 }
34 if (result == null) {
35 result = java.awt.ComponentOrientation.getOrientation (bdl.getLocale ());
36 }if (result == null) {
37 result = java.awt.ComponentOrientation.getOrientation (java.util.Locale.getDefault ());
38 }return result;
39 }, "java.util.ResourceBundle");
40 Clazz.makeConstructor (c$, 
41  function (value) {
42 this.orientation = value;
43 }, "~N");
44 Clazz.defineStatics (c$,
45 "UNK_BIT", 1,
46 "HORIZ_BIT", 2,
47 "LTR_BIT", 4);
48 c$.LEFT_TO_RIGHT = c$.prototype.LEFT_TO_RIGHT =  new java.awt.ComponentOrientation (6);
49 c$.RIGHT_TO_LEFT = c$.prototype.RIGHT_TO_LEFT =  new java.awt.ComponentOrientation (2);
50 c$.UNKNOWN = c$.prototype.UNKNOWN =  new java.awt.ComponentOrientation (7);
51 });