Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
117 lines (99 loc) · 3.23 KB

File metadata and controls

117 lines (99 loc) · 3.23 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package loggerForms.dataselect;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
import PamView.dialog.PamDialogPanel;
import PamguardMVC.dataSelector.DataSelector;
import loggerForms.FormDescription;
import loggerForms.controlDescriptions.InputControlDescription;
public class FormDataSelPanel implements PamDialogPanel {
private FormDataSelector formDataSelector;
private JComboBox<String> controlSelector;
private JPanel controlPanel;
private JPanel mainPanel;
private FormDescription formDescription;
private ArrayList<InputControlDescription> dsInputCtrls;
private PamDialogPanel ctrlDSPanel;
private ControlDataSelector controlDataSelector;
public FormDataSelPanel(FormDataSelector formDataSelector) {
this.formDataSelector = formDataSelector;
formDescription = formDataSelector.getFromDescription();
mainPanel = new JPanel(new BorderLayout());
controlSelector = new JComboBox<String>();
mainPanel.add(controlSelector, BorderLayout.NORTH);
mainPanel.add(controlPanel = new JPanel(new BorderLayout()), BorderLayout.CENTER);
controlSelector.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
selectControl();
}
});
}
@Override
public JComponent getDialogComponent() {
return mainPanel;
}
@Override
public void setParams() {
FormDataSelParams params = formDataSelector.getParams();
ArrayList<InputControlDescription> inputCtrls = formDescription.getInputControlDescriptions();
dsInputCtrls = new ArrayList<>();
controlSelector.removeAllItems();
int ind = 0, selInd = -1;
for (InputControlDescription icd : inputCtrls) {
if (icd.getDataSelectCreator() != null) {
dsInputCtrls.add(icd);
if (icd.getTitle().equals(params.controlName)) {
selInd = ind;
}
controlSelector.addItem(icd.getTitle());
ind++;
}
}
if (selInd >= 0) {
controlSelector.setSelectedIndex(selInd);
}
selectControl();
}
protected void selectControl() {
controlPanel.removeAll();
int selInd = controlSelector.getSelectedIndex();
if (selInd < 0|| selInd >= dsInputCtrls.size()) {
return;
}
InputControlDescription inputCtrl = dsInputCtrls.get(selInd);
ControlDataSelCreator ctrlDS = inputCtrl.getDataSelectCreator();
if (ctrlDS == null) {
return;
}
controlDataSelector = ctrlDS.getDataSelector(formDataSelector.getSelectorName(), formDataSelector.isAllowScores(), null);
ctrlDSPanel = controlDataSelector.getDialogPanel();
if (ctrlDSPanel != null) {
ctrlDSPanel.setParams();
controlPanel.add(ctrlDSPanel.getDialogComponent(), BorderLayout.CENTER);
}
}
@Override
public boolean getParams() {
FormDataSelParams params = formDataSelector.getParams();
int selInd = controlSelector.getSelectedIndex();
if (selInd < 0) {
return false;
}
InputControlDescription inputCtrl = dsInputCtrls.get(selInd);
params.controlName = inputCtrl.getTitle();
boolean ok = false;
if (ctrlDSPanel != null) {
ok = ctrlDSPanel.getParams();
}
if (ok) {
params.controlParams = controlDataSelector.getParams();
}
formDataSelector.setParams(params);
return ok;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.