1 package org.catacomb.druid.dialog;
2
3 import org.catacomb.druid.build.Druid;
4 import org.catacomb.druid.gui.base.DruInfoPanel;
5 import org.catacomb.interlish.annotation.Editable;
6 import org.catacomb.interlish.annotation.IOPoint;
7 import org.catacomb.interlish.content.BooleanValue;
8 import org.catacomb.interlish.service.AppPersist;
9 import org.catacomb.interlish.structure.*;
10 import org.catacomb.report.E;
11
12
13
14 public class CheckSeenDialogController implements Controller {
15
16 Druid druid;
17
18 @IOPoint(xid="MessageArea")
19 public DruInfoPanel druInfoPanel;
20
21 @Editable(xid="dontShowAgain")
22 public BooleanValue dontShowAgainBV;
23
24
25
26
27
28 public CheckSeenDialogController() {
29 super();
30
31 druid = new Druid("CheckSeenDialog");
32 druid.buildGUI();
33 druid.attachSingleController(this);
34 }
35
36
37
38 public void attached() {
39 }
40
41 public void show(Object obj) {
42 }
43
44
45 private void showAt(int x, int y) {
46 FrameShowable fs = druid.getFrameShowable();
47 fs.pack();
48 int[] wh = fs.getSize();
49 fs.setLocation(x - wh[0] / 2, y - wh[1] + 20);
50 fs.show();
51 }
52
53
54
55
56 public void showIfNotYetSeen(String label, String s, int[] xy) {
57 if (AppPersist.hasValue("Seen", label)) {
58
59
60 E.info("not showing panel - already shown");
61
62 } else {
63
64 druInfoPanel.setText(s);
65 showAt(xy[0], xy[1]);
66 }
67 }
68
69
70
71 public void OK() {
72 if (dontShowAgainBV.getBoolean()) {
73
74 E.info("setting dsag flag");
75 }
76 druid.hide();
77 }
78
79
80 }