35 */
36 public class StageHelper extends WindowHelper {
37
38 private static final StageHelper theInstance;
39 private static StageAccessor stageAccessor;
40
41 static {
42 theInstance = new StageHelper();
43 Utils.forceInit(Stage.class);
44 }
45
46 private static WindowHelper getInstance() {
47 return theInstance;
48 }
49
50 public static void initHelper(Stage stage) {
51 setHelper(stage, getInstance());
52 }
53
54 @Override
55 protected String getMXWindowTypeImpl(Window window) {
56 return stageAccessor.doGetMXWindowType(window);
57 }
58
59 @Override
60 protected void visibleChangingImpl(Window window, boolean visible) {
61 super.visibleChangingImpl(window, visible);
62 stageAccessor.doVisibleChanging(window, visible);
63 }
64
65 @Override
66 protected void visibleChangedImpl(Window window, boolean visible) {
67 super.visibleChangedImpl(window, visible);
68 stageAccessor.doVisibleChanged(window, visible);
69 }
70
71 public static void initSecurityDialog(Stage stage, boolean securityDialog) {
72 stageAccessor.initSecurityDialog(stage, securityDialog);
73 }
74
75 public static void setPrimary(Stage stage, boolean primary) {
76 stageAccessor.setPrimary(stage, primary);
77 }
78
79 public static void setImportant(Stage stage, boolean important) {
80 stageAccessor.setImportant(stage, important);
81 }
82
83 public static void setStageAccessor(StageAccessor a) {
84 if (stageAccessor != null) {
85 System.out.println("Warning: Stage accessor already set: " + stageAccessor);
86 Thread.dumpStack();
87 }
88 stageAccessor = a;
89 }
90
91 public static StageAccessor getStageAccessor() {
92 return stageAccessor;
93 }
94
95 public static interface StageAccessor {
96 String doGetMXWindowType(Window window);
97 void doVisibleChanging(Window window, boolean visible);
98 void doVisibleChanged(Window window, boolean visible);
99 public void initSecurityDialog(Stage stage, boolean securityDialog);
100 public void setPrimary(Stage stage, boolean primary);
101 public void setImportant(Stage stage, boolean important);
102 }
103 }
|
35 */
36 public class StageHelper extends WindowHelper {
37
38 private static final StageHelper theInstance;
39 private static StageAccessor stageAccessor;
40
41 static {
42 theInstance = new StageHelper();
43 Utils.forceInit(Stage.class);
44 }
45
46 private static WindowHelper getInstance() {
47 return theInstance;
48 }
49
50 public static void initHelper(Stage stage) {
51 setHelper(stage, getInstance());
52 }
53
54 @Override
55 protected void visibleChangingImpl(Window window, boolean visible) {
56 super.visibleChangingImpl(window, visible);
57 stageAccessor.doVisibleChanging(window, visible);
58 }
59
60 @Override
61 protected void visibleChangedImpl(Window window, boolean visible) {
62 super.visibleChangedImpl(window, visible);
63 stageAccessor.doVisibleChanged(window, visible);
64 }
65
66 public static void initSecurityDialog(Stage stage, boolean securityDialog) {
67 stageAccessor.initSecurityDialog(stage, securityDialog);
68 }
69
70 public static void setPrimary(Stage stage, boolean primary) {
71 stageAccessor.setPrimary(stage, primary);
72 }
73
74 public static void setImportant(Stage stage, boolean important) {
75 stageAccessor.setImportant(stage, important);
76 }
77
78 public static void setStageAccessor(StageAccessor a) {
79 if (stageAccessor != null) {
80 System.out.println("Warning: Stage accessor already set: " + stageAccessor);
81 Thread.dumpStack();
82 }
83 stageAccessor = a;
84 }
85
86 public static StageAccessor getStageAccessor() {
87 return stageAccessor;
88 }
89
90 public static interface StageAccessor {
91 void doVisibleChanging(Window window, boolean visible);
92 void doVisibleChanged(Window window, boolean visible);
93 public void initSecurityDialog(Stage stage, boolean securityDialog);
94 public void setPrimary(Stage stage, boolean primary);
95 public void setImportant(Stage stage, boolean important);
96 }
97 }
|