< prev index next >

src/com/sun/javatest/exec/PrefsPane.java

Print this page




  64         }
  65 
  66         if (reportingPane == null) {
  67             reportingPane = new ReportingPane();
  68         }
  69 
  70         if (runPane == null) {
  71             runPane = new RunPane();
  72         }
  73 
  74         if (childPanes == null)
  75             childPanes = new PreferencesPane[] { configEditorPane, reportingPane, runPane };
  76         return childPanes;
  77     }
  78 
  79     public String getText() {
  80         return uif.getI18NString("ep.title");
  81     }
  82 
  83     @Override
  84     public void load(Map m) {
  85         super.load(m);
  86         String p = (String) (m.get(ExecTool.TOOLBAR_PREF));
  87         toolBarChk.setSelected(p == null || p.equals("true"));
  88         p = (String) (m.get(ExecTool.FILTER_WARN_PREF));
  89         filterWarnChk.setSelected(p == null || p.equals("true"));
  90         p = (String) (m.get(TP_OutputSubpanel.LINE_WRAP_PREF));
  91         // selected by default
  92         wrapResChk.setSelected((p == null ? true : p.equals("true")));
  93     }
  94 
  95     @Override
  96     public void save(Map m) {
  97         super.save(m);
  98         m.put(ExecTool.TOOLBAR_PREF, String.valueOf(toolBarChk.isSelected()));
  99         m.put(ExecTool.FILTER_WARN_PREF, String.valueOf(filterWarnChk.isSelected()));
 100         m.put(TP_OutputSubpanel.LINE_WRAP_PREF, String.valueOf(wrapResChk.isSelected()));
 101     }
 102 
 103     private void initGUI() {
 104         setLayout(new GridBagLayout());
 105 
 106         GridBagConstraints c = new GridBagConstraints();
 107         c.fill = GridBagConstraints.HORIZONTAL;
 108         c.gridwidth = GridBagConstraints.REMAINDER;
 109         c.weightx = 1;
 110 
 111         add(createToolBarPanel(), c);
 112         add(createFilterPanel(), c);
 113         add(createTestRunMsgPanel(), c);
 114 
 115         c.weighty = 1;
 116         add(Box.createVerticalGlue(), c);


 159 
 160     private UIFactory uif;
 161     private JCheckBox toolBarChk;
 162     private JCheckBox filterWarnChk;
 163     private JCheckBox wrapResChk;
 164     private ConfigEditorPane configEditorPane;
 165     private ReportingPane reportingPane;
 166     private RunPane runPane;
 167     private PreferencesPane[] childPanes;
 168 
 169     private class ConfigEditorPane extends PreferencesPane {
 170         ConfigEditorPane() {
 171             initGUI();
 172         }
 173 
 174         public String getText() {
 175             return uif.getI18NString("ep.ce.title");
 176         }
 177 
 178         @Override
 179         public void load(Map m) {
 180             String mp = (String) (m.get(InterviewEditor.MORE_INFO_PREF));
 181             moreInfoChk.setSelected(mp == null || mp.equals("true"));
 182         }
 183 
 184         @Override
 185         public void save(Map m) {
 186             m.put(InterviewEditor.MORE_INFO_PREF, String.valueOf(moreInfoChk.isSelected()));
 187         }
 188 
 189         private void initGUI() {
 190             setLayout(new GridBagLayout());
 191 
 192             GridBagConstraints c = new GridBagConstraints();
 193             c.fill = GridBagConstraints.HORIZONTAL;
 194             c.gridwidth = GridBagConstraints.REMAINDER;
 195             c.weightx = 1;
 196 
 197             add(createDefaultViewPanel(), c);
 198 
 199             c.weighty = 1;
 200             add(Box.createVerticalGlue(), c);
 201         }
 202 
 203         private JPanel createDefaultViewPanel() {
 204             GridBagConstraints c = new GridBagConstraints();
 205             c.anchor = GridBagConstraints.WEST;


 220             uif.setAccessibleName(moreInfoChk, "ep.ce.moreInfo");
 221 
 222             c.insets.top = 10;
 223             p.add(moreInfoChk, c);
 224             return p;
 225         }
 226 
 227         private JCheckBox moreInfoChk;
 228     }
 229 
 230     private class ReportingPane extends PreferencesPane {
 231         ReportingPane() {
 232             initGUI();
 233         }
 234 
 235         public String getText() {
 236             return uif.getI18NString("ep.rpt.title");
 237         }
 238 
 239         @Override
 240         public void load(Map m) {
 241             String mp = (String) (m.get(ReportManager.BUGRPT_URL_PREF));
 242             bugUrlTf.setText(mp);
 243         }
 244 
 245         @Override
 246         public void save(Map m) {
 247             m.put(ReportManager.BUGRPT_URL_PREF, bugUrlTf.getText());
 248         }
 249 
 250         private void initGUI() {
 251             setLayout(new GridBagLayout());
 252 
 253             GridBagConstraints c = new GridBagConstraints();
 254             c.fill = GridBagConstraints.HORIZONTAL;
 255             c.gridwidth = GridBagConstraints.REMAINDER;
 256             c.weightx = 1;
 257 
 258             add(createDefaultViewPanel(), c);
 259 
 260             c.weighty = 1;
 261             add(Box.createVerticalGlue(), c);
 262         }
 263 
 264         private JPanel createDefaultViewPanel() {
 265             GridBagConstraints c = new GridBagConstraints();
 266             c.anchor = GridBagConstraints.BASELINE_LEADING;


 290             c.gridy = c.gridx = 1;    // under bugUrlTf
 291             c.weightx = 1;
 292             p.add(hint, c);
 293 
 294             return p;
 295         }
 296 
 297         private JTextField bugUrlTf;
 298     }
 299 
 300     private class RunPane extends PreferencesPane {
 301         RunPane() {
 302             initGUI();
 303         }
 304 
 305         public String getText() {
 306             return uif.getI18NString("ep.run.title");
 307         }
 308 
 309         @Override
 310         public void load(Map m) {
 311             String mp = (String) (m.get("javatest.executionOrder"));
 312             if (mp == null) {
 313                 mp = "default";
 314             }
 315 
 316             if (mp.equals("reverse")) {
 317                 reverseRadio.setSelected(true);
 318             }
 319             else if (mp.equals("random")) {
 320                 randomRadio.setSelected(true);
 321             }
 322             else {
 323                 defaultRadio.setSelected(true);
 324             }
 325 
 326             mp = (String) (m.get(ExecTool.TESTS2RUN_PREF));
 327             tests2RunChk.setSelected((mp == null ? false : mp.equals("true")));
 328             mp = (String) (m.get("javatest.sortExecution"));
 329             testSortingChk.setSelected((mp == null ? false : mp.equals("false")));
 330         }
 331 
 332         @Override
 333         public void save(Map m) {
 334             m.put(ExecTool.TESTS2RUN_PREF, String.valueOf(tests2RunChk.isSelected()));
 335             m.put("javatest.sortExecution", Boolean.toString(!testSortingChk.isSelected()));
 336 
 337             String sequence = ".default";
 338             if (reverseRadio.isSelected()) {
 339                 sequence = reverseRadio.getName();
 340             }
 341             else if (randomRadio.isSelected()) {
 342                 sequence = randomRadio.getName();
 343             }
 344             else {
 345                 sequence = defaultRadio.getName();
 346             }
 347 
 348             m.put("javatest.executionOrder", sequence.substring(sequence.lastIndexOf(".") + 1));
 349         }
 350 
 351         private void initGUI() {
 352             setLayout(new GridBagLayout());
 353 




  64         }
  65 
  66         if (reportingPane == null) {
  67             reportingPane = new ReportingPane();
  68         }
  69 
  70         if (runPane == null) {
  71             runPane = new RunPane();
  72         }
  73 
  74         if (childPanes == null)
  75             childPanes = new PreferencesPane[] { configEditorPane, reportingPane, runPane };
  76         return childPanes;
  77     }
  78 
  79     public String getText() {
  80         return uif.getI18NString("ep.title");
  81     }
  82 
  83     @Override
  84     public void load(Map<?, ?> m) {
  85         super.load(m);
  86         String p = (String) (m.get(ExecTool.TOOLBAR_PREF));
  87         toolBarChk.setSelected(p == null || p.equals("true"));
  88         p = (String) (m.get(ExecTool.FILTER_WARN_PREF));
  89         filterWarnChk.setSelected(p == null || p.equals("true"));
  90         p = (String) (m.get(TP_OutputSubpanel.LINE_WRAP_PREF));
  91         // selected by default
  92         wrapResChk.setSelected((p == null ? true : p.equals("true")));
  93     }
  94 
  95     @Override
  96     public void save(Map<String, String> m) {
  97         super.save(m);
  98         m.put(ExecTool.TOOLBAR_PREF, String.valueOf(toolBarChk.isSelected()));
  99         m.put(ExecTool.FILTER_WARN_PREF, String.valueOf(filterWarnChk.isSelected()));
 100         m.put(TP_OutputSubpanel.LINE_WRAP_PREF, String.valueOf(wrapResChk.isSelected()));
 101     }
 102 
 103     private void initGUI() {
 104         setLayout(new GridBagLayout());
 105 
 106         GridBagConstraints c = new GridBagConstraints();
 107         c.fill = GridBagConstraints.HORIZONTAL;
 108         c.gridwidth = GridBagConstraints.REMAINDER;
 109         c.weightx = 1;
 110 
 111         add(createToolBarPanel(), c);
 112         add(createFilterPanel(), c);
 113         add(createTestRunMsgPanel(), c);
 114 
 115         c.weighty = 1;
 116         add(Box.createVerticalGlue(), c);


 159 
 160     private UIFactory uif;
 161     private JCheckBox toolBarChk;
 162     private JCheckBox filterWarnChk;
 163     private JCheckBox wrapResChk;
 164     private ConfigEditorPane configEditorPane;
 165     private ReportingPane reportingPane;
 166     private RunPane runPane;
 167     private PreferencesPane[] childPanes;
 168 
 169     private class ConfigEditorPane extends PreferencesPane {
 170         ConfigEditorPane() {
 171             initGUI();
 172         }
 173 
 174         public String getText() {
 175             return uif.getI18NString("ep.ce.title");
 176         }
 177 
 178         @Override
 179         public void load(Map<?, ?> m) {
 180             String mp = (String) m.get(InterviewEditor.MORE_INFO_PREF);
 181             moreInfoChk.setSelected(mp == null || mp.equals("true"));
 182         }
 183 
 184         @Override
 185         public void save(Map<String, String> m) {
 186             m.put(InterviewEditor.MORE_INFO_PREF, String.valueOf(moreInfoChk.isSelected()));
 187         }
 188 
 189         private void initGUI() {
 190             setLayout(new GridBagLayout());
 191 
 192             GridBagConstraints c = new GridBagConstraints();
 193             c.fill = GridBagConstraints.HORIZONTAL;
 194             c.gridwidth = GridBagConstraints.REMAINDER;
 195             c.weightx = 1;
 196 
 197             add(createDefaultViewPanel(), c);
 198 
 199             c.weighty = 1;
 200             add(Box.createVerticalGlue(), c);
 201         }
 202 
 203         private JPanel createDefaultViewPanel() {
 204             GridBagConstraints c = new GridBagConstraints();
 205             c.anchor = GridBagConstraints.WEST;


 220             uif.setAccessibleName(moreInfoChk, "ep.ce.moreInfo");
 221 
 222             c.insets.top = 10;
 223             p.add(moreInfoChk, c);
 224             return p;
 225         }
 226 
 227         private JCheckBox moreInfoChk;
 228     }
 229 
 230     private class ReportingPane extends PreferencesPane {
 231         ReportingPane() {
 232             initGUI();
 233         }
 234 
 235         public String getText() {
 236             return uif.getI18NString("ep.rpt.title");
 237         }
 238 
 239         @Override
 240         public void load(Map<?, ?> m) {
 241             String mp = (String) (m.get(ReportManager.BUGRPT_URL_PREF));
 242             bugUrlTf.setText(mp);
 243         }
 244 
 245         @Override
 246         public void save(Map<String, String> m) {
 247             m.put(ReportManager.BUGRPT_URL_PREF, bugUrlTf.getText());
 248         }
 249 
 250         private void initGUI() {
 251             setLayout(new GridBagLayout());
 252 
 253             GridBagConstraints c = new GridBagConstraints();
 254             c.fill = GridBagConstraints.HORIZONTAL;
 255             c.gridwidth = GridBagConstraints.REMAINDER;
 256             c.weightx = 1;
 257 
 258             add(createDefaultViewPanel(), c);
 259 
 260             c.weighty = 1;
 261             add(Box.createVerticalGlue(), c);
 262         }
 263 
 264         private JPanel createDefaultViewPanel() {
 265             GridBagConstraints c = new GridBagConstraints();
 266             c.anchor = GridBagConstraints.BASELINE_LEADING;


 290             c.gridy = c.gridx = 1;    // under bugUrlTf
 291             c.weightx = 1;
 292             p.add(hint, c);
 293 
 294             return p;
 295         }
 296 
 297         private JTextField bugUrlTf;
 298     }
 299 
 300     private class RunPane extends PreferencesPane {
 301         RunPane() {
 302             initGUI();
 303         }
 304 
 305         public String getText() {
 306             return uif.getI18NString("ep.run.title");
 307         }
 308 
 309         @Override
 310         public void load(Map<?, ?> m) {
 311             String mp = (String)m.get("javatest.executionOrder");
 312             if (mp == null) {
 313                 mp = "default";
 314             }
 315 
 316             if (mp.equals("reverse")) {
 317                 reverseRadio.setSelected(true);
 318             }
 319             else if (mp.equals("random")) {
 320                 randomRadio.setSelected(true);
 321             }
 322             else {
 323                 defaultRadio.setSelected(true);
 324             }
 325 
 326             mp = (String) (m.get(ExecTool.TESTS2RUN_PREF));
 327             tests2RunChk.setSelected((mp == null ? false : mp.equals("true")));
 328             mp = (String) (m.get("javatest.sortExecution"));
 329             testSortingChk.setSelected((mp == null ? false : mp.equals("false")));
 330         }
 331 
 332         @Override
 333         public void save(Map<String, String> m) {
 334             m.put(ExecTool.TESTS2RUN_PREF, String.valueOf(tests2RunChk.isSelected()));
 335             m.put("javatest.sortExecution", Boolean.toString(!testSortingChk.isSelected()));
 336 
 337             String sequence = ".default";
 338             if (reverseRadio.isSelected()) {
 339                 sequence = reverseRadio.getName();
 340             }
 341             else if (randomRadio.isSelected()) {
 342                 sequence = randomRadio.getName();
 343             }
 344             else {
 345                 sequence = defaultRadio.getName();
 346             }
 347 
 348             m.put("javatest.executionOrder", sequence.substring(sequence.lastIndexOf(".") + 1));
 349         }
 350 
 351         private void initGUI() {
 352             setLayout(new GridBagLayout());
 353 


< prev index next >