1 package org.catacomb.druid.dialog;
2
3 import org.catacomb.druid.gui.base.DruInfoPanel;
4 import org.catacomb.druid.util.FileChooser;
5 import org.catacomb.interlish.annotation.Editable;
6 import org.catacomb.interlish.annotation.IOPoint;
7 import org.catacomb.interlish.content.StringValue;
8
9 import java.io.File;
10
11 public class FolderDialogController extends DialogController {
12
13
14 @Editable(xid="nameTF")
15 public StringValue nameSV;
16
17
18 @IOPoint(xid="info")
19 public DruInfoPanel infoPanel;
20
21 File returnValue;
22
23 File initFile;
24
25
26 public FolderDialogController() {
27 super();
28 nameSV = new StringValue("");
29 }
30
31
32
33 public void OK() {
34 returnValue = new File(nameSV.getString());
35 hideDialog();
36 }
37
38 public void cancel() {
39 returnValue = null;
40 hideDialog();
41 }
42
43
44 public void chooseFolder() {
45 checkInit();
46 File fc = FileChooser.getChooser().getFolder(initFile);
47 if (fc != null) {
48 nameSV.reportableSetString(fc.getAbsolutePath(), this);
49 }
50 }
51
52
53 public File getFolder(int[] xy, String msg, File fdef) {
54 checkInit();
55 initFile = fdef;
56 returnValue = null;
57 nameSV.reportableSetString(fdef.getAbsolutePath(), this);
58 infoPanel.showInfo(msg);
59 infoPanel.revalidate();
60 showModalAt(xy[0], xy[1]);
61
62 return returnValue;
63 }
64
65 }