144 }
145
146 for (int i = 0; i < obs.length; i++) {
147 obs[i].filterUpdated(filter);
148 }
149 }
150
151 @Override
152 boolean load(Map map) {
153 boolean result = super.load(map);
154 activeSettings = new SettingsSnapshot(map);
155 putSettings(activeSettings);
156 activateSettings(activeSettings);
157
158 notifyUpdated(this);
159
160 return result;
161 }
162
163 @Override
164 boolean save(Map map) {
165 boolean result = super.save(map);
166 activeSettings.save(map);
167
168 return result;
169 }
170
171 void update(InterviewParameters ip) {
172 activateSettings(activeSettings);
173 }
174
175 synchronized JComponent getEditorPane() {
176 if (editorPane == null) {
177 editorPane = uif.createTabbedPane("basicTf.tabs", createTabPanels());
178 editorPane.setTabPlacement(SwingConstants.TOP);
179
180 try {
181 if (activeSettings == null) {
182 activeSettings = grabSettings();
183 } else {
184 putSettings(activeSettings);
311 TestFilter newJtxFilter = null;
312 StatusFilter newStatusFilter = null;
313 TestFilter newTsfFilter = null;
314
315 InterviewParameters ip = execModel.getInterviewParameters();
316 TestSuite ts = execModel.getTestSuite();
317 updateInterviewObserver(ip);
318
319 // recreate filters
320 if (nowSettings.urlsEnabled) {
321 // converting to strings to avoid any confusion
322 // files vs urls
323 if (nowSettings.initialUrls != null) {
324 newUrlFilter = new InitialUrlFilter(nowSettings.initialUrls);
325 }
326 }
327
328 if (nowSettings.keywordsEnabled) {
329 try {
330 String[] validKeywords = ts.getKeywords();
331 HashSet validKeywordsSet;
332 if (validKeywords == null) {
333 validKeywordsSet = null;
334 } else {
335 validKeywordsSet = new HashSet(Arrays.asList(validKeywords));
336 }
337
338 Keywords kw = Keywords.create(kwModeToType(nowSettings.keyChoice),
339 nowSettings.keyString, validKeywordsSet);
340 newKeyFilter = new KeywordsFilter(kw);
341 } catch (Keywords.Fault f) {
342 return f.getMessage();
343 }
344
345 }
346
347 if (nowSettings.statusEnabled) {
348 // this filter won't work without a TRT
349 TestResultTable trt = execModel.getActiveTestResultTable();
350 if (trt != null) {
351 newStatusFilter = new StatusFilter(
352 nowSettings.statusFields,
353 trt);
354 statusFilterNeedsUpdate = false;
355 } else {
711 final JLabel fileLab = uif.createLabel("basicTf.exclude.file");
712 fileLab.setDisplayedMnemonic(uif.getI18NString("basicTf.exclude.file.mne").charAt(0));
713 fileLab.setEnabled(jtxCheckBox.isSelected());
714 p.add(fileLab, c);
715
716 // column 2
717 c.gridy = 2;
718 c.gridx = 3;
719 c.fill = GridBagConstraints.HORIZONTAL;
720 jtxMode = uif.createOutputField("basicTf.exclude.mode", modeLab);
721 jtxMode.setBorder(BorderFactory.createEmptyBorder());
722 jtxMode.setEditable(false);
723 jtxMode.setEnabled(jtxCheckBox.isSelected());
724 uif.setAccessibleInfo(jtxMode, "basicTf.exclude.mode");
725 p.add(jtxMode, c);
726
727 c.gridy = 3;
728 c.weightx = 2;
729 c.weighty = 2;
730 c.fill = GridBagConstraints.BOTH;
731 jtxFiles = new DefaultListModel();
732 jtxFileList = uif.createList("basicTf.exclude.file", jtxFiles);
733 jtxFileList.setEnabled(jtxCheckBox.isSelected());
734 uif.setAccessibleInfo(jtxFileList, "basicTf.exclude.file");
735 fileLab.setLabelFor(jtxFileList);
736
737 // might need to add a scroll panel here
738 p.add(uif.createScrollPane(jtxFileList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
739 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), c);
740
741 jtxCheckBox.addActionListener(new ActionListener() {
742
743 public void actionPerformed(ActionEvent e) {
744 jtxFileList.setEnabled(jtxCheckBox.isSelected());
745 jtxMode.setEnabled(jtxCheckBox.isSelected());
746 modeLab.setEnabled(jtxCheckBox.isSelected());
747 fileLab.setEnabled(jtxCheckBox.isSelected());
748 }
749 });
750
751 return p;
891
892 // status info
893 private ButtonGroup statusBtnGrp;
894 private JRadioButton statusAllBtn;
895 private JRadioButton statusAnyOfBtn;
896 private JCheckBox[] statusChecks = new JCheckBox[Status.NUM_STATES];
897
898 // tests info
899 private ButtonGroup testsBtnGrp;
900 //private JRadioButton allTestsBtn;
901 //private JRadioButton selectTestsBtn;
902 private TestTreeSelectionPane testsField;
903
904 // checkboxes to enable exclude list from interview and test suite filter
905 private JCheckBox jtxCheckBox;
906 private JCheckBox tsfCheckBox;
907
908 // jtx info fields
909 private JTextField jtxMode;
910 private JList jtxFileList;
911 private DefaultListModel jtxFiles;
912 private static String NAME, REASON, DESCRIPTION;
913
914 /**
915 * Necessary to track changes which occur in the active interview.
916 */
917 private class InterviewObserver implements Interview.Observer {
918
919 InterviewObserver(InterviewParameters i) {
920 interview = i;
921 }
922
923 InterviewParameters getInterview() {
924 return interview;
925 }
926
927 public void currentQuestionChanged(Question q) {
928 // ignore
929 }
930
931 public void pathUpdated() {
1034 }
1035 } // outer else
1036
1037 if (statusEnabled != incoming.statusEnabled) {
1038 return false;
1039 } else if (!Arrays.equals(statusFields, incoming.statusFields)) {
1040 return false;
1041 }
1042
1043 if (jtxEnabled != incoming.jtxEnabled) {
1044 return false;
1045 }
1046
1047 if (tsfEnabled != incoming.tsfEnabled) {
1048 return false;
1049 }
1050
1051 return true;
1052 } // equals()
1053
1054 void save(Map map) {
1055 map.put(MAP_URL_ENABLE, booleanToInt(urlsEnabled));
1056 map.put(MAP_KEY_ENABLE, booleanToInt(keywordsEnabled));
1057 map.put(MAP_STATUS_ENABLE, booleanToInt(statusEnabled));
1058 map.put(MAP_JTX_ENABLE, booleanToInt(jtxEnabled));
1059 map.put(MAP_TSF_ENABLE, booleanToInt(tsfEnabled));
1060
1061 for (int i = 0; i < statusFields.length; i++) {
1062 map.put(MAP_STATUS_PREFIX + i, booleanToInt(statusFields[i]));
1063 }
1064
1065 map.put(MAP_URLS, StringArray.join(initialUrls));
1066
1067 map.put(MAP_KEY_CHOICE, keyChoice);
1068 map.put(MAP_KEY_STRING, keyString);
1069 }
1070
1071 void load(Map map) {
1072 urlsEnabled = intToBoolean((String) (map.get(MAP_URL_ENABLE)));
1073 keywordsEnabled = intToBoolean((String) (map.get(MAP_KEY_ENABLE)));
1074 statusEnabled = intToBoolean((String) (map.get(MAP_STATUS_ENABLE)));
|
144 }
145
146 for (int i = 0; i < obs.length; i++) {
147 obs[i].filterUpdated(filter);
148 }
149 }
150
151 @Override
152 boolean load(Map map) {
153 boolean result = super.load(map);
154 activeSettings = new SettingsSnapshot(map);
155 putSettings(activeSettings);
156 activateSettings(activeSettings);
157
158 notifyUpdated(this);
159
160 return result;
161 }
162
163 @Override
164 boolean save(Map<String, String> map) {
165 boolean result = super.save(map);
166 activeSettings.save(map);
167
168 return result;
169 }
170
171 void update(InterviewParameters ip) {
172 activateSettings(activeSettings);
173 }
174
175 synchronized JComponent getEditorPane() {
176 if (editorPane == null) {
177 editorPane = uif.createTabbedPane("basicTf.tabs", createTabPanels());
178 editorPane.setTabPlacement(SwingConstants.TOP);
179
180 try {
181 if (activeSettings == null) {
182 activeSettings = grabSettings();
183 } else {
184 putSettings(activeSettings);
311 TestFilter newJtxFilter = null;
312 StatusFilter newStatusFilter = null;
313 TestFilter newTsfFilter = null;
314
315 InterviewParameters ip = execModel.getInterviewParameters();
316 TestSuite ts = execModel.getTestSuite();
317 updateInterviewObserver(ip);
318
319 // recreate filters
320 if (nowSettings.urlsEnabled) {
321 // converting to strings to avoid any confusion
322 // files vs urls
323 if (nowSettings.initialUrls != null) {
324 newUrlFilter = new InitialUrlFilter(nowSettings.initialUrls);
325 }
326 }
327
328 if (nowSettings.keywordsEnabled) {
329 try {
330 String[] validKeywords = ts.getKeywords();
331 HashSet<String> validKeywordsSet;
332 if (validKeywords == null) {
333 validKeywordsSet = null;
334 } else {
335 validKeywordsSet = new HashSet<>(Arrays.asList(validKeywords));
336 }
337
338 Keywords kw = Keywords.create(kwModeToType(nowSettings.keyChoice),
339 nowSettings.keyString, validKeywordsSet);
340 newKeyFilter = new KeywordsFilter(kw);
341 } catch (Keywords.Fault f) {
342 return f.getMessage();
343 }
344
345 }
346
347 if (nowSettings.statusEnabled) {
348 // this filter won't work without a TRT
349 TestResultTable trt = execModel.getActiveTestResultTable();
350 if (trt != null) {
351 newStatusFilter = new StatusFilter(
352 nowSettings.statusFields,
353 trt);
354 statusFilterNeedsUpdate = false;
355 } else {
711 final JLabel fileLab = uif.createLabel("basicTf.exclude.file");
712 fileLab.setDisplayedMnemonic(uif.getI18NString("basicTf.exclude.file.mne").charAt(0));
713 fileLab.setEnabled(jtxCheckBox.isSelected());
714 p.add(fileLab, c);
715
716 // column 2
717 c.gridy = 2;
718 c.gridx = 3;
719 c.fill = GridBagConstraints.HORIZONTAL;
720 jtxMode = uif.createOutputField("basicTf.exclude.mode", modeLab);
721 jtxMode.setBorder(BorderFactory.createEmptyBorder());
722 jtxMode.setEditable(false);
723 jtxMode.setEnabled(jtxCheckBox.isSelected());
724 uif.setAccessibleInfo(jtxMode, "basicTf.exclude.mode");
725 p.add(jtxMode, c);
726
727 c.gridy = 3;
728 c.weightx = 2;
729 c.weighty = 2;
730 c.fill = GridBagConstraints.BOTH;
731 jtxFiles = new DefaultListModel<String>();
732 jtxFileList = uif.createList("basicTf.exclude.file", jtxFiles);
733 jtxFileList.setEnabled(jtxCheckBox.isSelected());
734 uif.setAccessibleInfo(jtxFileList, "basicTf.exclude.file");
735 fileLab.setLabelFor(jtxFileList);
736
737 // might need to add a scroll panel here
738 p.add(uif.createScrollPane(jtxFileList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
739 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), c);
740
741 jtxCheckBox.addActionListener(new ActionListener() {
742
743 public void actionPerformed(ActionEvent e) {
744 jtxFileList.setEnabled(jtxCheckBox.isSelected());
745 jtxMode.setEnabled(jtxCheckBox.isSelected());
746 modeLab.setEnabled(jtxCheckBox.isSelected());
747 fileLab.setEnabled(jtxCheckBox.isSelected());
748 }
749 });
750
751 return p;
891
892 // status info
893 private ButtonGroup statusBtnGrp;
894 private JRadioButton statusAllBtn;
895 private JRadioButton statusAnyOfBtn;
896 private JCheckBox[] statusChecks = new JCheckBox[Status.NUM_STATES];
897
898 // tests info
899 private ButtonGroup testsBtnGrp;
900 //private JRadioButton allTestsBtn;
901 //private JRadioButton selectTestsBtn;
902 private TestTreeSelectionPane testsField;
903
904 // checkboxes to enable exclude list from interview and test suite filter
905 private JCheckBox jtxCheckBox;
906 private JCheckBox tsfCheckBox;
907
908 // jtx info fields
909 private JTextField jtxMode;
910 private JList jtxFileList;
911 private DefaultListModel<String> jtxFiles;
912 private static String NAME, REASON, DESCRIPTION;
913
914 /**
915 * Necessary to track changes which occur in the active interview.
916 */
917 private class InterviewObserver implements Interview.Observer {
918
919 InterviewObserver(InterviewParameters i) {
920 interview = i;
921 }
922
923 InterviewParameters getInterview() {
924 return interview;
925 }
926
927 public void currentQuestionChanged(Question q) {
928 // ignore
929 }
930
931 public void pathUpdated() {
1034 }
1035 } // outer else
1036
1037 if (statusEnabled != incoming.statusEnabled) {
1038 return false;
1039 } else if (!Arrays.equals(statusFields, incoming.statusFields)) {
1040 return false;
1041 }
1042
1043 if (jtxEnabled != incoming.jtxEnabled) {
1044 return false;
1045 }
1046
1047 if (tsfEnabled != incoming.tsfEnabled) {
1048 return false;
1049 }
1050
1051 return true;
1052 } // equals()
1053
1054 void save(Map<String, String> map) {
1055 map.put(MAP_URL_ENABLE, booleanToInt(urlsEnabled));
1056 map.put(MAP_KEY_ENABLE, booleanToInt(keywordsEnabled));
1057 map.put(MAP_STATUS_ENABLE, booleanToInt(statusEnabled));
1058 map.put(MAP_JTX_ENABLE, booleanToInt(jtxEnabled));
1059 map.put(MAP_TSF_ENABLE, booleanToInt(tsfEnabled));
1060
1061 for (int i = 0; i < statusFields.length; i++) {
1062 map.put(MAP_STATUS_PREFIX + i, booleanToInt(statusFields[i]));
1063 }
1064
1065 map.put(MAP_URLS, StringArray.join(initialUrls));
1066
1067 map.put(MAP_KEY_CHOICE, keyChoice);
1068 map.put(MAP_KEY_STRING, keyString);
1069 }
1070
1071 void load(Map map) {
1072 urlsEnabled = intToBoolean((String) (map.get(MAP_URL_ENABLE)));
1073 keywordsEnabled = intToBoolean((String) (map.get(MAP_KEY_ENABLE)));
1074 statusEnabled = intToBoolean((String) (map.get(MAP_STATUS_ENABLE)));
|