1 package fr.ifremer.reefdb.ui.swing.content;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 import fr.ifremer.quadrige3.ui.swing.content.AbstractMainUIHandler;
27 import fr.ifremer.reefdb.config.ReefDbConfiguration;
28 import fr.ifremer.reefdb.ui.swing.ReefDbApplication;
29 import fr.ifremer.reefdb.ui.swing.ReefDbUIContext;
30 import fr.ifremer.reefdb.ui.swing.util.ReefDbUIs;
31 import jaxx.runtime.SwingUtil;
32 import org.apache.commons.logging.Log;
33 import org.apache.commons.logging.LogFactory;
34
35 import java.net.URL;
36
37
38
39
40
41
42 public class ReefDbMainUIHandler extends AbstractMainUIHandler<ReefDbUIContext, ReefDbMainUI> {
43
44
45
46
47 private static final Log LOG = LogFactory.getLog(ReefDbMainUIHandler.class);
48
49 @Override
50 public ReefDbUIContext getContext() {
51 return (ReefDbUIContext) super.getContext();
52 }
53
54 @Override
55 public ReefDbConfiguration getConfig() {
56 return (ReefDbConfiguration) super.getConfig();
57 }
58
59
60
61
62
63 @Override
64 public void beforeInit(ReefDbMainUI ui) {
65 super.beforeInit(ui);
66
67
68 ui.setContextValue(getContext());
69 ui.createModel();
70 ui.setContextValue(SwingUtil.createActionIcon("observation"));
71 }
72
73
74 @Override
75 public void afterInit(ReefDbMainUI ui) {
76
77 super.afterInit(ui);
78
79 ui.getMenuFile().add(ui.getMenuFileExit());
80
81
82
83
84 }
85
86
87
88
89 public void reloadUI() {
90
91
92 onCloseUI();
93
94
95 ReefDbApplication.reloadUI(getContext());
96 }
97
98
99
100
101 public void gotoSite() {
102 ReefDbConfiguration config = getConfig();
103
104 URL siteURL = config.getSiteUrl();
105
106 if (LOG.isDebugEnabled()) {
107 LOG.debug("goto " + siteURL);
108 }
109 ReefDbUIs.openLink(siteURL);
110 }
111
112
113
114
115 public void showHelp() {
116 getContext().showHelp(ui, ui.getBroker(), null);
117 }
118
119
120 }