ConflictsPreventer.java
1.54 KB
1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package osp.ui;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* Enabling / Disabling menu options or components
* @author JMG
*
*/
public class ConflictsPreventer extends WindowAdapter {
private OSPE_VisuPanel visuPanel;
private OSPE_SelectPanel selectPanel;
private OspeMenuBar menuBar;
private OSPE_BrowserToolBar toolBar;
public ConflictsPreventer(OSPE_VisuPanel visuPanel, OSPE_SelectPanel selectPanel,
OspeMenuBar menuBar, OSPE_BrowserToolBar toolBar) {
this.visuPanel = visuPanel;
this.selectPanel = selectPanel;
this.menuBar = menuBar;
this.toolBar = toolBar;
}
@Override
public void windowOpened(WindowEvent e) {
visuPanel.searchButton.setEnabled(false);
visuPanel.validateButton.setEnabled(false);
visuPanel.writeButton.setEnabled(false);
for (int i = 0; i < toolBar.getComponentCount() - 1; i++)
toolBar.getComponent(i).setEnabled(false);
for (int i = 0; i < menuBar.getComponentCount() - 1; i++)
menuBar.getComponent(i).setEnabled(false);
selectPanel.getFovTree().setEnabled(false);
visuPanel.updateByHand();
}
@Override
public void windowClosed(WindowEvent e) {
visuPanel.searchButton.setEnabled(true);
visuPanel.validateButton.setEnabled(true);
visuPanel.writeButton.setEnabled(true);
for (int i = 0; i < toolBar.getComponentCount() - 1; i++)
toolBar.getComponent(i).setEnabled(true);
for (int i = 0; i < menuBar.getComponentCount() - 1; i++)
menuBar.getComponent(i).setEnabled(true);
selectPanel.getFovTree().setEnabled(true);
visuPanel.updateByHand();
}
}