< prev index next >
src/com/sun/javatest/exec/NewReportDialog.java
Print this page
*** 110,120 ****
/**
* The dialog is done. Notify the observer to keep a snapshot of
* current state.
*/
! public void update(Map l);
// starting
public void writingReport();
// done
--- 110,120 ----
/**
* The dialog is done. Notify the observer to keep a snapshot of
* current state.
*/
! public void update(Map<String, String> l);
// starting
public void writingReport();
// done
*** 155,168 ****
updateHtmlCheckboxStates();
updateCofCheckboxStates();
}
! Map getLastState() {
! String rd = (String) (dirField.getText());
String filter = filterHandler.getActiveFilter().getName();
! Map lastState = new HashMap();
if (rd != null && rd.length() > 0)
lastState.put(REPORT_DIR, rd);
if (filter != null && filter.length() > 0)
--- 155,168 ----
updateHtmlCheckboxStates();
updateCofCheckboxStates();
}
! Map<String, String> getLastState() {
! String rd = dirField.getText();
String filter = filterHandler.getActiveFilter().getName();
! Map<String, String> lastState = new HashMap<>();
if (rd != null && rd.length() > 0)
lastState.put(REPORT_DIR, rd);
if (filter != null && filter.length() > 0)
*** 178,188 ****
void removeObserver(Observer o) {
obs = (Observer[])DynamicArray.remove(obs, o);
}
// Notify the observers that a change has been made.
! private void notifyUpdate(Map s) {
for (Observer o : obs) {
o.update(s);
}
}
--- 178,188 ----
void removeObserver(Observer o) {
obs = (Observer[])DynamicArray.remove(obs, o);
}
// Notify the observers that a change has been made.
! private void notifyUpdate(Map<String, String> s) {
for (Observer o : obs) {
o.update(s);
}
}
*** 297,307 ****
tabs = uif.createTabbedPane("nrd.tabs", panes);
tabs.setTabPlacement(SwingConstants.TOP);
tabs.setBorder(BorderFactory.createEmptyBorder());
! listModel = new DefaultListModel();
// populate list and card panel
final CardLayout cards = new CardLayout();
final JPanel p = uif.createPanel("nrd.typecards", cards, false);
--- 297,307 ----
tabs = uif.createTabbedPane("nrd.tabs", panes);
tabs.setTabPlacement(SwingConstants.TOP);
tabs.setBorder(BorderFactory.createEmptyBorder());
! listModel = new DefaultListModel<>();
// populate list and card panel
final CardLayout cards = new CardLayout();
final JPanel p = uif.createPanel("nrd.typecards", cards, false);
*** 379,396 ****
int itemCount = listModel.size();
if (itemCount > 9) itemCount = 9;
for (int i = 1; i <= itemCount; ++i) {
list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(i + '0', InputEvent.ALT_DOWN_MASK), ACTION_MAP_KEY);
! JCheckBox box = ((JCheckBox)listModel.getElementAt(i - 1));
box.setMnemonic(i + '0');
box.setText(Character.toString((char)('0' + i)) + " " + box.getText());
}
if (listModel.size() == 10){
list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke('0', InputEvent.ALT_DOWN_MASK), ACTION_MAP_KEY);
! JCheckBox box = ((JCheckBox)listModel.getElementAt(9));
box.setMnemonic('0');
box.setText("0 " + box.getText());
}
//-----------------------------------------------------------------
--- 379,396 ----
int itemCount = listModel.size();
if (itemCount > 9) itemCount = 9;
for (int i = 1; i <= itemCount; ++i) {
list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(i + '0', InputEvent.ALT_DOWN_MASK), ACTION_MAP_KEY);
! JCheckBox box = listModel.getElementAt(i - 1);
box.setMnemonic(i + '0');
box.setText(Character.toString((char)('0' + i)) + " " + box.getText());
}
if (listModel.size() == 10){
list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke('0', InputEvent.ALT_DOWN_MASK), ACTION_MAP_KEY);
! JCheckBox box = listModel.getElementAt(9);
box.setMnemonic('0');
box.setText("0 " + box.getText());
}
//-----------------------------------------------------------------
*** 779,789 ****
if (customReports == null || customReports.length == 0) {
customReports = null;
return 0;
}
! customBoxes = new HashMap();
for (int i = 0; i < customReports.length; i++) {
JCheckBox cb = new JCheckBox(customReports[i].getName());
cb.setName(customReports[i].getReportId());
listModel.addElement(cb);
--- 779,789 ----
if (customReports == null || customReports.length == 0) {
customReports = null;
return 0;
}
! customBoxes = new HashMap<>();
for (int i = 0; i < customReports.length; i++) {
JCheckBox cb = new JCheckBox(customReports[i].getName());
cb.setName(customReports[i].getReportId());
listModel.addElement(cb);
*** 844,854 ****
if(f.equals(new File(reportDir, Report.INDEX_FILE_NAME))) {
reportBrowser.show(f);
}
else {
String[] names = Report.getHtmlReportFilenames();
! ArrayList possible = new ArrayList();
for (int i = 0; i < names.length; i++) {
File rpt = new File(reportDir, names[i]);
if (rpt.exists() && rpt.canRead())
possible.add(rpt);
--- 844,854 ----
if(f.equals(new File(reportDir, Report.INDEX_FILE_NAME))) {
reportBrowser.show(f);
}
else {
String[] names = Report.getHtmlReportFilenames();
! ArrayList<File> possible = new ArrayList<>();
for (int i = 0; i < names.length; i++) {
File rpt = new File(reportDir, names[i]);
if (rpt.exists() && rpt.canRead())
possible.add(rpt);
*** 897,907 ****
}
}
private ArrayList<CustomReport> getActiveCustomReports() {
! ArrayList customReps = new ArrayList();
if (customBoxes != null && customBoxes.size() > 0) {
Iterator it = customBoxes.keySet().iterator();
while (it.hasNext()) {
JCheckBox box = (JCheckBox)(it.next());
if (box.isSelected()) {
--- 897,907 ----
}
}
private ArrayList<CustomReport> getActiveCustomReports() {
! ArrayList<CustomReport> customReps = new ArrayList<>();
if (customBoxes != null && customBoxes.size() > 0) {
Iterator it = customBoxes.keySet().iterator();
while (it.hasNext()) {
JCheckBox box = (JCheckBox)(it.next());
if (box.isSelected()) {
*** 1100,1110 ****
while (it.hasNext()) {
CustomReport cr = (CustomReport) it.next();
String error = cr.validateOptions();
if (error != null) {
for (int i = 0; i < listModel.getSize(); i++ ) {
! JCheckBox cb = (JCheckBox)listModel.elementAt(i);
if (cb.getName().equals(cr.getReportId())) {
list.setSelectedIndex(i);
}
}
uif.showError("nrd.optionsErr", new Object[] {error} );
--- 1100,1110 ----
while (it.hasNext()) {
CustomReport cr = (CustomReport) it.next();
String error = cr.validateOptions();
if (error != null) {
for (int i = 0; i < listModel.getSize(); i++ ) {
! JCheckBox cb = listModel.elementAt(i);
if (cb.getName().equals(cr.getReportId())) {
list.setSelectedIndex(i);
}
}
uif.showError("nrd.optionsErr", new Object[] {error} );
*** 1503,1525 ****
if ("enabled".equals(evt.getPropertyName())) {
boolean oldV = ((Boolean) evt.getOldValue()).booleanValue();
boolean newV = ((Boolean) evt.getNewValue()).booleanValue();
if (oldV && !newV) {
// disable
! Iterator chIt = collectChildren(theContainer, new ArrayList()).iterator();
! enabledComp = new HashSet();
while (chIt.hasNext()) {
Component c = (Component) chIt.next();
if (c.isEnabled()) {
enabledComp.add(c);
c.setEnabled(false);
}
}
} else if (!oldV && newV && enabledComp != null) {
// enable
! Iterator chIt = collectChildren(theContainer, new ArrayList()).iterator();
while (chIt.hasNext()) {
Component c = (Component) chIt.next();
if (enabledComp.contains(c)) {
c.setEnabled(true);
}
--- 1503,1525 ----
if ("enabled".equals(evt.getPropertyName())) {
boolean oldV = ((Boolean) evt.getOldValue()).booleanValue();
boolean newV = ((Boolean) evt.getNewValue()).booleanValue();
if (oldV && !newV) {
// disable
! Iterator chIt = collectChildren(theContainer, new ArrayList<Component>()).iterator();
! enabledComp = new HashSet<>();
while (chIt.hasNext()) {
Component c = (Component) chIt.next();
if (c.isEnabled()) {
enabledComp.add(c);
c.setEnabled(false);
}
}
} else if (!oldV && newV && enabledComp != null) {
// enable
! Iterator chIt = collectChildren(theContainer, new ArrayList<Component>()).iterator();
while (chIt.hasNext()) {
Component c = (Component) chIt.next();
if (enabledComp.contains(c)) {
c.setEnabled(true);
}
*** 1529,1539 ****
}
/**
* Recursively gathers all children components
*/
! private Collection collectChildren(Container comp, Collection c) {
Component [] ch = comp.getComponents();
for(int i = 0; i < ch.length; i++) {
c.add(ch[i]);
if (ch[i] instanceof Container) {
collectChildren((Container) ch[i], c);
--- 1529,1539 ----
}
/**
* Recursively gathers all children components
*/
! private Collection collectChildren(Container comp, Collection<Component> c) {
Component [] ch = comp.getComponents();
for(int i = 0; i < ch.length; i++) {
c.add(ch[i]);
if (ch[i] instanceof Container) {
collectChildren((Container) ch[i], c);
*** 1541,1562 ****
}
return c;
}
private Container theContainer;
! private HashSet enabledComp;
}
! private class CheckBoxListCellRenderer implements ListCellRenderer {
public Component getListCellRendererComponent(
! JList list,
! Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
// assert: value is a JCheckBox
! JComponent comp = (JComponent)value;
if (isSelected) {
comp.setOpaque(true);
comp.setBackground(list.getSelectionBackground());
comp.setForeground(list.getSelectionForeground());
}
--- 1541,1562 ----
}
return c;
}
private Container theContainer;
! private HashSet<Component> enabledComp;
}
! private class CheckBoxListCellRenderer implements ListCellRenderer<JComponent> {
public Component getListCellRendererComponent(
! JList<? extends JComponent> list,
! JComponent value,
int index,
boolean isSelected,
boolean cellHasFocus) {
// assert: value is a JCheckBox
! JComponent comp = value;
if (isSelected) {
comp.setOpaque(true);
comp.setBackground(list.getSelectionBackground());
comp.setForeground(list.getSelectionForeground());
}
*** 1572,1586 ****
private Observer[] obs = new Observer[0];
private ExecModel model;
private ReportDirChooser reportDirChooser;
! private DefaultListModel listModel;
! private JList list;
private JTextArea infoArea;
private CustomReport[] customReports;
! private HashMap customBoxes;
private JComponent[] panes;
private JCheckBox cbHtml;
private JCheckBox cbPlain;
private JCheckBox cbXml;
--- 1572,1586 ----
private Observer[] obs = new Observer[0];
private ExecModel model;
private ReportDirChooser reportDirChooser;
! private DefaultListModel<JCheckBox> listModel;
! private JList<? extends JComponent> list;
private JTextArea infoArea;
private CustomReport[] customReports;
! private HashMap<JCheckBox, CustomReport> customBoxes;
private JComponent[] panes;
private JCheckBox cbHtml;
private JCheckBox cbPlain;
private JCheckBox cbXml;
*** 1609,1621 ****
private JCheckBox cbKflMissing;
private JCheckBox cbBak;
private JTextField numBak;
! private ArrayList htmlGroup = new ArrayList();
! private ArrayList configGroup = new ArrayList();
! private ArrayList kflGroup = new ArrayList();
private File reportDir;
private JButton browseBtn;
private JButton okBtn;
private JButton cancelBtn;
--- 1609,1621 ----
private JCheckBox cbKflMissing;
private JCheckBox cbBak;
private JTextField numBak;
! private ArrayList<JCheckBox> htmlGroup = new ArrayList<>();
! private ArrayList<JCheckBox> configGroup = new ArrayList<>();
! private ArrayList<JCheckBox> kflGroup = new ArrayList<>();
private File reportDir;
private JButton browseBtn;
private JButton okBtn;
private JButton cancelBtn;
< prev index next >