1 Clazz.declarePackage ("jssun.awt.shell");
2 Clazz.load (["jssun.awt.shell.ShellFolder"], "jssun.awt.shell.ShellFolderManager", ["java.io.File", "java.lang.Long", "java.util.Collections", "$.Date", "jssun.awt.shell.DefaultShellFolder", "$.ShellFolderColumnInfo"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.fileComparator = null;
5 Clazz.instantialize (this, arguments);
6 }, jssun.awt.shell, "ShellFolderManager");
7 Clazz.prepareFields (c$, function () {
8 this.fileComparator = ((Clazz.isClassDefined ("jssun.awt.shell.ShellFolderManager$1") ? 0 : jssun.awt.shell.ShellFolderManager.$ShellFolderManager$1$ ()), Clazz.innerTypeInstance (jssun.awt.shell.ShellFolderManager$1, this, null));
10 Clazz.defineMethod (c$, "createShellFolder",
12 return new jssun.awt.shell.DefaultShellFolder (null, file);
14 Clazz.defineMethod (c$, "get",
16 if (key.equals ("fileChooserDefaultFolder")) {
17 var homeDir = new java.io.File (System.getProperty ("user.home"));
19 return this.createShellFolder (homeDir);
21 if (Clazz.exceptionOf (e, java.io.FileNotFoundException)) {
27 } else if (key.equals ("roots")) {
28 return java.io.File.listRoots ();
29 } else if (key.equals ("fileChooserComboBoxFolders")) {
30 return this.get ("roots");
31 } else if (key.equals ("fileChooserShortcutPanelFolders")) {
32 return Clazz.newArray (-1, [this.get ("fileChooserDefaultFolder")]);
35 Clazz.defineMethod (c$, "isComputerNode",
39 Clazz.defineMethod (c$, "isFileSystemRoot",
41 if (Clazz.instanceOf (dir, jssun.awt.shell.ShellFolder) && !(dir).isFileSystem ()) {
43 }return (dir.getParentFile () == null);
45 Clazz.defineMethod (c$, "sortFiles",
47 java.util.Collections.sort (files, this.fileComparator);
49 Clazz.defineMethod (c$, "getFolderColumns",
52 if (Clazz.instanceOf (dir, jssun.awt.shell.ShellFolder)) {
53 columns = (dir).getFolderColumns ();
54 }if (columns == null) {
55 columns = Clazz.newArray (-1, [ new jssun.awt.shell.ShellFolderColumnInfo ("FileChooser.fileNameHeaderText", new Integer (150), new Integer (10), true, null, this.fileComparator), new jssun.awt.shell.ShellFolderColumnInfo ("FileChooser.fileSizeHeaderText", new Integer (75), new Integer (4), true, null, jssun.awt.shell.ShellFolderManager.ComparableComparator.getInstance (), true), new jssun.awt.shell.ShellFolderColumnInfo ("FileChooser.fileDateHeaderText", new Integer (130), new Integer (10), true, null, jssun.awt.shell.ShellFolderManager.ComparableComparator.getInstance (), true)]);
58 Clazz.defineMethod (c$, "getFolderColumnValue",
59 function (file, column) {
60 if (Clazz.instanceOf (file, jssun.awt.shell.ShellFolder)) {
61 var value = (file).getFolderColumnValue (column);
64 }}if (file == null || !file.exists ()) {
70 return file.isDirectory () ? null : new Long (file.length ());
72 if (this.isFileSystemRoot (file)) {
74 }var time = file.lastModified ();
75 return (time == 0) ? null : new java.util.Date (time);
79 }, "java.io.File,~N");
80 c$.$ShellFolderManager$1$ = function () {
82 c$ = Clazz.declareAnonymous (jssun.awt.shell, "ShellFolderManager$1", null, java.util.Comparator);
83 Clazz.defineMethod (c$, "compare",
85 return this.compare (a, b);
87 Clazz.defineMethod (c$, "compare",
91 if (Clazz.instanceOf (f1, jssun.awt.shell.ShellFolder)) {
93 if (sf1.isFileSystem ()) {
95 }}if (Clazz.instanceOf (f2, jssun.awt.shell.ShellFolder)) {
97 if (sf2.isFileSystem ()) {
99 }}if (sf1 != null && sf2 != null) {
100 return sf1.compareTo (sf2);
101 } else if (sf1 != null) {
103 } else if (sf2 != null) {
106 var name1 = f1.getName ();
107 var name2 = f2.getName ();
108 var diff = name1.toLowerCase ().compareTo (name2.toLowerCase ());
112 return name1.compareTo (name2);
113 }}}, "java.io.File,java.io.File");
117 c$ = Clazz.declareType (jssun.awt.shell.ShellFolderManager, "ComparableComparator", null, java.util.Comparator);
118 c$.getInstance = Clazz.defineMethod (c$, "getInstance",
120 if (jssun.awt.shell.ShellFolderManager.ComparableComparator.instance == null) {
121 jssun.awt.shell.ShellFolderManager.ComparableComparator.instance = new jssun.awt.shell.ShellFolderManager.ComparableComparator ();
122 }return jssun.awt.shell.ShellFolderManager.ComparableComparator.instance;
124 Clazz.overrideMethod (c$, "compare",
127 if (a == null && b == null) {
129 } else if (a != null && b == null) {
131 } else if (a == null && b != null) {
133 } else if (Clazz.instanceOf (a, Comparable)) {
134 c = (a).compareTo (b);
139 Clazz.defineStatics (c$,
142 Clazz.defineStatics (c$,
143 "COLUMN_NAME", "FileChooser.fileNameHeaderText",
144 "COLUMN_SIZE", "FileChooser.fileSizeHeaderText",
145 "COLUMN_DATE", "FileChooser.fileDateHeaderText");