< prev index next >

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

Print this page




 458             JPanel card = new JPanel();
 459             card.setLayout(new GridBagLayout());
 460             GridBagConstraints c = new GridBagConstraints();
 461             c.anchor = GridBagConstraints.CENTER;
 462             c.gridwidth = GridBagConstraints.REMAINDER;
 463             c.weightx = 1;
 464             c.weighty = 1;
 465             JTextField tf = uif.createHeading(uiKey);
 466             uif.setAccessibleInfo(tf, uiKey);
 467             card.add(tf, c);
 468 
 469             JLabel icon = uif.createIconLabel(uiKey);
 470             c.anchor = GridBagConstraints.WEST;
 471             c.weighty = 0;
 472             card.add(icon, c);
 473 
 474             return card;
 475         }
 476 
 477         private void initRunningCard() {
 478             testListData = new DefaultListModel();
 479             final JList list = uif.createList("pm.runlist", testListData);
 480             list.setBorder(BorderFactory.createEtchedBorder());
 481             list.setCellRenderer(RenderingUtilities.createTestListRenderer());
 482             list.addMouseListener(new MouseAdapter() {
 483                     public void mouseClicked(MouseEvent e) {
 484                         int index = list.locationToIndex(e.getPoint());
 485                         if (index < 0)
 486                             return;
 487                         Object target = list.getModel().getElementAt(index);
 488                         if (target instanceof TestResult && tpm != null) {
 489                             tpm.showTest(((TestResult)target).getTestName());
 490                         }
 491                     }
 492                 }
 493             );
 494             runningCard =
 495                 uif.createScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
 496                                 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
 497             addCard(runningCard);
 498         }
 499 
 500         private void addCard(JComponent comp) {
 501             String s = comp.getName();
 502             if (s == null)
 503                 comp.setName("StatusDialog.component" + componentCount++);
 504             add(comp, comp.getName());
 505         }
 506 
 507         private void showCard(JComponent comp) {
 508             //setVisible(false);
 509             ((CardLayout)(getLayout())).show(this, comp.getName());
 510             //setVisible(true);
 511         }
 512 
 513         private JComponent idleCard;
 514         private JComponent runningCard;
 515 
 516         private JTextField fileField;
 517         private DefaultListModel testListData;
 518         private JList testList;
 519         private String rootDir;
 520     }
 521 
 522     private class TimeSubpanel extends StatusSubpanel {
 523         TimeSubpanel() {
 524             setLayout(new GridBagLayout());
 525             Border b1 = uif.createTitledBorder("pm.time");
 526             Border b2 = BorderFactory.createEmptyBorder(10, 5, 10, 5);
 527             setBorder(BorderFactory.createCompoundBorder(b1, b2));
 528 
 529             // Line label
 530             GridBagConstraints lnc = new GridBagConstraints();
 531             lnc.gridx = 0;
 532             lnc.anchor = GridBagConstraints.EAST;
 533             lnc.insets.right = 10;
 534 
 535             // Remaining field
 536             GridBagConstraints rc = new GridBagConstraints();
 537             rc.fill = GridBagConstraints.BOTH;




 458             JPanel card = new JPanel();
 459             card.setLayout(new GridBagLayout());
 460             GridBagConstraints c = new GridBagConstraints();
 461             c.anchor = GridBagConstraints.CENTER;
 462             c.gridwidth = GridBagConstraints.REMAINDER;
 463             c.weightx = 1;
 464             c.weighty = 1;
 465             JTextField tf = uif.createHeading(uiKey);
 466             uif.setAccessibleInfo(tf, uiKey);
 467             card.add(tf, c);
 468 
 469             JLabel icon = uif.createIconLabel(uiKey);
 470             c.anchor = GridBagConstraints.WEST;
 471             c.weighty = 0;
 472             card.add(icon, c);
 473 
 474             return card;
 475         }
 476 
 477         private void initRunningCard() {
 478             testListData = new DefaultListModel<>();
 479             final JList list = uif.createList("pm.runlist", testListData);
 480             list.setBorder(BorderFactory.createEtchedBorder());
 481             list.setCellRenderer(RenderingUtilities.createTestListRenderer());
 482             list.addMouseListener(new MouseAdapter() {
 483                     public void mouseClicked(MouseEvent e) {
 484                         int index = list.locationToIndex(e.getPoint());
 485                         if (index < 0)
 486                             return;
 487                         Object target = list.getModel().getElementAt(index);
 488                         if (target instanceof TestResult && tpm != null) {
 489                             tpm.showTest(((TestResult)target).getTestName());
 490                         }
 491                     }
 492                 }
 493             );
 494             runningCard =
 495                 uif.createScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
 496                                 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
 497             addCard(runningCard);
 498         }
 499 
 500         private void addCard(JComponent comp) {
 501             String s = comp.getName();
 502             if (s == null)
 503                 comp.setName("StatusDialog.component" + componentCount++);
 504             add(comp, comp.getName());
 505         }
 506 
 507         private void showCard(JComponent comp) {
 508             //setVisible(false);
 509             ((CardLayout)(getLayout())).show(this, comp.getName());
 510             //setVisible(true);
 511         }
 512 
 513         private JComponent idleCard;
 514         private JComponent runningCard;
 515 
 516         private JTextField fileField;
 517         private DefaultListModel<TestResult> testListData;
 518         private JList testList;
 519         private String rootDir;
 520     }
 521 
 522     private class TimeSubpanel extends StatusSubpanel {
 523         TimeSubpanel() {
 524             setLayout(new GridBagLayout());
 525             Border b1 = uif.createTitledBorder("pm.time");
 526             Border b2 = BorderFactory.createEmptyBorder(10, 5, 10, 5);
 527             setBorder(BorderFactory.createCompoundBorder(b1, b2));
 528 
 529             // Line label
 530             GridBagConstraints lnc = new GridBagConstraints();
 531             lnc.gridx = 0;
 532             lnc.anchor = GridBagConstraints.EAST;
 533             lnc.insets.right = 10;
 534 
 535             // Remaining field
 536             GridBagConstraints rc = new GridBagConstraints();
 537             rc.fill = GridBagConstraints.BOTH;


< prev index next >